php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34040 using 08 and 09 as integer
Submitted: 2005-08-08 19:55 UTC Modified: 2005-08-10 14:43 UTC
From: csmar51 at free dot fr Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5CVS-2005-08-08 (dev) OS: Linux Fedora Core 3 & Windows XP
Private report: No CVE-ID: None
 [2005-08-08 19:55 UTC] csmar51 at free dot fr
Description:
------------
When we assign 08 or 09 has a variable (or in an array), this one registers only 0. While with 01, 02, etc, this problem does not appear. This is also reproducible everytime you use 08 or 09 as integer.
This arises with different versions of php: 4CVS-2005-08-08, 5.0.4, 5CVS-2005-08-08, 5.1.0b3. Either with a modified or default configuration.

PHP configure line: ./configure --prefix=/www/php
                    ./configure --prefix=/www/php --with-apxs=/www/apache/bin/apxs --with-config-file-path=/www/apache/conf/ --enable-versioning --with-mm=/usr --with-libxml-dir=/usr --enable-ftp --with-gd=/usr --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-freetype-dir=/usr --enable-gd-native-ttf --with-mysql=/www/mysql --with-mysql-sock --enable-sockets --enable-shared --enable-static

Reproduce code:
---------------
<?
$mon_array = array('Jan'=>01, 'Feb'=>02, 'Mar'=>03, 'Apr'=>04, 'May'=>05, 'Jun'=>06,
                   'Jul'=>07, 'Aug'=>08, 'Sep'=>09, 'Oct'=>10, 'Nov'=>11, 'Dec'=>12);
var_dump($mon_array);
?>

Expected result:
----------------
array(12) {
  ["Jan"]=>  int(1)
  ["Feb"]=>  int(2)
  ["Mar"]=>  int(3)
  ["Apr"]=>  int(4)
  ["May"]=>  int(5)
  ["Jun"]=>  int(6)
  ["Jul"]=>  int(7)
  ["Aug"]=>  int(8)
  ["Sep"]=>  int(9)
  ["Oct"]=>  int(10)
  ["Nov"]=>  int(11)
  ["Dec"]=>  int(12)
}

Actual result:
--------------
array(12) {
  ["Jan"]=>  int(1)
  ["Feb"]=>  int(2)
  ["Mar"]=>  int(3)
  ["Apr"]=>  int(4)
  ["May"]=>  int(5)
  ["Jun"]=>  int(6)
  ["Jul"]=>  int(7)
  ["Aug"]=>  int(0)
  ["Sep"]=>  int(0)
  ["Oct"]=>  int(10)
  ["Nov"]=>  int(11)
  ["Dec"]=>  int(12)
}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-08 19:56 UTC] sniper@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.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Never heard of octal numbers, have you?

 [2005-08-10 14:36 UTC] csmar51 at free dot fr
Ok, thaks for your answer.
I never heard of octal numbers before, that's now done.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 06 15:01:35 2025 UTC