[php] Update docs about undefined constants

PHP 7.2 made these a warning instead of just a notice, and apparently it
will throw an Error in a future version of PHP.
This commit is contained in:
Olly Betts 2019-05-22 11:13:55 +12:00
commit e87811223c

View file

@ -231,10 +231,12 @@ echo "E = " . E . "\n";
<p> <p>
There's one peculiarity of how constants work in PHP which it is useful There's one peculiarity of how constants work in PHP which it is useful
to note (this is not specific to SWIG though) - if you try to use an undeclared to note (this is not specific to SWIG though) - if you try to use an undeclared
constant, PHP will emit a notice and then expand the constant to a string constant, PHP will emit a warning (or a notice in PHP 7.1 and earlier) and then
version of the constant's name. Unfortunately it is easy to miss the notice expand the constant to a string version of the constant's name. Unfortunately
if you're using PHP in a webserver, as it will probably end up in error.log or it is easy to miss the warning message if you're using PHP in a webserver as
similar. it will probably end up in error.log or similar. Apparently this will throw
an Error in a future version of PHP, but until then it's something to be
aware of.
</p> </p>
<p> <p>
@ -268,8 +270,7 @@ if(EASY_TO_MISPEL) {
<p> <p>
The mis-spelled constant will become the string 'EASY_TO_MISPEL', which The mis-spelled constant will become the string 'EASY_TO_MISPEL', which
is treated as true by the if test, when the value of the intended constant is treated as true by the if test, when the value of the intended constant
would be treated as false! Modern versions of PHP will at least issue would be treated as false!
a PHP notice by default when this happens.
</p> </p>
<H3><a name="Php_nn2_2">31.2.2 Global Variables</a></H3> <H3><a name="Php_nn2_2">31.2.2 Global Variables</a></H3>