duanchijie2323 2017-08-16 17:15
浏览 54
已采纳

在PHP中使用'@'是开箱即用的选项吗?

Is preceding function calls with the at-sign (@) a standard out-of-the-box option or do I need to enable it in php.ini?

I am getting the following server error in the error_log file:

PHP Parse error: syntax error, unexpected '@' in /htdocs/www/phpMyAdmin/libraries/common.inc.php on line 467

Here is line 467 in the php script file: if (@extension_loaded('mbstring') && !empty(@ini_get('mbstring.func_overload'))) {

If it needs to be enabled in php.ini where might that be?

Thanks.

Amended

Here's the code block that throws the error:

/**
 * check for errors occurred while loading configuration
 * this check is done here after loading language files to present errors in locale
 */
$GLOBALS['PMA_Config']->checkPermissions();
$GLOBALS['PMA_Config']->checkErrors();

/**
 * As we try to handle charsets by ourself, mbstring overloads just
 * break it, see bug 1063821.
 *
 * We specifically use empty here as we are looking for anything else than
 * empty value or 0.
 */
if (@extension_loaded('mbstring') && !empty(@ini_get('mbstring.func_overload'))) {
    PMA_fatalError(
        __(
            'You have enabled mbstring.func_overload in your PHP '
            . 'configuration. This option is incompatible with phpMyAdmin '
            . 'and might cause some data to be corrupted!'
        )
    );
}
  • 写回答

3条回答 默认 最新

  • dryeyhe0266 2017-08-16 17:37
    关注

    From PHP: empty - Manual

    Prior to PHP 5.5, empty() only supports variables; anything else will result in a parse error. In other words, the following will not work: empty(trim($name)). Instead, use trim($name) == false.

    So the @ is not a variable and generates the error. If you remove the @ from the empty() call as:

    if (@extension_loaded('mbstring') && !empty(ini_get('mbstring.func_overload'))) {}
    

    It will still generate the following parse error:

    Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE or '$'

    PHP 5.3.3 was released 7 years ago and hasn't been supported in over 3 years. If unable to upgrade (recommended) use phpMyAdmin 4.0.10.20.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 spring后端vue前端
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题