Derick Rethans wrote:
> E_STRICT can not be handled you say, can you give a small example scriptOn Fri, 28 May 2004, Bert Slagter wrote:
on that?
regards, Derick
Of course :)
-----------
<?php
Foo::bar();
$Foo->foo = 0;
class Foo
{ var $baz;
function bar()
{
}
}class Foo2 extends Foo
{ function bar($param1)
{
}
}
?>
-----------This piece of sh.. erm code produces 4 E_STRICT errors:
-----------
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in test2.php on line 6
Strict Standards: Declaration of Foo2::bar() should be compatible with that of Foo::bar() in test2.php on line 16
Strict Standards: Non-static method Foo::bar() should not be called statically in test2.php on line 2
Strict Standards: Creating default object from empty value in test2.php on line 3
-----------
Now I add a custom errorhandler:
----------- <?php
function myErrorHandler($errno, $errstr, $errfile, $errline)
{ print "<p>We've got a $errno on line $errline in $errfile!</p>";
}
set_error_handler('myErrorHandler');
error_reporting(0);Foo::bar();
$Foo->foo = 0;
class Foo
{ var $baz;
function bar()
{
}
}class Foo2 extends Foo
{ function bar($param1)
{
}
}
?>
-----------The output now is:
-----------
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in test2.php on line 14
Strict Standards: Declaration of Foo2::bar() should be compatible with that of Foo::bar() in test2.php on line 24
-----------
As you can see, two of the E_STRICT errors are still being displayed (this is logical, because they're cast on parse/compile time instead of runtime). The other two though, are not displayed but not passed to my handler either!!
If I generate a notice (for example add $bar[a] = 0;) I instantly get an E_NOTICE in my own error handler for the undefined constant:
----------- We've got a 8 on line 13 in test2.php! -----------
So.. Why are the E_STRICTs not passed to my error handler?
Bert
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
