@ 2016-05-06T14:44:47Z <?php
error_reporting(E_ALL | E_STRICT);
// Custom error handler.
function handle_error($code, $message, $file, $line, $context) {
$code = $code & error_reporting();
if ($code == 0) { // skip @ suppressed errors.
return;
}
$errors = array(
E_ERROR => 'E_ERROR',
E_WARNING => 'E_WARNING',
E_PARSE => 'E_PARSE',
E_NOTICE => 'E_NOTICE',
E_CORE_ERROR => 'E_CORE_ERROR',
E_CORE_WARNING => 'E_CORE_WARNING',
E_COMPILE_ERROR => 'E_COMPILE_ERROR',
E_COMPILE_WARNING => 'E_COMPILE_WARNING',
E_USER_ERROR => 'E_USER_ERROR',
E_USER_WARNING => 'E_USER_WARNING',
E_USER_NOTICE => 'E_USER_NOTICE',
E_STRICT => 'E_STRICT',
E_DEPRECATED => 'E_DEPRECATED',
);
if (array_key_exists($code, $errors)) {
$errname = $errors[$code];
}
else {
$errname = $code;
}
$error = "Error handler caught $errname with message \"" . $message . '" at ' . $file . ' line ' . $line . ".\n";
error_log($error);
eval(<<<'PHP'
function bla() {
print "You should see this.\n";
}
PHP
);
bla($error);
return;
}
set_error_handler('handle_error');
// This fails because bla.php can't be required in error handler:
eval(<<<'PHP'
namespace MyNamespace {
abstract class AbstractFoo {
abstract public static function foo(); // PHP 5.3 issues an E_STRICT here about abstract + static, even though it now supports static inheritance.
}
}
PHP
);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.4.1 - 8.4.12 Deprecated: Constant E_STRICT is deprecated in /in/TjXg7 on line 2
Output for 7.0.0 - 7.0.20 , 7.1.0 - 7.1.20 , 7.2.0 - 7.2.33 , 7.3.16 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.33 , 8.2.0 - 8.2.29 , 8.3.0 - 8.3.25 Output for 5.5.5 - 5.5.35 , 5.6.0 - 5.6.21 Fatal error: Call to undefined function bla() in /in/TjXg7 on line 39
Error handler caught E_STRICT with message "Static function MyNamespace\AbstractFoo::foo() should not be abstract" at /in/TjXg7(52) : eval()'d code line 3.
Process exited with code 255 . Output for 5.5.0 - 5.5.4 Fatal error: Call to undefined function bla() in /in/TjXg7(52) : eval()'d code on line 3
Error handler caught E_STRICT with message "Static function MyNamespace\AbstractFoo::foo() should not be abstract" at /in/TjXg7(52) : eval()'d code line 3.
Process exited with code 255 . preferences:dark mode live preview ace vim emacs key bindings
147.35 ms | 410 KiB | 5 Q