#39334 [NEW]: Value und type of var changes in if statement

From: Date: Wed, 01 Nov 2006 14:47:07 +0000
Subject: #39334 [NEW]: Value und type of var changes in if statement
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-104255@lists.php.net to get a copy of this message
From:             sw4u at gmx dot net
Operating system: Debian Linux 3.1
PHP version:      4.4.4
PHP Bug Type:     Variables related
Bug description:  Value und type of var changes in if statement

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 bug report at http://bugs.php.net/?id=39334&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39334&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39334&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39334&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=39334&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=39334&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=39334&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=39334&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=39334&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=39334&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=39334&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=39334&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=39334&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=39334&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=39334&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=39334&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=39334&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=39334&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=39334&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=39334&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=39334&r=mysqlcfg


Thread (2 messages)

« previous php.bugs (#104255) next »