#42268 [Bgs]: assignment in reference parameter doesn't resolve properly

From: Date: Sat, 11 Aug 2007 04:21:35 +0000
Subject: #42268 [Bgs]: assignment in reference parameter doesn't resolve properly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-115956@lists.php.net to get a copy of this message
ID: 42268 User updated by: donauinsel at hotmail dot com Reported By: donauinsel at hotmail dot com Status: Bogus Bug Type: *General Issues Operating System: W32 PHP Version: 5.2.4RC1 New Comment: Sorry i don't understand what you mean. I use the pass-by-reference function with global variable. Previous Comments: ------------------------------------------------------------------------ [2007-08-10 21:43:28] johannes@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php . ------------------------------------------------------------------------ [2007-08-10 20:48:53] donauinsel at hotmail dot com Description: ------------ Try first $month = 11,$year = 2007 then $month =12, $year = 2007 Function returns correct value which seems not to be passed correctly. Reproduce code: --------------- function fixdate(&$month, &$year) { if ($month < 1) { $month = 12; $year--; } elseif ($month > 12) { $month = 1; $year++; } } fixdate($nextmonth = ($month + 1), $nextyear = ($year + 0)); Expected result: ---------------- 12 / 2007 or 01 / 2008 Actual result: -------------- you will get 13 / 2007 instead. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42268&edit=1

« previous php.bugs (#115956) next »