#44827 [Asn->Csd]: define('::') can be defined
| From: | iliaa@php.net | Date: | Wed, 30 Dec 2009 19:15:21 +0000 |
| Subject: | #44827 [Asn->Csd]: define('::') can be defined | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-146214@lists.php.net to get a copy of this message | ||
ID: 44827
Updated by: iliaa@php.net
Reported By: kalle@php.net
-Status: Assigned
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: *
PHP Version: 5.*, 6CVS (2009-05-05)
Assigned To: iliaa
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2009-12-30 19:15:12] svn@php.net
Automatic comment from SVN on behalf of iliaa
Revision: http://svn.php.net/viewvc/?view=revision&revision=292823
Log: Fixed bug #44827 (define() allows :: in constant names).
------------------------------------------------------------------------
[2009-06-29 15:25:39] vrana@php.net
Code in ZendEngine2/zend_builtin_functions.c revision
1.277.2.12.2.25.2.52 checks if the class exists and creates the global
constant with the name A::B if it does. But this constant is unreachable
other than by get_defined_constants() because both constant("A::B") and
A::B works with class constants.
<?php
class A {}
define("A::B", true);
echo constant("A::B"); // Fatal error: Undefined class constant 'B'
echo A::B; // Fatal error: Undefined class constant 'B'
?>
I suggest to issue an error if the constant name contains "::"
regardless the class exists or not. The code would be even simpler.
------------------------------------------------------------------------
[2009-06-08 13:10:06] tony2001@php.net
Reopened.
Patches for HEAD and 5_2 broke the build and have been reverted.
------------------------------------------------------------------------
[2009-06-08 01:27:17] iliaa@php.net
This bug has been fixed in CVS.
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.
------------------------------------------------------------------------
[2008-10-25 21:18:41] cellog@php.net
now that namespace separator will be \, the fix is simple: grep for
"::" and fail if a user tries to do it.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/44827
--
Edit this bug report at http://bugs.php.net/?id=44827&edit=1