colder          Wed Mar 12 13:24:24 2008 UTC

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

  Modified files:              
    /php-src/ext/spl    spl_iterators.c 
  Log:
  Fix bug #41828 (Fix crash on wrong instantiation)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.30.2.30&r2=1.73.2.30.2.31&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.30 
php-src/ext/spl/spl_iterators.c:1.73.2.30.2.31
--- php-src/ext/spl/spl_iterators.c:1.73.2.30.2.30      Mon Dec 31 07:20:11 2007
+++ php-src/ext/spl/spl_iterators.c     Wed Mar 12 13:24:24 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_iterators.c,v 1.73.2.30.2.30 2007/12/31 07:20:11 sebastian Exp $ */
+/* $Id: spl_iterators.c,v 1.73.2.30.2.31 2008/03/12 13:24:24 colder Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -693,8 +693,13 @@
        union _zend_function    *function_handler;
        spl_recursive_it_object *object = 
(spl_recursive_it_object*)zend_object_store_get_object(*object_ptr TSRMLS_CC);
        long                     level = object->level;
-       zval                    *zobj = object->iterators[level].zobject;
-       
+       zval                    *zobj;
+
+       if (!object->iterators) {
+               php_error_docref(NULL TSRMLS_CC, E_ERROR, "The %s instance 
wasn't initialized properly", Z_OBJCE_PP(object_ptr)->name);
+       }
+       zobj = object->iterators[level].zobject;
+
        function_handler = std_object_handlers.get_method(object_ptr, method, 
method_len TSRMLS_CC);
        if (!function_handler) {
                if (zend_hash_find(&Z_OBJCE_P(zobj)->function_table, method, 
method_len+1, (void **) &function_handler) == FAILURE) {

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



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

Reply via email to