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

From: Date: Fri, 10 Aug 2007 20:48:53 +0000
Subject: #42268 [NEW]: assignment in reference parameter doesn't resolve properly
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-115949@lists.php.net to get a copy of this message
From: donauinsel at hotmail dot com Operating system: W32 PHP version: 5.2.4RC1 PHP Bug Type: *General Issues Bug description: assignment in reference parameter doesn't resolve properly 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 bug report at http://bugs.php.net/?id=42268&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42268&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42268&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42268&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42268&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42268&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42268&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42268&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42268&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42268&r=support Expected behavior: http://bugs.php.net/fix.php?id=42268&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42268&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42268&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42268&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42268&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42268&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42268&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42268&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42268&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42268&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42268&r=mysqlcfg

« previous php.bugs (#115949) next »