php.net |  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: 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

Add a Patch

Pull Requests

Add a Pull Request

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] svn@php.net
Automatic comment from SVN on behalf of iliaa
Revision: http://svn.php.net/viewvc/?view=revision&revision=294761
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] 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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 03:01:29 2024 UTC