iliaa           Mon Jun 11 15:10:12 2007 UTC

  Modified files:              
    /php-src/ext/wddx   wddx.c 
    /php-src/ext/wddx/tests     bug41527.phpt bug41283.phpt 
  Log:
  
  MFB: Fixed bug #41527 (WDDX deserialize numeric string array key).
  
http://cvs.php.net/viewvc.cgi/php-src/ext/wddx/wddx.c?r1=1.145&r2=1.146&diff_format=u
Index: php-src/ext/wddx/wddx.c
diff -u php-src/ext/wddx/wddx.c:1.145 php-src/ext/wddx/wddx.c:1.146
--- php-src/ext/wddx/wddx.c:1.145       Mon May 28 23:00:24 2007
+++ php-src/ext/wddx/wddx.c     Mon Jun 11 15:10:12 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: wddx.c,v 1.145 2007/05/28 23:00:24 iliaa Exp $ */
+/* $Id: wddx.c,v 1.146 2007/06/11 15:10:12 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -975,25 +975,7 @@
                                                add_property_zval(ent2->data, 
ent1->varname, ent1->data);
                                                EG(scope) = old_scope;
                                        } else {
-                                               long l;  
-                                               double d;
-                               
-                                               switch 
(is_numeric_string(ent1->varname, strlen(ent1->varname), &l, &d, 0)) {
-                                                       case IS_DOUBLE:
-                                                               if (d > 
INT_MAX) {
-                                                                       goto 
bigint;
-                                                               }
-                                                               l = (long) d;
-                                                               if (l != d) {
-                                                                       goto 
bigint;
-                                                               }
-                                                       case IS_LONG:
-                                                               
zend_hash_index_update(target_hash, l, &ent1->data, sizeof(zval *), NULL);
-                                                               break;
-                                                       default:
-bigint:
-                                                               
zend_hash_update(target_hash,ent1->varname, strlen(ent1->varname)+1, 
&ent1->data, sizeof(zval *), NULL);
-                                               }
+                                               
zend_symtable_update(target_hash, ent1->varname, strlen(ent1->varname)+1, 
&ent1->data, sizeof(zval *), NULL);
                                        }
                                        efree(ent1->varname);
                                } else  {
http://cvs.php.net/viewvc.cgi/php-src/ext/wddx/tests/bug41527.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/wddx/tests/bug41527.phpt
diff -u /dev/null php-src/ext/wddx/tests/bug41527.phpt:1.2
--- /dev/null   Mon Jun 11 15:10:12 2007
+++ php-src/ext/wddx/tests/bug41527.phpt        Mon Jun 11 15:10:12 2007
@@ -0,0 +1,22 @@
+--TEST--
+Bug #41527 (WDDX deserialize numeric string array keys)
+--SKIPIF--
+<?php if (!extension_loaded("wddx")) print "skip"; ?>
+--FILE--
+<?php
+$data = array('01' => 'Zero', '+1' => 'Plus sign', ' 1' => 'Space');
+
+var_dump(wddx_deserialize(wddx_serialize_vars('data')));
+?>
+--EXPECT--
+array(1) {
+  ["data"]=>
+  array(3) {
+    ["01"]=>
+    string(4) "Zero"
+    ["+1"]=>
+    string(9) "Plus sign"
+    [" 1"]=>
+    string(5) "Space"
+  }
+}
http://cvs.php.net/viewvc.cgi/php-src/ext/wddx/tests/bug41283.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/wddx/tests/bug41283.phpt
diff -u php-src/ext/wddx/tests/bug41283.phpt:1.2 
php-src/ext/wddx/tests/bug41283.phpt:1.3
--- php-src/ext/wddx/tests/bug41283.phpt:1.2    Tue May 29 20:11:23 2007
+++ php-src/ext/wddx/tests/bug41283.phpt        Mon Jun 11 15:10:12 2007
@@ -20,7 +20,7 @@
       string(5) "One 1"
       ["1.2"]=>
       string(5) "One 2"
-      [1]=>
+      ["1.0"]=>
       string(5) "Three"
     }
   }



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

Reply via email to