]> granicus.if.org Git - php/commitdiff
- Earlier detection of failure (.c now)
authorMarcus Boerger <helly@php.net>
Sun, 26 Sep 2004 21:49:16 +0000 (21:49 +0000)
committerMarcus Boerger <helly@php.net>
Sun, 26 Sep 2004 21:49:16 +0000 (21:49 +0000)
ext/standard/var_unserializer.c

index 4a217019037de2cce0fe26ab4c9f5a0228d5ad5e..de544cbe90bb97e13a61a07fe736902b14e2e0c5 100644 (file)
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.9.4 on Sun Sep 12 14:43:48 2004 */
+/* Generated by re2c 0.9.4 on Mon Sep 13 21:59:57 2004 */
 #line 1 "/usr/src/php-cvs/ext/standard/var_unserializer.re"
 /*
   +----------------------------------------------------------------------+
@@ -187,6 +187,12 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, int
                        return 0;
                }
 
+               if (Z_TYPE_P(key) != IS_LONG && Z_TYPE_P(key) != IS_STRING) {
+                       zval_dtor(key);
+                       FREE_ZVAL(key);
+                       return 0;
+               }
+
                ALLOC_INIT_ZVAL(data);
 
                if (!php_var_unserialize(&data, p, max, var_hash TSRMLS_CC)) {
@@ -204,12 +210,6 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, int
                        case IS_STRING:
                                zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL);
                                break;
-                       default:
-                               zval_dtor(key);
-                               FREE_ZVAL(key);
-                               zval_dtor(data);
-                               FREE_ZVAL(data);
-                               return 0;
                }
                
                zval_dtor(key);