#50331 [Opn]: undefined constant is consider to be string

From: Date: Mon, 30 Nov 2009 10:38:45 +0000
Subject: #50331 [Opn]: undefined constant is consider to be string
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-145204@lists.php.net to get a copy of this message
ID: 50331 Updated by: derick@php.net Reported By: wdolek at gmail dot com Status: Open Bug Type: Feature/Change Request Operating System: GNU/Linux PHP Version: 5.2.11 New Comment: I wouldn't mind kicking this out in PHP 6 either... Previous Comments: ------------------------------------------------------------------------ [2009-11-30 10:28:09] wdolek at gmail dot com Description: ------------ when using undefined constant, PHP consider name of constant to be string. when using this constant in if () or anywhere else, string value is cast as TRUE, which could confuse developer Reproduce code: --------------- // define('MY_DEFINED_CONSTANT', FALSE); if (MY_DEFINED_CONSTANT) { echo 'value of constant is TRUE'; } else { echo 'value of constant is FALSE'; } Expected result: ---------------- * error or at least warning, that we are using undefined constant * Actual result: -------------- value of constant is TRUE ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50331&edit=1

« previous php.bugs (#145204) next »