PHP Deprecation Warnings

As I said in my initial post, I already have disabled strict and deprecated warnings in my php.ini:

error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT

Debian has two php.ini files, one for CLI (/etc/php5/cli/php.ini) and another for Apache (/etc/php5/apache2/php.ini) and both are set as stated above. Even if I set error_reporting to 0 the warnings appear, so I assume that some script is forcing a different value for error_reporting.

I’ve found the source of the problem. It’s your bootstrap.php that is changing default PHP error reporting. Patching it like this shuts down these warnings;

--- /var/www/html/admin/bootstrap.php.original    2015-05-04 19:26:08.667967195 +0100
+++ /var/www/html/admin/bootstrap.php    2015-06-04 08:47:40.302080351 +0100
@@ -38,7 +38,7 @@
 //
 //enable error reporting and start benchmarking
 ini_set("default_charset","UTF-8");
-error_reporting(E_ALL & ~E_STRICT);
+error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT);
 date_default_timezone_set(@date_default_timezone_get());
 function microtime_float() { list($usec,$sec) = explode(' ',microtime()); return ((float)$usec+(float)$sec); }
 $benchmark_starttime = microtime_float();
@@ -81,7 +81,7 @@
 if ($bootstrap_settings['freepbx_error_handler']) {
   $error_handler = $bootstrap_settings['freepbx_error_handler'] === true ? 'freepbx_error_handler' : $bootstrap_settings['freepbx_error_handler'];
   if (function_exists($error_handler)) {
-    set_error_handler($error_handler, E_ALL & ~E_STRICT);
+    set_error_handler($error_handler, E_ALL & ~E_DEPRECATED & ~E_STRICT);
   }
 }
 

While that is true one has to wonder how:

Glad you solved it though.

After filled [FREEPBX-9405] which was not accepted, can any one reply to a question that I posted there;
Which PHP version(s) are officially supported by FreePBX 12?

@jmpg

5.3.x

The “errors” you list are actually warnings and are in a sub library we use. We are not in the job of fixing sub libraries that are no longer actively maintained or supported. Furthermore with the error handling setup in PHP.ini in our distro and others (PIAF) we don’t get these errors.

You then asked

Why not let the user select which type of messages he/she wants to see in their logs in php.ini?

We already do allow that. Go into /etc/freepbx.conf and put in this line:

 $bootstrap_settings['freepbx_error_handler'] = false;

@tm1000 Thank you for the information!

Instead of patching bootstrap.php (which will trigger a security warning) I was able to remove PHP deprecation warnings from my logs by adding to /etc/freepbx.conf:

$bootstrap_settings['freepbx_error_handler'] = false;
require_once('/var/www/html/admin/libraries/utility.functions.php');
set_error_handler('freepbx_error_handler', E_ALL & ~E_DEPRECATED & ~E_STRICT);