Req #54313 [Bgs]: Illogicalness
| From: | oop at dr dot com | Date: | Tue, 22 Mar 2011 05:04:44 +0000 |
| Subject: | Req #54313 [Bgs]: Illogicalness | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-159686@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=54313&edit=1
ID: 54313
User updated by: oop at dr dot com
Reported by: oop at dr dot com
-Summary: Logical Flaw
+Summary: Illogicalness
Status: Bogus
Type: Feature/Change Request
Package: Unknown/Other Function
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Changed Summary
Previous Comments:
------------------------------------------------------------------------
[2011-03-19 11:53:16] scottmac@php.net
the flag is case insensitive, not case sensitive
------------------------------------------------------------------------
[2011-03-19 11:22:26] oop at dr dot com
Description:
------------
---
From manual page: http://www.php.net/function.define#Examples
---
<?php
define("CONSTANT", "Hello world.",false);
echo CONSTANT; // outputs "Hello world."
echo Constant; // outputs "Constant" and issues a notice.
define("GREETING", "Hello you.", true);
echo GREETING; // outputs "Hello you."
echo Greeting; // outputs "Hello you."
?>
If the case_sensitive is true, why GREETING and Greeting output the same
value (Hello you)? Then I put ,false just after "Hello world.", why
CONSTANT and Constant output the different values? Plus the echo
Constant; does not issue a notice.
Test script:
---------------
<?php
define("CONSTANT", "Hello world.",false);
echo CONSTANT; // outputs "Hello world."
echo Constant; // outputs "Constant" and issues a notice.
define("GREETING", "Hello you.", true);
echo GREETING; // outputs "Hello you."
echo Greeting; // outputs "Hello you."
?>
If the case_sensitive is true, why GREETING and Greeting output the same
value (Hello you)? Then I put ,false just after "Hello world.", why
CONSTANT and Constant output the different values? Plus the echo
Constant; does not issue a notice.
Expected result:
----------------
<?php
define("CONSTANT", "Hello world.",false);
echo CONSTANT; // outputs "Hello world."
echo Constant; // outputs "Hello world."
define("GREETING", "Hello you.", true);
echo GREETING; // outputs "Hello you."
echo Greeting; // outputs Greeting
?>
Actual result:
--------------
<?php
define("CONSTANT", "Hello world.",false);
echo CONSTANT; // outputs "Hello world."
echo Constant; // outputs "Constant" and NEVER issues a notice.
define("GREETING", "Hello you.", true);
echo GREETING; // outputs "Hello you."
echo Greeting; // outputs "Hello you."
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54313&edit=1