From: luke at cywh dot com Operating system: Linux, Mac OS X PHP version: 5.2.9 PHP Bug Type: *Compile Issues Bug description: Random fatal error while using callback through array_udiff_assoc
Description: ------------ When making a callback through array_udiff_assoc to a static function this fatal error is produced, but randomly: Fatal error: Non-static method (null)::(null)() cannot be called statically in /opt/local/apache2/htdocs/site/cc.php on line 12 This error only occurs about 1/3 of the time or less, and usually seems to happen right after saving a file. At first I thought it was an eAccelerator issue as I could product this error almost every time after re-saving the file (with or without changes), but I was also able to reproduce this on my MacBook which I had installed the 5.2 branch on without any cache engines. On a stock PHP installation with no extras it is mighty difficult to reproduce this error. I was able to make it occur several times if I refreshed the page 5-20 times after saving. In the callback I'm referencing the function as a string: "XC::greaterthan". I *think* using array('XC', 'greaterthan') corrects the problem, but I am unsure as this error seems to occur completely at random, and I have yet to have a 100% solid way of reproducing it. The code below is the best way I was able to reproduce the occurrence. Reproduce code: --------------- class XC { static public function greaterthan($value1, $value2) { return $value1 > $value2; } } class test { function tester($num1, $num2) { var_dump(array_intersect( array_keys( array_udiff_assoc(array('if' => $num1), array('if' => $num2), 'XC::greaterthan') ), array('if') )); } } $t = new test(); for($i=0; $i<10; $i++) { $num1 = mt_rand(1, 100); $num2 = mt_rand(1, 100); $t->tester($num1, $num2); } Expected result: ---------------- No fatal error, just var dumps. Actual result: -------------- Fatal error: Non-static method (null)::(null)() cannot be called statically in /opt/local/apache2/htdocs/site/cc.php on line 12 (Which points to the array_udiff_assoc function) -- Edit bug report at http://bugs.php.net/?id=47638&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47638&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47638&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47638&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=47638&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47638&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=47638&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=47638&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=47638&r=needscript Try newer version: http://bugs.php.net/fix.php?id=47638&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=47638&r=support Expected behavior: http://bugs.php.net/fix.php?id=47638&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=47638&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=47638&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=47638&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47638&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=47638&r=dst IIS Stability: http://bugs.php.net/fix.php?id=47638&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=47638&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=47638&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=47638&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=47638&r=mysqlcfg