ID:               42098
 User updated by:  nicolas dot grekas+php at gmail dot com
 Reported By:      nicolas dot grekas+php at gmail dot com
 Status:           Open
 Bug Type:         Scripting Engine problem
 Operating System: all
 PHP Version:      5.2.3
 New Comment:

I updated my PHP, and this bug appears also with version 5.2.3


Previous Comments:
------------------------------------------------------------------------

[2007-07-25 10:35:31] nicolas dot grekas+php at gmail dot com

Description:
------------
See code sample (tested with PHP 5.2.1)

Reproduce code:
---------------
<?php

error_reporting(E_ALL | E_STRICT);
set_error_handler('reportError');

function reportError($code, $message)
{
        return errorReporter::report($code, $message);
}

function __autoload($class)
{
        class errorReporter
        {
                static function report($code, $message) { echo $message, '<br 
/>'; }
        }
}


// When uncommented, this triggers an E_NOTICE, so reportError() is
called,
// which itself calls errorReporter::report(), which triggers
__autoload(),
// which loads the errorReporter class, and everything is fine:

//unset($a);
//echo $a;


// This  triggers an E_STRICT, so things should be the same as above,
// exept that __autoload() is never called, so the errorReporter class
is never loaded,
// so we end up with an E_FATAL... BUG

eval('
class A           { function toto(  ) {} }
class B extends A { function toto($a) {} }
');

Expected result:
----------------
Declaration of B::toto() should be compatible with that of A::toto()

Actual result:
--------------
Fatal error: Class 'errorReporter' not found in [...](35) : eval()'d
code on line 3


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=42098&edit=1

Reply via email to