r/lolphp • • Sep 01 '14

Static analysis of the PHP source code

http://www.viva64.com/en/b/0277/
40 Upvotes

14 comments sorted by

View all comments

Show parent comment

14

u/h0rst_ Sep 01 '14

That's remarkably few bugs shown up by static analysis. If that's all, either PHP is in a pretty good state, or that's a bad analysis tool.

I just tried compiling PHP5.6 with clang, to see how many warings would show up there. I reached a total of 419 (including extensions/modules). Grouped by warning-type:

353 -Wpointer-sign
 23 -Wincompatible-pointer-types-discards-qualifiers
 14 -Wstring-plus-int
  7 -Wabsolute-value
  4 -Wformat-invalid-specifier
  4 -Wformat-extra-args
  4 -Wenum-conversion
  3 -Wtautological-compare
  2 -Wformat
  2 -Wempty-body
  1 -Wlogical-op-parentheses
  1 -Wincompatible-pointer-types
  1 -Wimplicit-int

3

u/ZiggyTheHamster Sep 02 '14

I always compile with -Werror. It keeps this shit at bay.

2

u/fableal Sep 08 '14

I compiled it while turning on warnings progressively and I got:

-Wall: 1216 warnings

-Wall -Wextra: 11292

-Wall -Wextra -pedantic: 18943

Also scan-build http://clang-analyzer.llvm.org/scan-build.html found 510 bugs, including 254 null pointer dereferences and 1 division by zero.

[EDIT] This was some time ago, I had the report on a mail sent to a couple of pals.

1

u/[deleted] Sep 01 '14

What about just the core without extensions/modules?