ID:               31541
 Updated by:       [EMAIL PROTECTED]
 Reported By:      mop at globalpark dot de
-Status:           Open
+Status:           Bogus
 Bug Type:         Unknown/Other Function
 Operating System: Linux
 PHP Version:      5.0.3
 New Comment:

This was bug that is fixed now:

http://bugs.php.net/bug.php?id=21918&edit=1



Previous Comments:
------------------------------------------------------------------------

[2005-01-13 17:44:29] mop at globalpark dot de

Description:
------------
We have been using PHP 4.2.2 a while ago and saved 
serialized data in our database. Since we moved to PHP5 we 
had some problems unserializing some of this data. When 
"-1" (string) as an array key was used it appeared as a 
string in serialized form (PHP 4.2.2). PHP 4.3.10 and PHP 
5.0.3 produce a serialized string with an integer. Using 
the PHP 4.2.2 generated data with PHP 4.3.10 works as 
expected but when we try to access the array using PHP 
5.0.3 it doesn't work. That's really annoying. 

Reproduce code:
---------------
1. Script
<?php
print serialize(array("-1"=>-1))."\n";
?>

2. Script
<?php
$string='a:1:{s:2:"-1";s:2:"-1";}';
$arr=unserialize($string);

var_dump($arr["-1"]);
var_dump($arr[-1]);
?>
// PHP 4.2.2 and PHP 4.3.10 => OK
// PHP 5.0.3 => both are NULL

Expected result:
----------------
PHP 5.0.3 should return -1 in both cases 

Actual result:
--------------
PHP 5.0.3 returns NULL 


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=31541&edit=1

Reply via email to