ID: 47638
Comment by: ian at onlineloop dot com
Reported By: luke at cywh dot com
Status: Open
Bug Type: Scripting Engine problem
Operating System: Linux, Mac OS X
PHP Version: 5.2.9
New Comment:
I have a similar problem in PHP 5.2.8 and 5.2.9 which may be related
to this one.
Fatal error: Non-static method Encrypt::encrypt() cannot be called
statically, assuming $this from incompatible context
in
/usr/local/htdocs/squirrelmail-1.4.4/out_of_office/lib/SmartSieve.lib
on line 269
The line of code is
$this->passwd = Encrypt::encrypt($this->getFormValue('passwd'),$key);
This error happens every time, despite all three versions of PHP
being compiled with the same compiler and flags.
The code however works fine in PHP 5.2.6.
Previous Comments:
------------------------------------------------------------------------
[2009-03-19 00:34:23] luke at cywh dot com
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.
------------------------------------------------------------------------
[2009-03-15 12:22:57] [email protected]
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] [email protected]
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