ID: 28752
User updated by: cpuidle at gmx dot de
Reported By: cpuidle at gmx dot de
Status: Wont fix
Bug Type: Scripting Engine problem
Operating System: WinXP
PHP Version: 5CVS-2004-06-12 (dev)
New Comment:
Indeed.. 2nd issue not ok, message confusing, accepted.
1st issue:
Found this is working on my 2nd PC, not on first. Difference: working
one is running zend optimizer 2.5.0, other is 2.5.2. Disabled 2.5.2
optimizer and bounced apache, now this machine is working, too.
Assumption: zend optimizer 2.5.2 is broken- what am I supposed to do?
Thanks,
Andi
Previous Comments:
------------------------------------------------------------------------
[2004-06-12 17:15:12] [EMAIL PROTECTED]
On the first item: empty($$var) evaluates correctly, recheck your test
script to be sure you didn't typo somewhere.
On the second item: This is expected behavior. empty() is not a
function, but rather a language construct which specicically expects a
real variable and not a function return value. I'll certainly grant
the error message is confusing, but no more confusing than PHP4's
version of this error:
Parse error: parse error, unexpected T_STRING, expecting T_VARIABLE or
'$' in /cvs/php4/28752.php on line 15
------------------------------------------------------------------------
[2004-06-12 10:45:58] cpuidle at gmx dot de
Description:
------------
Two issues exist with php5rc3 when using indirect variables:
Reproduce code:
---------------
<?php
$test = '';
$var = 'test';
if (empty($test)) {
echo 'test empty';
}
// excepted & actual: test empty
if (empty($$var)) {
echo 'test empty';
}
// expected result: test empty
// actual result: <-------!!
$test = 'doo';
echo trim($$var);
// excepted & actual: doo
if (empty(trim($$var));
// Fatal error: Can't use function return value in write
// context in C:\htdocs\test4.php on line 8
// where is the write context here? <-------!!
?>
Expected result:
----------------
see above
Actual result:
--------------
see above
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28752&edit=1