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 java业务性能问题求解(sql,业务设计相关)
  • ¥15 52810 尾椎c三个a 写蓝牙地址
  • ¥15 elmos524.33 eeprom的读写问题
  • ¥15 使用Java milo连接Kepserver服务端报错?
  • ¥15 用ADS设计一款的射频功率放大器
  • ¥15 怎么求交点连线的理论解?
  • ¥20 软件开发方法学习来了
  • ¥15 微信小程序商城如何实现多商户收款 平台分润抽成
  • ¥15 HC32L176调试了一个通过TIMER5+DMA驱动WS2812B
  • ¥15 关于自相关函数法和周期图法实现对随机信号的功率谱估计的matlab程序运行的问题,请各位专家解答!