简体   繁体   English

关闭 PHP MDB2 通知的日志记录?

[英]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 5 升级到 7.4,Pear MBD2 package 用一堆荒谬的通知向我们的 Apache2 日志发送垃圾邮件。

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?我们的 web 应用程序运行良好,我知道这根本不是最佳实践,但我们如何关闭此通知?

Is there any way to configure or upgrade Pear/MDB2 to stop?有没有办法配置或升级 Pear/MDB2 停止?

Pear and MDB2 was installed via docker image, so I'll have to dig for the exact line where its throwing this. Pear 和 MDB2 是通过 docker 图像安装的,所以我必须挖掘它抛出这个的确切行。

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()));

To get rid of the notices, disable logging of E_NOTICE messages.要消除通知,请禁用 E_NOTICE 消息的记录。

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. .. 或通过调整error_reporting设置在php.ini配置文件中禁用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM