#38555 [Opn->Bgs]: PHP treats undefined constants differently to variables
ID: 38555
Updated by: tony2001@php.net
Reported By: php at seven dot net dot nz
-Status: Open
+Status: Bogus
Bug Type: Feature/Change Request
Operating System: Irrelevant
PHP Version: 5.1.5
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Previous Comments:
------------------------------------------------------------------------
[2006-08-23 02:21:24] php at seven dot net dot nz
Description:
------------
PHP evaluates an undefined constant as true, whereas it evaluates an
undefined variable as false.
Reproduce code:
---------------
<?= TEST ? '1' : '0' ?><br />
<?= $test ? '1' : '0' ?><br />
Expected result:
----------------
Notice: Use of undefined constant TEST - assumed 'TEST' in test.php on
line 1
0
Notice: Undefined variable: test in test.php on line 2
0
Actual result:
--------------
Notice: Use of undefined constant TEST - assumed 'TEST' in test.php on
line 1
1
Notice: Undefined variable: test in test.php on line 2
0
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38555&edit=1
Thread (3 messages)