PHP Deprecation Warnings

Hi,

After installing FreePBX 12 in a Debian Jessie (8.0) Distro I see in freepbx.log the following warnings generated by the script ‘/var/www/html/admin/modules/dashboard/scheduler.php’ installed in the crontab to run every minute;

[2015-Jun-02 11:27:10] [PHP-DEPRECATION_WARNING] (/usr/share/php/DB/common.php:2200) - Non-static method DB::isManip() should not be called statically, assuming $this from incompatible context
[2015-Jun-02 11:27:10] [PHP-DEPRECATION_WARNING] (/usr/share/php/DB/common.php:2200) - Non-static method DB::isManip() should not be called statically, assuming $this from incompatible context
[2015-Jun-02 11:27:10] [PHP-DEPRECATION_WARNING] (/usr/share/php/DB/common.php:1217) - Non-static method DB::isError() should not be called statically, assuming $this from incompatible context
[2015-Jun-02 11:27:10] [PHP-DEPRECATION_WARNING] (/usr/share/php/DB/common.php:1292) - Non-static method DB::isError() should not be called statically, assuming $this from incompatible context
[2015-Jun-02 11:27:10] [PHP-DEPRECATION_WARNING] (/usr/share/php/DB.php:1387) - Non-static method DB::isError() should not be called statically, assuming $this from incompatible context
[2015-Jun-02 11:28:17] [PHP-DEPRECATION_WARNING] (/usr/share/php/DB/common.php:2200) - Non-static method DB::isManip() should not be called statically, assuming $this from incompatible context
[2015-Jun-02 11:28:17] [PHP-DEPRECATION_WARNING] (/usr/share/php/DB/common.php:2200) - Non-static method DB::isManip() should not be called statically, assuming $this from incompatible context
[2015-Jun-02 11:28:17] [PHP-DEPRECATION_WARNING] (/usr/share/php/DB/common.php:1217) - Non-static method DB::isError() should not be called statically, assuming $this from incompatible context
[2015-Jun-02 11:28:17] [PHP-DEPRECATION_WARNING] (/usr/share/php/DB/common.php:1292) - Non-static method DB::isError() should not be called statically, assuming $this from incompatible context
[2015-Jun-02 11:28:17] [PHP-DEPRECATION_WARNING] (/usr/share/php/DB.php:1387) - Non-static method DB::isError() should not be called statically, assuming $this from incompatible context

My PHP version is 5.6.7 and I already have in my php.ini this configuration;

error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT

that should disable that kind of warnings, so I suppose that is FreePBX that is forcing the display of DEPRECATED warnings. Can anyone tell me how can I disable these warnings?

Regards,
José Gonçalves

You can’t until freepbx 13

Apart from upgrading to FreePBX 13, there is no other workaround to disable these warnings?
My logs are growing with unnecessary information every minute.

“Pin” your PHP in the OS (Downgrade)

5.7 to 5.4 for Jessie , use oldoldstable if you need 5.3

( Sid can be “vicious” :wink: He uses PHP7 and I don’t think oldoldoldstable would work :wink: )

There is no way to fix it unless you’d like to go make the necessary changes to the PearDB library. In 13 we stopped using that library,

I’ve tried to downgrade PHP from v5.6 to version v5.4, as suggested by dicko, but encountered some unmet dependencies problems with libapache2-mod-php5, so this may be the push that I need to upgrade to FreePBX 13. Do you consider that 13 is stable enough for a production environment? Is there any roadmap as when 13 will be the new stable version?

What were those “unmet dependencies” ?

I say that because IWFM

apt-cache show libapache2-mod-php5

.
.
Depends: libbz2-1.0, libc6 (>= 2.11), libcomerr2 (>= 1.01), libdb5.1, libgssapi-krb5-2 (>= 1.6.dfsg.2), libk5crypto3 (>= 1.6.dfsg.2), libkrb5-3 (>= 1.6.dfsg.2), libonig2 (>= 5.2.0), libpcre3 (>= 8.10), libqdbm14 (>= 1.8.74), libssl1.0.0 (>= 1.0.0), libstdc++6 (>= 4.1.1), libxml2 (>= 2.8.0), zlib1g (>= 1:1.1.4), mime-support, apache2-mpm-prefork (>> 2.0.52) | apache2-mpm-itk, apache2.2-common, php5-common (= 5.4.36-0+deb7u1), libmagic1, ucf, tzdata
.
.

Not at all

No. There isnt

This is what I’ve done. I’ve added to /etc/apt/sources.list this:

deb http://ftp.rnl.tecnico.ulisboa.pt/pub/debian/ wheezy main contrib non-free

then I’ve setup /etc/apt/preferences like this;

Package: *php5
Pin: release n=wheezy
Pin-Priority: 1100

