php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30132 08 and 09 become 0 when passed to function, 07..00 become 7..0
Submitted: 2004-09-17 12:35 UTC Modified: 2004-09-17 12:39 UTC
From: troy dot martin at comcast dot net Assigned:
Status: Not a bug Package: Variables related
PHP Version: 5.0.1 OS: Windows 2000 Sp 4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: troy dot martin at comcast dot net
New email:
PHP Version: OS:

 

 [2004-09-17 12:35 UTC] troy dot martin at comcast dot net
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-17 12:39 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

Octal numbers -> RTM
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 09:01:29 2024 UTC