#32151 [Opn->Bgs]: empty($i++) not work correctly
ID: 32151
Updated by: tony2001@php.net
Reported By: konicekmartin at seznam dot cz
-Status: Open
+Status: Bogus
Bug Type: Variables related
Operating System: Linux
PHP Version: 4.3.9
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
"empty() only checks variables as anything else will result in a parse
error. In otherwords, the following will not work:
empty(addslashes($name))."
empty() doesn't work with expression, while $i++ is valid increment
expression.
Previous Comments:
------------------------------------------------------------------------
[2005-03-01 15:41:13] konicekmartin at seznam dot cz
Description:
------------
I expect that $i=0; echo $empty($i++) return true instead of parse
error
Reproduce code:
---------------
$i=0;
while($i<10){
if(empty($i++)){
echo 'firstline';
} else {
echo $i++;
}
}
Expected result:
----------------
Do the same as
$i=0;
while($i<10){
if($i++ == 0){
echo 'firstline';
} else {
echo $i++;
}
}
Actual result:
--------------
Parse error: parse error, expecting `')''
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32151&edit=1
Thread (2 messages)