php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5217 define() returns TRUE when trying to redefine default constants
Submitted: 2000-06-24 13:28 UTC Modified: 2000-08-06 18:45 UTC
From: akul at otamedia dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.0 Release OS: Linux 2.2.13
Private report: No CVE-ID: None
 [2000-06-24 13:28 UTC] akul at otamedia dot com
Try this:

<HTML><BODY>
<?
if(!define("True",-1))
      echo '<BR>True is not defined!';
if(!define("False",0))
      echo '<BR>False is not defined!';

    echo '<BR> True=[' . True . ']';
    echo '<BR>False=[' . False . ']';
?>
</BODY></HTML>

My output:

<HTML><BODY>
<BR> True=[1]<BR>False=[]
</BODY></HTML>

Configure Command './configure' '--with-apache=/usr/src/apache_1.3.9'
php.ini:
Safe_mode  = On and Off the same
error_reporting =       E_ALL
display_errors  =       On
variables_order =       "GPCES"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-26 01:44 UTC] waldschrott@php.net
Getting the same result, but I?m not sure whether this is allowed, checking out... 
 [2000-07-26 11:15 UTC] waldschrott@php.net
overriding TRUE and FALSE is definitively not allowed, if you?re not providing a very very important reason to allow this
 [2000-07-26 11:45 UTC] waldschrott@php.net
sure, it shouldn?t return TRUE if defining fails,
to check whether a constant has been defined try out defined()
...
 [2000-08-06 18:45 UTC] stas@php.net
fixed in CVS
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Oct 10 06:00:01 2026 UTC