|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-03-12 17:02 UTC] 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)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 02 13:00:01 2025 UTC |
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.