colder                                   Mon, 10 May 2010 12:38:13 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=299213

Log:
Fix crash

Changed paths:
    U   php/php-src/trunk/ext/spl/spl_observer.c

Modified: php/php-src/trunk/ext/spl/spl_observer.c
===================================================================
--- php/php-src/trunk/ext/spl/spl_observer.c    2010-05-10 11:50:57 UTC (rev 
299212)
+++ php/php-src/trunk/ext/spl/spl_observer.c    2010-05-10 12:38:13 UTC (rev 
299213)
@@ -250,9 +250,10 @@

 static zend_object_value spl_object_storage_new_ex(zend_class_entry 
*class_type, spl_SplObjectStorage **obj, zval *orig TSRMLS_DC) /* {{{ */
 {
-       zend_object_value retval;
+       zend_object_value     retval;
        spl_SplObjectStorage *intern;
-       zval *tmp;
+       zend_class_entry     *parent = class_type;
+       zval                 *tmp;

        intern = emalloc(sizeof(spl_SplObjectStorage));
        memset(intern, 0, sizeof(spl_SplObjectStorage));
@@ -271,11 +272,15 @@
                spl_object_storage_addall(intern, orig, other TSRMLS_CC);
        }

-
-       if (class_type != spl_ce_SplObjectStorage) {
-               zend_hash_find(&class_type->function_table, "gethash",    
sizeof("gethash"),    (void **) &intern->fptr_get_hash);
-               if (intern->fptr_get_hash && 
intern->fptr_get_hash->common.scope == spl_ce_SplObjectStorage) {
-                       intern->fptr_get_hash = NULL;
+       while (parent) {
+               if (parent == spl_ce_SplObjectStorage) {
+                       if (class_type != spl_ce_SplObjectStorage) {
+                               zend_hash_find(&class_type->function_table, 
"gethash",    sizeof("gethash"),    (void **) &intern->fptr_get_hash);
+                               if (intern->fptr_get_hash->common.scope == 
spl_ce_SplObjectStorage) {
+                                       intern->fptr_get_hash = NULL;
+                               }
+                       }
+                       break;
                }
        }


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

Reply via email to