helly           Thu Oct 18 05:26:55 2007 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/spl    spl_array.c spl_iterators.c 
    /php-src/ext/spl/tests      bug41692.phpt bug42654.phpt 
  Log:
  - MF53 Fix for #41692, #42703
  # Now in correct branch with fixed checkout and so on
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13&r2=1.71.2.17.2.14&diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13 
php-src/ext/spl/spl_array.c:1.71.2.17.2.14
--- php-src/ext/spl/spl_array.c:1.71.2.17.2.13  Fri Jul 20 10:53:56 2007
+++ php-src/ext/spl/spl_array.c Thu Oct 18 05:26:55 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_array.c,v 1.71.2.17.2.13 2007/07/20 10:53:56 tony2001 Exp $ */
+/* $Id: spl_array.c,v 1.71.2.17.2.14 2007/10/18 05:26:55 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -1365,7 +1365,7 @@
    Create a sub iterator for the current element (same class as $this) */
 SPL_METHOD(Array, getChildren)
 {
-       zval *object = getThis(), **entry;
+       zval *object = getThis(), **entry, *flags;
        spl_array_object *intern = 
(spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
        HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
 
@@ -1387,7 +1387,10 @@
                RETURN_ZVAL(*entry, 0, 0);
        }
 
-       spl_instantiate_arg_ex1(Z_OBJCE_P(getThis()), &return_value, 0, *entry 
TSRMLS_CC);
+  MAKE_STD_ZVAL(flags);
+  ZVAL_LONG(flags, SPL_ARRAY_USE_OTHER);
+       spl_instantiate_arg_ex2(intern->std.ce, &return_value, 0, *entry, flags 
TSRMLS_CC);
+       zval_ptr_dtor(&flags);
 }
 /* }}} */
 
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.30.2.28&r2=1.73.2.30.2.29&diff_format=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28 
php-src/ext/spl/spl_iterators.c:1.73.2.30.2.29
--- php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28      Fri May 11 00:15:25 2007
+++ php-src/ext/spl/spl_iterators.c     Thu Oct 18 05:26:55 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_iterators.c,v 1.73.2.30.2.28 2007/05/11 00:15:25 helly Exp $ */
+/* $Id: spl_iterators.c,v 1.73.2.30.2.29 2007/10/18 05:26:55 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -1124,15 +1124,17 @@
        spl_dual_it_free(intern TSRMLS_CC);
        if (!check_more || spl_dual_it_valid(intern TSRMLS_CC) == SUCCESS) {
                
intern->inner.iterator->funcs->get_current_data(intern->inner.iterator, &data 
TSRMLS_CC);
-               intern->current.data = *data;
-               intern->current.data->refcount++;
+               if (data && *data) {
+                 intern->current.data = *data;
+                 intern->current.data->refcount++;
+               }
                if (intern->inner.iterator->funcs->get_current_key) {
                        intern->current.key_type = 
intern->inner.iterator->funcs->get_current_key(intern->inner.iterator, 
&intern->current.str_key, &intern->current.str_key_len, 
&intern->current.int_key TSRMLS_CC);
                } else {
                        intern->current.key_type = HASH_KEY_IS_LONG;
                        intern->current.int_key = intern->current.pos;
                }
-               return SUCCESS;
+               return EG(exception) ? FAILURE : SUCCESS;
        }
        return FAILURE;
 }
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug41692.phpt?r1=1.1.2.3&r2=1.1.2.4&diff_format=u
Index: php-src/ext/spl/tests/bug41692.phpt
diff -u php-src/ext/spl/tests/bug41692.phpt:1.1.2.3 
php-src/ext/spl/tests/bug41692.phpt:1.1.2.4
--- php-src/ext/spl/tests/bug41692.phpt:1.1.2.3 Thu Oct 18 04:51:53 2007
+++ php-src/ext/spl/tests/bug41692.phpt Thu Oct 18 05:26:55 2007
@@ -21,44 +21,20 @@
 echo "Done\n";
 ?>
 --EXPECTF--    
-object(Bar)#%d (2) {
-  ["foo":"Bar":private]=>
-  array(3) {
-    [0]=>
-    int(1)
-    [1]=>
-    int(2)
-    [2]=>
-    int(3)
-  }
-  ["storage":"ArrayObject":private]=>
-  array(3) {
-    [0]=>
-    int(1)
-    [1]=>
-    int(2)
-    [2]=>
-    int(3)
-  }
+object(Bar)#%d (3) {
+  [0]=>
+  int(1)
+  [1]=>
+  int(2)
+  [2]=>
+  int(3)
 }
-object(Bar)#%d (2) {
-  ["foo":"Bar":private]=>
-  array(3) {
-    [0]=>
-    int(1)
-    [1]=>
-    int(2)
-    [2]=>
-    int(3)
-  }
-  ["storage":"ArrayObject":private]=>
-  array(3) {
-    [0]=>
-    int(1)
-    [1]=>
-    int(2)
-    [2]=>
-    int(3)
-  }
+object(Bar)#%d (3) {
+  [0]=>
+  int(1)
+  [1]=>
+  int(2)
+  [2]=>
+  int(3)
 }
 Done
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug42654.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u
Index: php-src/ext/spl/tests/bug42654.phpt
diff -u php-src/ext/spl/tests/bug42654.phpt:1.1.4.2 
php-src/ext/spl/tests/bug42654.phpt:1.1.4.3
--- php-src/ext/spl/tests/bug42654.phpt:1.1.4.2 Thu Oct 18 04:49:55 2007
+++ php-src/ext/spl/tests/bug42654.phpt Thu Oct 18 05:26:55 2007
@@ -23,47 +23,10 @@
 ?>
 --EXPECTF--
 update 1
-object(RecursiveArrayIterator)#%d (1) {
-  ["storage":"ArrayIterator":private]=>
-  array(3) {
-    [1]=>
-    string(4) "val1"
-    [2]=>
-    array(2) {
-      [2]=>
-      string(4) "val2"
-      [3]=>
-      array(1) {
-        [3]=>
-        string(4) "val3"
-      }
-    }
-    [4]=>
-    string(4) "val4"
-  }
-}
-object(RecursiveArrayIterator)#%d (1) {
-  ["storage":"ArrayIterator":private]=>
-  array(3) {
-    [1]=>
-    string(5) "alter"
-    [2]=>
-    array(2) {
-      [2]=>
-      string(4) "val2"
-      [3]=>
-      array(1) {
-        [3]=>
-        string(4) "val3"
-      }
-    }
-    [4]=>
-    string(4) "val4"
-  }
-}
-update 2
-object(RecursiveArrayIterator)#%d (1) {
-  ["storage":"ArrayIterator":private]=>
+object(RecursiveArrayIterator)#%d (3) {
+  [1]=>
+  string(4) "val1"
+  [2]=>
   array(2) {
     [2]=>
     string(4) "val2"
@@ -73,72 +36,85 @@
       string(4) "val3"
     }
   }
+  [4]=>
+  string(4) "val4"
 }
-object(RecursiveArrayIterator)#%d (1) {
-  ["storage":"ArrayIterator":private]=>
+object(RecursiveArrayIterator)#%d (3) {
+  [1]=>
+  string(5) "alter"
+  [2]=>
   array(2) {
     [2]=>
-    string(5) "alter"
+    string(4) "val2"
     [3]=>
     array(1) {
       [3]=>
       string(4) "val3"
     }
   }
+  [4]=>
+  string(4) "val4"
 }
-update 3
-object(RecursiveArrayIterator)#%d (1) {
-  ["storage":"ArrayIterator":private]=>
+update 2
+object(RecursiveArrayIterator)#%d (2) {
+  [2]=>
+  string(4) "val2"
+  [3]=>
   array(1) {
     [3]=>
     string(4) "val3"
   }
 }
-object(RecursiveArrayIterator)#%d (1) {
-  ["storage":"ArrayIterator":private]=>
+object(RecursiveArrayIterator)#%d (2) {
+  [2]=>
+  string(5) "alter"
+  [3]=>
   array(1) {
     [3]=>
-    string(5) "alter"
+    string(4) "val3"
   }
 }
-update 4
+update 3
 object(RecursiveArrayIterator)#%d (1) {
-  ["storage":"ArrayIterator":private]=>
-  array(3) {
-    [1]=>
-    string(5) "alter"
+  [3]=>
+  string(4) "val3"
+}
+object(RecursiveArrayIterator)#%d (1) {
+  [3]=>
+  string(5) "alter"
+}
+update 4
+object(RecursiveArrayIterator)#%d (3) {
+  [1]=>
+  string(5) "alter"
+  [2]=>
+  array(2) {
     [2]=>
-    array(2) {
-      [2]=>
-      string(4) "val2"
+    string(4) "val2"
+    [3]=>
+    array(1) {
       [3]=>
-      array(1) {
-        [3]=>
-        string(4) "val3"
-      }
+      string(4) "val3"
     }
-    [4]=>
-    string(4) "val4"
   }
+  [4]=>
+  string(4) "val4"
 }
-object(RecursiveArrayIterator)#%d (1) {
-  ["storage":"ArrayIterator":private]=>
-  array(3) {
-    [1]=>
-    string(5) "alter"
+object(RecursiveArrayIterator)#%d (3) {
+  [1]=>
+  string(5) "alter"
+  [2]=>
+  array(2) {
     [2]=>
-    array(2) {
-      [2]=>
-      string(4) "val2"
+    string(4) "val2"
+    [3]=>
+    array(1) {
       [3]=>
-      array(1) {
-        [3]=>
-        string(4) "val3"
-      }
+      string(4) "val3"
     }
-    [4]=>
-    string(5) "alter"
   }
+  [4]=>
+  string(5) "alter"
 }
 array(3) {
   [1]=>

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

Reply via email to