#41781 [Opn->Bgs]: PHP loses the reference to the default parameter

From: Date: Mon, 25 Jun 2007 17:48:41 +0000
Subject: #41781 [Opn->Bgs]: PHP loses the reference to the default parameter
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-114174@lists.php.net to get a copy of this message
ID: 41781 Updated by: tony2001@php.net Reported By: skettler@php.net -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Linux 2.6.20.2 / Debian Sarge PHP Version: 5.2.3 New Comment: 0123456 -------- 0 Strict Standards: Only variables should be passed by reference in /tmp/3.php on line 26 1 Strict Standards: Only variables should be passed by reference in /tmp/3.php on line 26 2 Strict Standards: Only variables should be passed by reference in /tmp/3.php on line 20 3 Strict Standards: Only variables should be passed by reference in /tmp/3.php on line 26 4 Strict Standards: Only variables should be passed by reference in /tmp/3.php on line 26 5 Strict Standards: Only variables should be passed by reference in /tmp/3.php on line 26 4 Strict Standards: Only variables should be passed by reference in /tmp/3.php on line 26 5 -------- 0123456 Previous Comments: ------------------------------------------------------------------------ [2007-06-22 15:14:15] skettler@php.net Description: ------------ When using a pass by reference parameter with a default value, the scripting engine does not always remember that reference. The script shows that ++$i; func($i); and func(++$i); are not equivalent at all times. When not using the default value and submitting an actual variable, both expressions are handled the same way. Reproduce code: --------------- See http://helplets.com/PHP/referencebug.txt Expected result: ---------------- 0123456 -------- 0123456 -------- 0123456 Actual result: -------------- 0123456 -------- 01234545 -------- 0123456 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41781&edit=1

« previous php.bugs (#114174) next »