#43614 [Opn]: incorrect processing of numerical string keys of array (unserialize)
| From: | dmitriy dot buldakov at toatech dot com | Date: | Tue, 18 Dec 2007 13:46:45 +0000 |
| Subject: | #43614 [Opn]: incorrect processing of numerical string keys of array (unserialize) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-120733@lists.php.net to get a copy of this message | ||
ID: 43614
User updated by: dmitriy dot buldakov at toatech dot com
Reported By: dmitriy dot buldakov at toatech dot com
Status: Open
Bug Type: Arrays related
Operating System: Mac OS X
PHP Version: 5.2.5
New Comment:
The following code works well
switch (Z_TYPE_P(key)) {
case IS_LONG:
zend_hash_index_update(ht, Z_LVAL_P(key), &data, sizeof(data),
NULL);
break;
case IS_STRING:
zend_symtable_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1,
&data, sizeof(data), NULL);
break;
}
but looks like still there is a problem here.
compearing var_unserialize.c with array.c you can see that key array.c
uses more sufficient key preparation.
So, about the code - what should I do to put the code into repository?
Previous Comments:
------------------------------------------------------------------------
[2007-12-18 12:05:00] dmitriy dot buldakov at toatech dot com
I have not tesdet last patch yet, but looks like "0" is not converted
to int 0 with the patch.
------------------------------------------------------------------------
[2007-12-18 12:04:46] dmitriy dot buldakov at toatech dot com
I have not tesdet last patch yet, but looks like "0" is not converted
to int 0 with the patch.
------------------------------------------------------------------------
[2007-12-18 01:52:38] felipe@php.net
Updated. The function did accept other characters. And how not is
possible to use de HANDLE_NUMERIC(), I make a loop and check for each
char.
http://ecl.zoone.com.br/etc/patches/bug43614.patch
------------------------------------------------------------------------
[2007-12-17 16:03:08] dmitriy dot buldakov at toatech dot com
Last patch works much more better, but there is still a problem.
the patch ignores leading spaces.
for example keys ' 10' and ' -10' are converted to integer 10 and -10.
------------------------------------------------------------------------
[2007-12-17 13:54:07] felipe@php.net
Yes, correct. I've used not suitable function. Tony alerted me of a
correct function.
http://ecl.zoone.com.br/etc/patches/bug43614.patch
http://ecl.zoone.com.br/etc/patches/bug43614.phpt
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/43614
--
Edit this bug report at http://bugs.php.net/?id=43614&edit=1