Hey Dmitri,
I just experienced the same problem with the "self::" thing (no class scope) with DBG 3.2.12. Reading this post (and having a lot of watches) I tried to remove them one by one and test every time until I found the one that caused the problem.
Consequently, I spent about 4 hours scaling down my framework to find out what exactly causes the problem and I'm glad to tell you that I did it
You need to fullfill a number of prerequisites to trigger the error:
- You need an __autoload function and it HAS to be in an included file, not in the file that is initially called.
- You need to have a watch that points to a static variable in a non-existing class (it needs the :: scope). I used "Error::$gnError" for my tests.
- You need to break in the static class function that will execute the "self::" call.
- The autoload function has to require/require_once() a file and fail (include() doesn't work) .
Given all that, reproducing the problem is fairly simple:
test.php:
<?php
include ( 'test2.inc.php' );
Test::Test1 ( );
?> |
test2.inc.php:
<?php
function __autoload ( $sClass )
{
require ( 'thisisanonexistingfile.php' );
}
class Test
{
static function Test1 ( ) { self::Test2 ( ); } * breakpoint here
static function Test2 ( ) { }
}
?> |
Make sure the breakpoint is set where indicated (DebugBreak works as well, as long as it's IN the function).
Simply run test.php.
I assume the reason it crashes is pretty simple. The __autoload function is called because of the watch and it causes a require statement to fail. Normally when a require fails it terminates PHP.
Because it is the debugger causing this failure, attempting to show information in the watch window (and thus wouldn't fail under normal circumstances) execution continues, but internally PHP probably did some cleanup stuff already etc... causing the scope error later on.
Hope that helps!
Edit:
I'm using PHP 5.2.4 on a 3rd party Apache/2.0.59 (Win32) server with DBG v3.2.12. For your viewing pleasure I have made my phpinfo() available
here