ID: 46341
Updated by: [EMAIL PROTECTED]
Reported By: PrzemekG_ at poczta dot onet dot pl
-Status: Open
+Status: Assigned
Bug Type: Reproducible crash
Operating System: GNU/Debian
PHP Version: 5.2.6
-Assigned To:
+Assigned To: iliaa
Previous Comments:
------------------------------------------------------------------------
[2008-10-19 13:59:57] PrzemekG_ at poczta dot onet dot pl
Description:
------------
People use defined() to check if a constant is defined so they can
later use constant() without any warning or error.
I found these bugs:
1. defined() doesn't forward exceptions
2. defined() try to load class from an invalid constant name
(false:::::)
3. produce invalid error line white raising an error if autoloader
thrown an exception.
There should be a $autoload param like in class_exists() and
interface_exists().
Reproduce code:
---------------
<?
function autoloader($class) {
throw new Exception(); // line 3
}
spl_autoload_register('autoloader');
function foo() {
defined('false:::::::'); // line 9
$a = 10;
$b = 11;
} // line 12
foo(); // line 14
?>
Expected result:
----------------
>From PHP 5.1.2:
Fatal error: Uncaught exception 'Exception' in /root/x.php:3
Stack trace:
#0 [internal function]: autoloader('false')
#1 [internal function]: spl_autoload_call('false')
#2 /root/x.php(9): defined('false:::::::')
#3 /root/x.php(14): foo()
#4 {main}
thrown in /root/x.php on line 3
Actual result:
--------------
>From PHP 5.2.6:
Fatal error: Class 'false' not found in
/root/workspace.appserv/XAS/bugTest.php on line 12
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46341&edit=1