#41780 [Com]: Engine silently ignores call by reference

From: Date: Sat, 23 Jun 2007 00:30:15 +0000
Subject: #41780 [Com]: Engine silently ignores call by reference
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-114096@lists.php.net to get a copy of this message
ID: 41780 Comment by: judas dot iscariote at gmail dot com Reported By: kettler at gmx dot net Status: Open Bug Type: Scripting Engine problem Operating System: Linux 2.6.20.2 / Debian Sarge PHP Version: 5.2.3 New Comment: The error message you expect is correct, however PHP is a dynamic language, and as such it should allow the behaviour you explain in some situations where it can continue without problems. Some older versions of PHP aborts with the mentioned error with your code, however it caused a lot of complains about backward compatibility break and the engine code has been modified in order to only emit this error message on certain situations like this: $input = '1.2.3'; array_pop(explode('.', $input) + array()); Please dont suggest backward incompatible changes. we have enough of this already. Previous Comments: ------------------------------------------------------------------------ [2007-06-22 15:03:16] kettler at gmx dot net Description: ------------ The scripting engine silently ignores the pass by reference mandated by certain function, e.g. array_pop() under certain conditions. The "Reproduce code" should either work as in PHP 4 (i.e. remove the last element of the $array array) or give an error as it does when you try passing a literal array. Anything else is counter-intuitive as no required pass by reference is being used. Reproduce code: --------------- $input = '1.2.3'; array_pop($array = explode('.', $input)); print implode('.', $array); Expected result: ---------------- Fatal error: Only variables can be passed by reference in script on line 2 Actual result: -------------- 1.2.3 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41780&edit=1

« previous php.bugs (#114096) next »