With the current version of PHP MapScript, it is impossible to trap most error
conditions since the PHP module almost always produces E_ERROR php error codes,
and this has the effect of halting the script and none of the error handling
functions in PHP can trap that.
It seems that all other modules use E_WARNING for things like failure to read a
file, connect to a database, etc. This allows the user to trap any error
condition, which is impossible with PHP MapScript. So for all 'normal' error
conditions we should produce an E_WARNING that will be trappable with the '@'
character in the PHP script.
Note that we should also make sure that all functions return valid status codes
(MS_SUCCESS/MS_FAILURE or 0/-1, or TRUE/FALSE) as documented in the PHP
MapScript docs.
Since this will affect existing developers who always counted on the fact that
errors would abort their script, we should document this change properly in the
HISTORY.TXT.
P.S. We also discussed previously the possibility of setting a default (global)
error level for MapScript (E_ERROR or E_WARNING), but when I came to implement
this it looked too much like a mess and I thought that it would be simpler and
better to align the behavior of php_mapscript with the behavior of other PHP
modules. We'll just have to be more careful about detecting error conditions
when we use the module.