Edit report at http://bugs.php.net/bug.php?id=47948&edit=1

 ID:               47948
 Updated by:       fel...@php.net
 Reported by:      ehassler at synapsestudios dot com
 Summary:          call_user_func_array() with autoload causes crash
-Status:           No Feedback
+Status:           Feedback
 Type:             Bug
 Package:          Reproducible crash
 Operating System: *
 PHP Version:      5.2.9

 New Comment:

Please try using this snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/




Previous Comments:
------------------------------------------------------------------------
[2010-02-12 15:31:34] janssens dot cyril at gmail dot com

Same problem on Debian 5 32bit + php 5.2.6 when using recursive
call_user_func_array function.



The workaround is to use eval statement:



$object = 'foo';

$method = 'bar';

$args = array();//some arguments

$i=0;

$strArg='';

foreach ($args as $arg){

        $varname = 'arg'.$i;

        $$varname = $arg;

        $strArg .= '$'.$varname.',';

        $i++;

}

$strArg = substr($strArg,0,-1);

$cmd = '$_return = '.$object.'::'.$method.'('.$strArg.');';

eval($cmd);



//Enjoy :-)

return $_return;









Regards,



Cyril

------------------------------------------------------------------------
[2010-01-11 01:00:00] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------
[2010-01-08 16:27:47] muqker at muqker dot com

I didn't know about Edit Submission. However, I did not open this bug, 

I just had the same problem and tried to provide a script to 

reproduce. Should I use that anyway?



Yes, the crash is there. I am getting:



[Fri Jan 08 17:55:49 2010] [notice] child pid 3534 exit signal 

Segmentation fault (11)



in apache2's error log and the browser reports that it receives "Error 

324 (net::ERR_EMPTY_RESPONSE): Unknown error."



php -n index.php ends with "Segmentation Fault".



If I include explicitly the class that otherwise autoload tries to 

load, or if I do not use call_user_func_array, but a normal call, then 

the crash is gone.



Some system info:

PHP Version 5.2.6-3ubuntu4.2

Apache Version  Apache/2.2.11 (Ubuntu) DAV/2 SVN/1.5.4 PHP/5.2.6-

3ubuntu4.2 with Suhosin-Patch

Apache API Version      20051115

Loaded Modules  core mod_log_config mod_logio prefork http_core mod_so 

mod_alias mod_auth_basic mod_authn_file mod_authz_default 

mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex 

mod_cgi mod_dav mod_dav_fs mod_dav_svn mod_authz_svn mod_deflate 

mod_dir mod_env mod_mime mod_negotiation mod_php5 mod_rewrite 

mod_setenvif mod_status

Linux dufus 2.6.28-16-generic #55-Ubuntu SMP Tue Oct 20 19:48:24 UTC 

2009 i686

GNU C Library stable release version 2.9, by Roland McGrath et al.



Let me know if I can provide any other info.

------------------------------------------------------------------------
[2010-01-03 20:54:56] johan...@php.net

When editing you have to use the "Edit Submission" tab to re-open it.



Are you sure the script you provided is correct - it works for me, as
far as I can tell, on 5.2 and 5.3 while there is a warning for a missing
parameter:



$ php -n index.php 

<pre>array(7) {

  [0]=>

  array(7) {

    ["file"]=>

    string(47) "/tmp/test47948/muqker/index.php"

    ["line"]=>

    int(41)

    ["function"]=>

    string(1) "f"

    ["class"]=>

    string(1) "A"

    ["object"]=>

    object(A)#2 (0) {

    }

    ["type"]=>

    string(2) "->"

    ["args"]=>

    array(0) {

    }

  }

  [1]=>

  array(7) {

    ["file"]=>

    string(47) "/tmp/test47948/muqker/index.php"

    ["line"]=>

    int(45)

    ["function"]=>

    string(1) "g"

    ["class"]=>

    string(1) "A"

    ["object"]=>

    object(A)#2 (0) {

    }

    ["type"]=>

    string(2) "->"

    ["args"]=>

    array(0) {

    }

  }

  [2]=>

  array(7) {

    ["file"]=>

    string(47) "/tmp/test47948/muqker/index.php"

    ["line"]=>

    int(15)

    ["function"]=>

    string(1) "h"

    ["class"]=>

    string(1) "A"

    ["object"]=>

    object(A)#2 (0) {

    }

    ["type"]=>

    string(2) "->"

    ["args"]=>

    array(0) {

    }

  }

  [3]=>

  array(7) {

    ["file"]=>

    string(47) "/tmp/test47948/muqker/index.php"

    ["line"]=>

    int(19)

    ["function"]=>

    string(2) "zz"

    ["class"]=>

    string(10) "Controller"

    ["object"]=>

    object(Controller)#1 (0) {

    }

    ["type"]=>

    string(2) "->"

    ["args"]=>

    array(0) {

    }

  }

  [4]=>

  array(7) {

    ["file"]=>

    string(47) "/tmp/test47948/muqker/index.php"

    ["line"]=>

    int(23)

    ["function"]=>

    string(10) "executeNew"

    ["class"]=>

    string(10) "Controller"

    ["object"]=>

    object(Controller)#1 (0) {

    }

    ["type"]=>

    string(2) "->"

    ["args"]=>

    array(1) {

      [0]=>

      &NULL

    }

  }

  [5]=>

  array(7) {

    ["file"]=>

    string(47) "/tmp/test47948/muqker/index.php"

    ["line"]=>

    int(59)

    ["function"]=>

    string(13) "executeClient"

    ["class"]=>

    string(10) "Controller"

    ["object"]=>

    object(Controller)#1 (0) {

    }

    ["type"]=>

    string(2) "->"

    ["args"]=>

    array(1) {

      [0]=>

      &NULL

    }

  }

  [6]=>

  array(4) {

    ["file"]=>

    string(47) "/tmp/test47948/muqker/index.php"

    ["line"]=>

    int(62)

    ["function"]=>

    string(4) "main"

    ["args"]=>

    array(0) {

    }

  }

}



Warning: Missing argument 2 for
CheckedFacilityPeer::getCheckedFacilities() in
/tmp/test47948/muqker/CheckedFacilityPeer.php on line 42

ff



------------------------------------------------------------------------
[2010-01-03 17:09:52] muqker at muqker dot com

I see the status has changed to "No Feedback". Is the script I provided


to reproduce not ok? I am sorry but I do not have a test environment 

where I can try your snapshot.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    http://bugs.php.net/bug.php?id=47948


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=47948&edit=1

Reply via email to