繁体   English   中英

如何解决此错误-已弃用的功能?

[英]How do I fix this error - Deprecated function?

我的托管服务提供商最近升级了我们的php版本,现在出现此错误:

Deprecated function: Assigning the return value of new by reference is deprecated in drupal_load() (line 1105 of /mysite/includes/bootstrap.inc).

我的drupal是最新的。 我还没有修改bootstrap.inc。

这是drupal_load函数:

function drupal_load($type, $name) {
  // Once a file is included this can't be reversed during a request so do not
  // use drupal_static() here.
  static $files = array();

  if (isset($files[$type][$name])) {
    return TRUE;
  }

  $filename = drupal_get_filename($type, $name);

  if ($filename) {
    include_once DRUPAL_ROOT . '/' . $filename;
    $files[$type][$name] = TRUE;

    return TRUE;
  }

  return FALSE;
}

我将通过以下方式解决此问题:

在netbeans中打开项目,转到项目(在左侧),右键单击项目->查找

并输入&new

netbeans将遍历所有文件和find关键字,而不只是删除&之前的new,它将解决不建议使用的问题。

您可以使用的另一种方法是使用

ini_set('display_errors',0);
error_reporting(0);

它将禁用错误报告。 我不推荐它。

暂无
暂无

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

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