Package: php5*
Pin: release n=wheezy
Pin-Priority: 1100

Package: php-pear
Pin: release n=wheezy
Pin-Priority: 1100

and then issued;

$ sudo apt-get update
$ sudo apt-get upgrade libapache2-mod-php5 php-pear php5 php5-cli php5-common php5-curl php5-json php5-mysql php5-readline

and got;

Reading package lists… Done
Building dependency tree
Reading state information… Done
Calculating upgrade… php5-json is already the newest version.
php5-json set to manually installed.
php5-readline is already the newest version.
php5-readline set to manually installed.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
apache2.2-common : Breaks: libapache2-mod-php5 (< 5.5.0~beta4-3) but 5.4.36-0+deb7u1 is to be installed
dpkg : Breaks: libapache2-mod-php5 (< 5.6.4+dfsg-3~) but 5.4.36-0+deb7u1 is to be installed
php5-common : Conflicts: php5-json
php5-json : Depends: phpapi-20131226
Breaks: php5-common (< 5.5.0~rc1+dfsg-1~) but 5.4.36-0+deb7u1 is to be installed
php5-readline : Depends: phpapi-20131226
Depends: php5-common (= 5.6.7+dfsg-1) but 5.4.36-0+deb7u1 is to be installed
Depends: php5-cli (= 5.6.7+dfsg-1) but 5.4.36-0+deb7u1 is to be installed
E: Broken packages

If you have already done this downgrade can you tell me what I’m doing wrong?

Had you read the link I posted you would have seen that you need to pin

Package: libapache2-mod-php5

also, actually you need to pin all of

dpkg -l|grep php|grep 5.6|awk ‘{print $2}’

They are all pined with the wildcards that I’ve set “Package: *php5” and “Package: php5*”.

BTW, dpkg -l|grep php|grep 5.6|awk ‘{print $2}’, returns on my system;

libapache2-mod-php5
php-pear
php5
php5-cli
php5-common
php5-curl
php5-mysql
php5-readline

If you read your depends, your pins don’t cover

You could possibly dpkg -r them all before you install them in case there are some re-entrant dependencies.

@dicko you are leading this user on a wild goose chase. This will still generate the same depreciated warning in PHP 5.4. In fact the message goes all the way down as low as PHP 5.2.

@tm1000 I have another box with FreePBX distro installed and I don’t see the warnings that I see in Debian Jessie. As you use PHP 5.3 in FreePBX distro I assume that at least in PHP 5.3 these warnings disappear.

@tm1000

perhaps so, I don’t have that problem on Jessie but if you say I do . . . .

How about the OP could perhaps add

2>/dev/null

at the end of any noisy cron job, IWFM when needed.

That is how you have setup php.ini

These errors come from PearDB. You can see the bug here: http://pear.php.net/bugs/bug.php?id=18254

Which basically started at around 5.2.

You need to disable strict errors in php.ini. FreePBX does not enable these be default until 13. In 12 and lower the system would be enabling these, through php.ini or other means

@dicko I tried everything that I could think of and still are unable to install libapache2-mod-php5 from wheezy in my jessie distro. I was able to install PHP 5.4 from wheezy and can use it from the command line but I’m unable to execute PHP code via Apache due to the lack of libapache2-mod-php5.

I’m sorry @jmpg , I didn’t have that problem, but as is pointed out it is all unnecessary either ignore the clutter or as I suggested redirect it to the bit bucket.

In my case I needed php 5.4 for other software (Avantfax) and never had those errors spat at me (asterisk 11 FreePBX 12 Jessie from apt-get dist-upgrade what was originally I can’t remember :slight_smile: gotta love Debian for that) .

Looking to http://pear.php.net/bugs/bug.php?id=18254 I’ve found a way to shut up these warnings through the following patch to PEAR:

--- /usr/share/php/DB.php.original	2015-06-03 12:43:01.680808885 +0100
+++ /usr/share/php/DB.php	2015-06-03 15:56:28.194226505 +0100
@@ -589,7 +589,7 @@
      *
      * @return bool  whether $value is DB_Error object
      */
-    function isError($value)
+    static function isError($value)
     {
         return is_object($value) && is_a($value, 'DB_Error');		
     }
@@ -625,7 +625,7 @@
      *
      * @return boolean  whether $query is a data manipulation query
      */
-    function isManip($query)
+    static function isManip($query)
     {
         $manips = 'INSERT|UPDATE|DELETE|REPLACE|'
                 . 'CREATE|DROP|'

now I only need to find a way to shut up the following warning that appears in freepbx_debug:

2015-Jun-03 16:31:01 /usr/share/php/DB/mysql.php:240
[DEPRECATION_WARNING]: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead

Simply turn off strict error reporting. You have it enabled in you php.ini file. This is why you dont see these errors in the FreePBX Distro