Skip to content

Commit

Permalink
system: disable warnings due to count() behaviour in PHP 7.2
Browse files Browse the repository at this point in the history
We have been successfully using E_WARNING as a code quality measurement
since 2015 (see f6c6889).  The API components are even using E_ALL
with all its deprecated and strict checking so everything is an error.

There seems to be no change in count() other than throwing warnings now
which make it hard to write robust code as some parts seem to be buggy in
unreproducible ways.  The warning acts like a wrench in the gears so to
speak with no added code quality value.

Although count() bugs do exist in the code base we do not think that
PHP 7.2 should have created this warning under warning level since the
count() behaviour is relatively well-defined in undefined behaviour
cases and the strictness approach only leads to application damage with
no way but runtime to figure out it is or it is not working.

This is only for stable, not development.

Discussed with: @AdSchellevis
  • Loading branch information
fichtner committed Apr 9, 2019
1 parent a588ce2 commit 716a07d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/etc/rc.subr.d/recover
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ zlib.output_compression = Off
zlib.output_compression_level = 1
include_path = ".:/usr/local/etc/inc:/usr/local/www:/usr/local/opnsense/mvc:/usr/local/opnsense/contrib:/usr/local/share/pear:/usr/local/share"
ignore_repeated_errors = on
error_reporting = E_ALL ^ (E_NOTICE | E_DEPRECATED | E_STRICT)
error_reporting = E_ALL ^ (E_WARNING | E_NOTICE | E_DEPRECATED | E_STRICT)
display_errors=on
log_errors=on
error_log=/tmp/PHP_errors.log
Expand Down
2 changes: 1 addition & 1 deletion src/opnsense/service/templates/OPNsense/WebGui/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ zlib.output_compression = {% if system.webgui.compression|default('') != "" %}On
zlib.output_compression_level = {{system.webgui.compression|default('1')}}
include_path = ".:/usr/local/etc/inc:/usr/local/www:/usr/local/opnsense/mvc:/usr/local/opnsense/contrib:/usr/local/share/pear:/usr/local/share"
ignore_repeated_errors = on
error_reporting = E_ALL ^ (E_NOTICE | E_DEPRECATED | E_STRICT)
error_reporting = E_ALL ^ (E_WARNING | E_NOTICE | E_DEPRECATED | E_STRICT)
display_errors=on
log_errors=on
error_log=/tmp/PHP_errors.log
Expand Down

0 comments on commit 716a07d

Please sign in to comment.