Anonymous functions do not work: function name must be a string

I have:

PHP Version 5.4.20 './configure' '--disable-fileinfo' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-gd-native-ttf' '--enable-libxml' '--enable-mbstring' '--enable-pdo=shared' '--enable-soap' '--enable-sockets' '--enable-zip' '--prefix=/usr/local' '--with-apxs2=/usr/local/apache/bin/apxs' '--with-curl=/opt/curlssl/' '--with-freetype-dir=/usr' '--with-gd' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' '--with-jpeg-dir=/usr' '--with-kerberos' '--with-libdir=lib64' '--with-libxml-dir=/opt/xml2' '--with-libxml-dir=/opt/xml2/' '--with-mcrypt=/opt/libmcrypt/' '--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-openssl=/usr' '--with-openssl-dir=/usr' '--with-pcre-regex=/opt/pcre' '--with-pdo-mysql=shared' '--with-pdo-sqlite=shared' '--with-pic' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--with-zlib' '--with-zlib-dir=/usr' 

And I check this code:

 $greet = function($name) { printf("Hello %s\r\n", $name); }; $greet('PHP'); 

I get this error:

 Fatal error: Function name must be a string 

In PHP version 5.3.10-1ubuntu3.8, it works as it should. Anyone what's going on?

+7
php
source share
3 answers
+5
source share

due to eAccelerator and you have to disable it

To disable eAccelerator, make the following changes to your php.ini configuration:

 eaccelerator.enable 0 eaccelerator.optimizer 0 

or in .htaccess files

 php_flag eaccelerator.enable 0 php_flag eaccelerator.optimizer 0 
+1
source share

Btw, I noticed a problem with this server (it is a client VPN server) when I downloaded the Symfony app and I got this error

 ContextErrorException: Warning: preg_replace_callback(): Requires argument 2, '', to be a valid callback in /home/client/vendor/symfony/symfony/src/Symfony/Component/Yaml/Unescaper.php line 56 
0
source share

All Articles