ID: 49061
User updated by: majuki at yahoo dot com
Reported By: majuki at yahoo dot com
-Status: Feedback
+Status: Open
Bug Type: *General Issues
Operating System: CenTOS
PHP Version: 5.2.10
New Comment:
Already included it... but I'll expand on it...
<?php
function doX(){};
(!isset($var)) ? doX() : echo $var;
(empty($var)) ? doX() : echo $var;
?>
Above code with E_NOTICE enabled.
Previous Comments:
------------------------------------------------------------------------
[2009-07-26 12:02:07] [email protected]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2009-07-26 03:13:16] majuki at yahoo dot com
Description:
------------
A version of this bug was reported last year that was marked bogus (Bug
#45760: Notice: Undefined index "?:" operator), however, there is an
error in this that is not bogus:
(isset($var)) ? doX() : echo $var;
(empty($var)) ? doX() : echo $var;
These return an undefined index even though it's being checked for.
(CentOS)
Also note that the notice in legitimate cases is still undocumented on
the alternate control structures page.
Reproduce code:
---------------
(!isset($var)) ? doX() : echo $var;
(empty($var)) ? doX() : echo $var;
Expected result:
----------------
No "Notice: Undefined index"
Actual result:
--------------
"Notice: Undefined index"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49061&edit=1