#42268 [Opn->Bgs]: assignment in reference parameter doesn't resolve properly
ID: 42268
Updated by: johannes@php.net
Reported By: donauinsel at hotmail dot com
-Status: Open
+Status: Bogus
Bug Type: *General Issues
Operating System: W32
PHP Version: 5.2.4RC1
New Comment:
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
.
Previous Comments:
------------------------------------------------------------------------
[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
Thread (6 messages)