defined() requires class to exist when testing for class const (only in PHP_5_2)

Bug #47601 defined() requires class to exist when testing for class const (only in PHP_5_2)
Submitted: 2009-03-08 22:55 UTC Modified: 2010-02-08 12:31 UTC
From: david at grudl dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5.2CVS-2009-03-10 OS: *
Private report: No CVE-ID: None

 [2009-03-08 22:55 UTC] david at grudl dot com

Description:
------------
Function defined() is very strict whether class constant is checking. Non-declared (and not-autoloaded) class can be rather expressed as FALSE than fatal error.

Reproduce code:
---------------
var_dump( defined('Test::VALUE') );

Expected result:
----------------
FALSE

Actual result:
--------------
Fatal error: Class 'Test' not found 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports

 [2009-03-09 00:15 UTC] david at grudl dot com

It seems this bug exists only in 5.2.x branch (since 5.2.4 - 5.2.9). PHP 5.3.0beta1 which is older than 5.2.9 is not affected.

 [2010-02-08 12:31 UTC] iliaa@php.net

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.