Powermaster Prime
Powermaster Prime

Reputation: 523

Turn off logging of PHP MDB2 notices?

We recently upgraded from PHP 5 to 7.4, and out Pear MBD2 package is spamming our Apache2 log with a bunch of ridiculous notices.

PHP Notice:  A non well formed numeric value encountered in /usr/share/php/MDB2/Driver/mysqli.php on line 1154, referer:

Our web apps are working fine, and I know its not best practice at all, but how do we shut this notice up?

Is there any way to configure or upgrade Pear/MDB2 to stop?

Pear and MDB2 was installed via docker image, so I'll have to dig for the exact line where its throwing this.

Any help or wisdom would be appreciated.

This is the line it's throwing an issue over:

 $statement_name = sprintf($this->options['statement_format'], $this->phptype, $prep_statement_counter++ . sha1(microtime() + mt_rand()));

Upvotes: 0

Views: 101

Answers (1)

cweiske
cweiske

Reputation: 31137

To get rid of the notices, disable logging of E_NOTICE messages.

At the beginning of your code, add

error_reporting(error_reporting() & ~E_NOTICE);

.. or disable it in the php.ini configuration file by adjusting the error_reporting setting.

Upvotes: 1

Related Questions