Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the use of '@' in PHP an out-of-the-box option?

Tags:

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!'
        )
    );
}
like image 382
H. Ferrence Avatar asked Jan 19 '26 10:01

H. Ferrence


2 Answers

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.

like image 85
AbraCadaver Avatar answered Jan 21 '26 01:01

AbraCadaver


According to your version of PhpMyAdmin, you need to run PHP > 5.5.

See : https://www.phpmyadmin.net/downloads/

Current version compatible with PHP 5.5 to 7.1 and MySQL 5.5 and newer.

That's why you got an error.

like image 28
Vincent Decaux Avatar answered Jan 20 '26 23:01

Vincent Decaux



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!