From: troy dot martin at comcast dot net
Operating system: Windows 2000 Sp 4
PHP version: 5.0.1
PHP Bug Type: Variables related
Bug description: 08 and 09 become 0 when passed to function, 07..00 become 7..0
Description:
------------
When I pass 09 or 08 to a function, the leading zero remains, but the 9 or
8 is dropped. Consequently, the value becomes 0.
When I pass 07, 06, 05, 04, 03, 02, 01, or 00, the leading zero is
dropped, and the value remains as it should.
Reproduce code:
---------------
function convertTimeToSeconds($hours, $minutes, $seconds, $hundreths)
{
print "\$minutes: " . $minutes . "<br>\n";
print $hours . ":" . $minutes . ":" . $seconds . ":" . $hundreths . " =
";
$seconds += $hours * 3600;
$seconds += $minutes * 60;
$seconds += $hundreths / 100;
print $seconds . " seconds" . "<br>\n";
return $seconds;
}
convertTimeToSeconds(00, 09, 54, 00);
convertTimeToSeconds(00, 08, 54, 00);
convertTimeToSeconds(00, 07, 54, 00);
convertTimeToSeconds(00, 06, 54, 00);
Expected result:
----------------
I expect the 09 and 08 values to change to 9 and 8 respectively. They are
changed to 0 instead.
Actual result:
--------------
09 and 08 become 0
--
Edit bug report at http://bugs.php.net/?id=30132&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30132&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30132&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30132&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30132&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30132&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30132&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30132&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30132&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30132&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30132&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30132&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30132&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30132&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30132&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30132&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30132&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30132&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30132&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30132&r=mysqlcfg