Req #54313 [NEW]: Logical Flaw
| From: | oop at dr dot com | Date: | Sat, 19 Mar 2011 10:22:28 +0000 |
| Subject: | Req #54313 [NEW]: Logical Flaw | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-159615@lists.php.net to get a copy of this message | ||
From:
Operating system:
PHP version: Irrelevant
Package: Unknown/Other Function
Bug Type: Feature/Change Request
Bug description:Logical Flaw
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 bug report at http://bugs.php.net/bug.php?id=54313&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54313&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54313&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54313&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54313&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54313&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54313&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54313&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54313&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54313&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54313&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54313&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54313&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54313&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54313&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54313&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54313&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54313&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54313&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54313&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54313&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54313&r=mysqlcfg