|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
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:
 [2009-03-08 22:55 UTC] david at grudl dot com
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:

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


Add a Patch

Pull Requests

Add a Pull Request


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]
Automatic comment from SVN on behalf of iliaa
Log: Fixed bug #47601 (defined() requires class to exist when testing for class constants).

# Unifies behaviour with 5.3+
 [2010-02-08 12:31 UTC]
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
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Tue Oct 06 20:01:32 2015 UTC