更新到PHP7.2.0后,wordpress插件post-my-contact-form-7中出现警告

更新到PHP7.2.0后,wordpress插件post-my-contact-form-7中出现警告,php,wordpress,Php,Wordpress,我正在做一个wordpress项目,工作很好 当我更新PHP 7.2.0版时,我收到如下警告: 警告:使用未定义常量WP_GURUS_DEBUG-假定 “WP_GURUS_DEBUG”(这将在PHP的未来版本中引发错误) 在里面 C:\wamp\www\wordpress1\wp content\plugins\post-my-contact-form-7\includes\wordpress-gurus-debug-api.php 第9行 我的wordpress版本是4.9.1 我的插件: 张

我正在做一个wordpress项目,工作很好

当我更新PHP 7.2.0版时,我收到如下警告:

警告:使用未定义常量WP_GURUS_DEBUG-假定 “WP_GURUS_DEBUG”(这将在PHP的未来版本中引发错误) 在里面 C:\wamp\www\wordpress1\wp content\plugins\post-my-contact-form-7\includes\wordpress-gurus-debug-api.php 第9行

我的wordpress版本是4.9.1

我的插件:

张贴我的CF7表格 版本3.2.0

以下是插件文件:

<?php
/**
* Error logging and notices
* @since 1.0.0
* @var string $message to log if in debug mode
*/

if( !function_exists('debug_msg') ){
  if (true === WP_DEBUG || true === WP_GURUS_DEBUG) {
     $debug_msg_last_line='';
     $debug_msg_last_file='';
   }
  function debug_msg($message,$prefix='') {
      if (true === WP_DEBUG || true === WP_GURUS_DEBUG) {
        global $debug_msg_last_line,$debug_msg_last_file;
          $backtrace = debug_backtrace();
          $file = $backtrace[0]['file'];
          $files = explode('/',$file);
          $dirs = explode('/',plugin_dir_path( __FILE__ ));
          $files = array_diff($files,$dirs);
          $file = implode('/',$files);
          $line = $backtrace[0]['line'];
          if($file != $debug_msg_last_file && $line != $debug_msg_last_line){
            error_log("DEBUG_MSG: [".$line."]./".$file);
            $debug_msg_last_file=$file;
            $debug_msg_last_line=$line;
          }else{
            //error_log("CF7_2_POST: ");
          }
          if (is_array($message) || is_object($message)) {
              error_log("          + ".$prefix.print_r($message, true));
          } else {
              error_log("          + ".$prefix.$message);
          }
      }
  }
} ?>


如何解决此警告?

编辑:我通知了插件维护人员,现在只需更新插件即可解决此问题

奥罗维拉塔·维内特写道:

哎呀,我的错!已在v3.2.1中修复

帖子链接:


WP\u DEBUG
已经存在(默认情况下为
false
),但是
WP\u GURUS\u DEBUG
显然不是由插件默认定义的。在未来的PHP版本中,尝试使用未定义的常量将被视为一个错误,但作为提示,他们将其显示为警告,以给开发人员更新代码的机会

插件维护人员需要更新代码行

if(true==WP\u DEBUG | | true==WP\u GURUS\u DEBUG){

要检查常量是否与以下内容相同:


if((已定义('WP_DEBUG')和true==WP_DEBUG)| |(已定义('WP_GURUS_DEBUG')和true==WP_GURUS_DEBUG)){

是的,这是一个bug好的,现在已在v3.2.1中修复!