Skip to content


Subversion checkout URL

You can clone with
Download ZIP


eAccelerator not compatible with anonymous function/closure under php 5.4.6 #12

sskaje opened this Issue · 21 comments

eAccelerator not compatible with anonymous function/closure under php 5.4.6

Error msg:
PHP Fatal error: Function name must be a string in /usr/local/nginx/html/*******.php on line 168

on that line and some lines above:

    $source_sig_func = function($_var_cookie) {
        return substr(md5("..."), 3, 8);

    $cookie_sig_matched = $cookie_source_sig == $source_sig_func($var_cookie); <= this is the line 168.

not work in PHP 5.3.3-7+squeeze14

function sort_multi_array ($array, $key){
  $keys = array();
  for ($i=1;$i<func_num_args();$i++) {
    $keys[$i-1] = func_get_arg($i);
  // create a custom search function to pass to usort
  $func = function ($a, $b) use ($keys) {
    for ($i=0;$i<count($keys);$i++) {
      if ($a[$keys[$i]] != $b[$keys[$i]]) {
        return ($a[$keys[$i]] < $b[$keys[$i]]) ? -1 : 1;
    return 0;
  usort($array, $func);
  return $array;

Same issue here, this following code prints null:

var_dump(function() { return true; });

Same problem here
FastCGI: server "/home/apache/php/managergo/php-fpm" stderr: PHP message: PHP Fatal error: Invalid opcode 153/1/8. in /home/xxxxx/www/smgo3/framework/model/DataList.php on line 205

This problem is really annoying for me. I need an urgent fix for that. May I help by some way to resolve it ?


Same problem here!

PHP 5.4.9


class test {
public static function tester() {

    $array = array();

    $array[] = array("title" => "abc");
    $array[] = array("title" => "xyz");
    $array[] = array("title" => "uvw");

    usort($array, function($a, $b) {
        return strcasecmp($a['title'], $b['title']);



Warning: usort() expects parameter 2 to be a valid callback, no array or string given

We have turned of eAccelarator on our development-machine. But this is really a blocker to put php 5.4 in production.


That is indeed a showstopper. Same in PHP 5.4.7 with


any news about this bug ?


How comes that nothing is done/writen about resolution of such a huge bug? Closures are used in all recent framework, is eAccelerator not planning to live any longer?


Having the same problem here, can't believe it's been 9 months and no answer... I hope this get resolved soon, as @NinjDS said, closures are vital in modern frameworks.


Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2 x86_64 GNU/Linux
PHP 5.4.15-1~dotdeb.1 (fpm)

same bug:

    $get_word = function () {
        return substr( str_shuffle( "abcdefghijklmnopqrstuvwxyz" ), 0, rand( 2, 12 ) );
    $get_proposal = function () use ( $get_word ) { // also try use &$get_word
        $ret = $get_word();
        $cnt = rand( 2, 20 );
        for ( $i = 0; $i < $cnt; $i++ )
            $ret .= ' '. $get_word();
        return strtoupper( $ret{ 0 } ) . substr( $ret, 1 );

    echo $get_proposal(); // raise error PHP Fatal error:  Function name must be a string in ...

error has gone away, after comment line "extension="" in config file php.ini


eaccelerator.optimizer="0" or build with --without-eaccelerator-optimizer solves the problem (after that clean filecache). I test this on PHP 5.3.27 and 5.4.19 - closures work fine, but -30% to number of "operations" per second :(


Here is the patch to solve the problem:
It is skip optimization of opcode if there are "closures".
Tested on PHP 5.3.27 and 5.4.19.


Is eAccelerator still not compatible with anonymous functions?


Try patch above. Works fine.


When will there be a patch released? (not something that we have to edit in the code ourselfs..)??


Hi guys, we have experienced this issue at where many of our users have reported this bug:

It took us a while to find that the cause was eaccelerator, and this bug created 1 year ago.

Is eaccelerator a dead project maybe? in this case, it would be super useful to write it in the readme at:

hopefully you will either fix this critical bug or announce the project as "deprecated" for all users to save time and energy!

have a good one, cheers


You can safely consider it dead and upgrade to PHP 5.5 with Zend Opcache included.


We have had to disable eaccelerator within Piwik. piwik/piwik@ab6070f

If someone from @eaccelerator is reading this, please do the right thing and edit the readme to explain to people not to use this tool. it will cause a lot of problems to many people otherwise... cheers.


To assist with marking eAccelerator as deprecated / dead / broken / do not use, here is a pull request with simple README update: #44


What about using the patch from #42 to fix this issue?


Here is someone who just sank an afternoon of time into this issue. @bartv, @hrak, @ecanuto please see pull #44 .


You are only one of thousands of people who have wasted some hours of their life with eaccelerator ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.