#39334 [Opn->Bgs]: Value und type of var changes in if statement
ID: 39334
Updated by: johannes@php.net
Reported By: sw4u at gmx dot net
-Status: Open
+Status: Bogus
Bug Type: Variables related
Operating System: Debian Linux 3.1
PHP Version: 4.4.4
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
Please check the operator precedence and use parenthesis. See
php.net/operator
Previous Comments:
------------------------------------------------------------------------
[2006-11-01 14:47:07] sw4u at gmx dot net
Description:
------------
Only the last var in an if statement with function call is returned as
expected. The other types are changed to bool.
Debian Linux 3.1
Server API Apache 2.0 Handler
Default Debian installation
Apache/2.0.54 (Debian GNU/Linux) PHP/4.3.10-16
Reproduce code:
---------------
<?php
function test($string){
return ($string);
}
if( $a = test("a") && $b = test("b") && $c = test("c")
){
echo $a;
echo $b;
echo $c;
}
?>
Expected result:
----------------
abc
Actual result:
--------------
11c
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39334&edit=1
Thread (2 messages)