ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-dev
php-dev
#44827 [NEW]: define('::') can be defined
by Kalle@Php.Net other posts by this author
Apr 25 2008 3:01AM messages near this date
#44828 [Opn->Fbk]: mssql_connect returns NULL | #44827 [Asn]: define('::') can be defined
From:             kalle@[...].net
Operating system: Windows Vista
PHP version:      5.2.5
PHP Bug Type:     Scripting Engine problem
Bug description:  define('::') can be defined

Description:
------------
PHP (5.2.5) allows you to define '::' as a constant without issuing an
E_WARNING, below examples will demonstrate it.

The constant() function will issue an fatal error when recieving '::' as
constant name:
Fatal error: Class '' not found in C:\webserver\www\gd\gd.php on line 91

Which might also be wrong or confusing to the programmer

Reproduce code:
---------------
<?php
	define('::', true);
	var_dump(constant('::'));
?> 

Expected result:
----------------
A fatal error for each of the calls:

Fatal error: Invalid constant name in test.php on line 2

Fatal error: Invalid constant name in test.php on line 3

Actual result:
--------------
Fatal error: Class '' not found in C:\webserver\www\gd\gd.php on line 91

None warning or fatal error for define()...

-- 
Edit bug report at http://bugs.php.net/?id=44827&edit=1
-- 
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44827&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44827&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44827&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=44827&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=44827&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=44827&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=44827&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=44827&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=44827&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=44827&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=44827&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=44827&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=44827&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=44827&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=44827&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=44827&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=44827&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=44827&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=44827&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=44827&r=mysqlcfg
Thread:
Kalle@Php.Net
cellog
felipe
jani
kalle

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved