Topic: xajax and PHP5 Strict Standarts
Hi,
Nowadays many web developer uses PHP5 in strict standarts (ie. error_reporting(E_ALL|E_STRICT)) while in development stage. However xajax code does not strictly compatible with PHP5. There are:
- Assigning the return value of new by reference
- Passing variable by reference
- Using is_a() function instead of instanceof operator
- Calling non-static methods statically
in xajax code.
I understand some of them are required for backward compatibility (eg. is_a()) but they cause bad HTTP response when using PHP5 strict standarts. Since I always use xajax with PHP5, everytime I upgrade xajax I replace deprecated code blocks with the PHP compatible ones. Another solution may be turning off error_reporting before xajax code and resetting after:
Code: PHP
<?php
// xajaxAIO.inc.php
$oldErrorLevel = error_reporting(0);
// xajax code here
error_reporting($oldErrorLevel);
?>
OR
Code: PHP
<?php
// myHandler.php
$oldErrorLevel = error_reporting(0);
require_once "path/to/xajax_file.php";
error_reporting($oldErrorLevel);
// rest of my code
?>
Please be aware that as of PHP6 E_STRICT became part of E_ALL which is used by many users even in production environment.