php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36948 assigment operator and calling function with by ref variable
Submitted: 2006-04-02 14:12 UTC Modified: 2006-04-02 14:22 UTC
From: piotrek at salaciak dot net Assigned:
Status: Not a bug Package: Variables related
PHP Version: 5.1.2 OS: win 2003 + iis 6
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: piotrek at salaciak dot net
New email:
PHP Version: OS:

 

 [2006-04-02 14:12 UTC] 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-02 14:22 UTC] tony2001@php.net
Turn on E_STRICT error messages and you'll see expected errors.
($a = false) is an expression and can't be passed by reference.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jul 26 23:01:30 2024 UTC