#41274 [NEW]: Number 08 / 09 and 8/9 not same int's
| From: | cpp_pgmr at yahoo dot com | Date: | Thu, 03 May 2007 23:39:44 +0000 |
| Subject: | #41274 [NEW]: Number 08 / 09 and 8/9 not same int's | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-112217@lists.php.net to get a copy of this message | ||
From: cpp_pgmr at yahoo dot com
Operating system: Win XP Pro / Linux
PHP version: 5.2.2
PHP Bug Type: Arrays related
Bug description: Number 08 / 09 and 8/9 not same int's
Description:
------------
Creating a calendar of Birthdays....
I created a multi-dimesional array with mixed data types. (Name /
birthdate)
Each array had the same # of elements.
These are numbers:
For some reason, the digit 08 was not the same as 8.
Also the digit 09 was not the same as 9.
I don't know why the zero makes any difference.
See in action: http://www.wcnet.org/~tomc83/bug.php
See source code: http://www.wcnet.org/~tomc83/bug.txt
Could not test prior than PHP 5.0.0.
Reproduce code:
---------------
<?php
$dataAry = array(
// Name: First, MI, Last, Birth: Mon, Day, Yr, HideAge, HidePic,
ImgLoc
// 0 1 2 3 4 5 6 7 8
//array( 'First', 'M', 'Last', 02, 22, 1983, 'N',
'N', '' ),
// --------------------------------------------------
array( 'Kymberly', 'A', 'Brinker', 01, 06, 1984, 'N',
'N', '' ),
array( 'Mary', 'E', 'Brinker', 02, 11, 1959, 'N',
'N', '' ),
array( 'Thomas', 'W', 'Brinker', 08, 27, 1986,
'N', 'N', ''
),
array( 'Daniel', 'J', 'Clark', 09, 12, 1960, 'N',
'N', '' ),
array( 'Darin', 'J', 'Clark', 01, 02, 1965, 'N',
'N', '' ),
array( '**1**', 'J', 'C', 08, 14, 1939, 'N',
'N', '' ),
array( '**2**', 'J', 'C', 8, 02, 1940, 'N',
'N', '' ),
array( 'Thomas', 'J', 'Clark', 02, 22, 1983, 'N',
'N', '' )
);
foreach( $dataAry as $person )
echo "$person[0] $person[2] - $person[3]/$person[4]/$person[5]<BR>";
?>
Expected result:
----------------
That 08 and 8 are the same integers.
Actual result:
--------------
Treats 08 or 09 as 0, but treats 01, 02, 03...etc as 1, 2, 3.
--
Edit bug report at http://bugs.php.net/?id=41274&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41274&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41274&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41274&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41274&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=41274&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41274&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41274&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41274&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41274&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41274&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=41274&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=41274&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41274&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41274&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41274&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41274&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41274&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41274&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41274&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41274&r=mysqlcfg