Req #67104 [Com]: Behaviour of defining constants is inconsistent and misleading

From: Date: Wed, 07 May 2014 08:58:15 +0000
Subject: Req #67104 [Com]: Behaviour of defining constants is inconsistent and misleading
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-185684@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67104&edit=1 ID: 67104 Comment by: iam4webwork at hotmail dot com Reported by: ss23 at ss23 dot geek dot nz Summary: Behaviour of defining constants is inconsistent and misleading Status: Open Type: Feature/Change Request Package: *General Issues PHP Version: Irrelevant Block user comment: N Private report: N New Comment: The following result occurs for PHP4.3.0-5.1.2 (see http://3v4l.org/M1ZrQ#v430) bool(true) bool(false) bool(false) bool(true) These results seem fine. What changed and why? I agree that there sh/b s.thing in case s.one tries to override a built-in constant. Previous Comments: ------------------------------------------------------------------------ [2014-04-21 23:57:23] ss23 at ss23 dot geek dot nz Description: ------------ The current behaviour is very confusing. Test script: --------------- <?php define('TRUE', false); var_dump(true); var_dump(TRUE); var_dump(constant('TRUE')); var_dump(constant('true')); Expected result: ---------------- Anything but this. An E_ERROR (or even E_WARNING) on the initial define would be enough. Actual result: -------------- bool(true) bool(true) bool(false) bool(true) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67104&edit=1

« previous php.bugs (#185684) next »