dav*_*ann 3 php error-handling
I have a plugin in my forum which throws a warning.
I want to fix the problem, but firstly, I want to hide the warning message to the users.
I know I can change it globally, but I just want to do it for some lines.
How can I do this?
$bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
Run Code Online (Sandbox Code Playgroud)
gives the error:
Warnung: Assigning the return value of new by reference is deprecated in ..../includes/garage_func_var.php (Zeile 6411)
Run Code Online (Sandbox Code Playgroud)
I already know I need to use @ but where do I put this?
@可用于禁止显示警告,注意和错误。
致命错误在PHP 7中显示,这会破坏脚本。
@可以在变量,函数,包括调用,常量等之前使用,但不能在函数或类定义,条件,循环等之前使用。
因此,例如,隐藏一个未定义的属性错误:
Class Cars{
}
$obj = new Cars();
echo @$obj->idontexist;
Run Code Online (Sandbox Code Playgroud)
关于您的具体问题:
@$bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
Run Code Online (Sandbox Code Playgroud)
应该修复它。
虽然在PHP 5中显示了上述已弃用的警告消息,但由于在升级中已弃用了以下内容,因此将在PHP 7中显示以下内容。
PHP 7注意:
解析错误:语法错误,意外的“新”(T_NEW)