#36654 [Opn->Bgs]: ignoring passing expression by reference

From: Date: Wed, 08 Mar 2006 12:28:54 +0000
Subject: #36654 [Opn->Bgs]: ignoring passing expression by reference
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-94049@lists.php.net to get a copy of this message
ID: 36654 Updated by: tony2001@php.net Reported By: tomek at realtsp dot com -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: FreeBSD PHP Version: 5.1.2 New Comment: Turn on E_STRICT error messages. Strict Standards: Only variables should be passed by reference in Previous Comments: ------------------------------------------------------------------------ [2006-03-08 13:11:30] tomek at realtsp dot com Description: ------------ If we pass an expression by reference, it doesn't recognize the variable from the expression, but doesn't complain about that fact either. As written in http://www.php.net/manual/en/language.references.pass.php, such statement is invalid. Strangely enough it worked up to 5.0.4 (and 5.0.5 perhaps) and stopped working after upgrade to 5.1.2. Moreover, since both remaining examples from the documentation produce a fatal error, it would seem natural if that one would as well. Reproduce code: --------------- <?php function inc(&$a) { $a++; } // $b = 3; // inc($b); inc($b = 3); echo $b ."\n"; ?> Expected result: ---------------- Either 4 or a fatal error, rather than silently doing nothing. Actual result: -------------- 3 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36654&edit=1

« previous php.bugs (#94049) next »