helly           Thu Oct 18 04:41:39 2007 UTC

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

  Modified files:              
    /php-src/ext/spl    spl_iterators.c 
  Log:
  - Fix #42703
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.30.2.28.2.2&r2=1.73.2.30.2.28.2.3&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.2.2 
php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.3
--- php-src/ext/spl/spl_iterators.c:1.73.2.30.2.28.2.2  Sun Oct  7 05:22:06 2007
+++ php-src/ext/spl/spl_iterators.c     Thu Oct 18 04:41:39 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.2 2007/10/07 05:22:06 davidw Exp $ 
*/
+/* $Id: spl_iterators.c,v 1.73.2.30.2.28.2.3 2007/10/18 04:41:39 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;
-               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/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