helly           Thu Oct 18 04:49:55 2007 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/spl/tests      bug42654.phpt bug42703.phpt 

  Modified files:              
    /php-src/ext/spl    spl_array.c spl_iterators.c 
  Log:
  - MFB #42654, #42704
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.130&r2=1.131&diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.130 php-src/ext/spl/spl_array.c:1.131
--- php-src/ext/spl/spl_array.c:1.130   Sun Oct  7 05:15:05 2007
+++ php-src/ext/spl/spl_array.c Thu Oct 18 04:49:54 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_array.c,v 1.130 2007/10/07 05:15:05 davidw Exp $ */
+/* $Id: spl_array.c,v 1.131 2007/10/18 04:49:54 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -1394,7 +1394,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);
 
@@ -1416,7 +1416,10 @@
                RETURN_ZVAL(*entry, 0, 0);
        }
 
+  MAKE_STD_ZVAL(flags);
+  ZVAL_LONG(flags, SPL_ARRAY_USE_OTHER);
        spl_instantiate_arg_ex1(intern->std.ce, &return_value, 0, *entry 
TSRMLS_CC);
+       zval_ptr_dtor(&flags);
 }
 /* }}} */
 
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.165&r2=1.166&diff_format=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.165 
php-src/ext/spl/spl_iterators.c:1.166
--- php-src/ext/spl/spl_iterators.c:1.165       Sun Oct  7 05:15:05 2007
+++ php-src/ext/spl/spl_iterators.c     Thu Oct 18 04:49:54 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_iterators.c,v 1.165 2007/10/07 05:15:05 davidw Exp $ */
+/* $Id: spl_iterators.c,v 1.166 2007/10/18 04:49:54 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -1135,15 +1135,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;
-               Z_ADDREF_P(intern->current.data);
+               if (data && *data) {
+                 intern->current.data = *data;
+                 Z_ADDREF_P(intern->current.data);
+               }
                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/bug42654.phpt?view=markup&rev=1.1
Index: php-src/ext/spl/tests/bug42654.phpt
+++ php-src/ext/spl/tests/bug42654.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug42703.phpt?view=markup&rev=1.1
Index: php-src/ext/spl/tests/bug42703.phpt
+++ php-src/ext/spl/tests/bug42703.phpt

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

Reply via email to