ID: 47638 User updated by: luke at cywh dot com Reported By: luke at cywh dot com -Status: Feedback +Status: Open Bug Type: Scripting Engine problem Operating System: Linux, Mac OS X PHP Version: 5.2.9 New Comment:
I'm having problems with my MacBook, so I can't get that working on that (I had installed a seperate install of Apache 2 and PHP separate from the OS, and I get an error regarding libpng with the php5 module, which is preventing me from stoping/starting the service). I was, however, able to produce the same exact error on my development machine, but this time I had used array('XC', 'greaterthan') instead of 'XC::greaterthan'. This is a live server with a bunch of websites (cpanel install). Is there anyway to do this without interring with the rest of the server? Perhaps start the apache instance on a different port? Seems to always happen randomly... has happened twice today during development. Previous Comments: ------------------------------------------------------------------------ [2009-03-15 12:22:57] j...@php.net Run single Apache child in gdb, then you can backtrace and dump variables once this happens. Or run the same in CLI. And I hope you're NOT using some threaded MPM with Apache? (I'm guessing you're using Apache2 of course since you didn't bother telling that either..) ------------------------------------------------------------------------ [2009-03-13 14:10:28] luke at cywh dot com Is there any way to log what happens when I reproduce it? It's really difficult to get it to occur. ------------------------------------------------------------------------ [2009-03-13 01:03:50] fel...@php.net I can't reproduce it. ------------------------------------------------------------------------ [2009-03-12 17:02:10] luke at cywh dot com 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 this bug report at http://bugs.php.net/?id=47638&edit=1