Re: Strange array access problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rob ,

Very helpful, Thanks!

I'll try to rewrite the serializer on the javascript end to encode integer keys as integers.

Ken


On Oct 26, 2005, at 1:23 AM, Robert Cummings wrote:

On Wed, 2005-10-26 at 01:06, Robert Cummings wrote:


I did some more investigating. Your problem appears to be PHP5 specific. I manually created the serialize string I assumed you had, but PHP4 was
smarter than me and auto converted the string key to an integer once
again; however, PHP5 for some reason during unserialization maintained the string type for the key, however it was not able to access the value because upon attempting to access the value I'm assuming it did a type conversion to integer... additionally I got the following error notice
when trying to access the value:

<b>Notice</b>: Undefined index: 0 in <b>/home/suds/foo.php</b> on line
<b>25</b><br />
NULL

The following can duplicated the error:

$ser = 'a:1:{s:1:"0";s:3:"foo";}';
$unser = unserialize( $ser );
var_dump( $unser );
var_dump( $unser['0'] );


FYI this is not considered a bug in PHP since PHP will not produce
serialized output in that form (IMHO it is a bug since it deviates from an expected functionality with respect to how serialized data should be encoded-- but then maybe there's a doc somewhere that states you have to
convert integer strings to real integers for keys *shrug*):

    http://bugs.php.net/bug.php?id=27712

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux