#36948 [Opn->Bgs]: assigment operator and calling function with by ref variable

From: Date: Sun, 02 Apr 2006 12:22:56 +0000
Subject: #36948 [Opn->Bgs]: assigment operator and calling function with by ref variable
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-95212@lists.php.net to get a copy of this message
ID: 36948 Updated by: tony2001@php.net Reported By: piotrek at salaciak dot net -Status: Open +Status: Bogus Bug Type: Variables related Operating System: win 2003 + iis 6 PHP Version: 5.1.2 New Comment: Turn on E_STRICT error messages and you'll see expected errors. ($a = false) is an expression and can't be passed by reference. Previous Comments: ------------------------------------------------------------------------ [2006-04-02 14:12:42] piotrek at salaciak dot net Description: ------------ I've made a block plugin for smarty templates library, it's working fine on PHP 5.1.1 and earlier, but not on 5.1.2. The reproduce code is just minimized to show how it works and how should it work. Reproduce code: --------------- $a = true; while($a){ fun1($a = false); } // --------------------- $iterator = 0; function fun1(&$repeat){ global $iterator; if ($iterator > 10) $repeat = true; iterator++; } changing code of while to making it work as expected: $a = true; while($a){ $a = false fun1($a); } Expected result: ---------------- more than 1 iteration should be executed, Actual result: -------------- while executed once. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36948&edit=1

« previous php.bugs (#95212) next »