cvs: php-gtk /main phpg_support.c

From: Date: Sat, 29 Oct 2005 20:45:39 +0000
Subject: cvs: php-gtk /main phpg_support.c
Groups: php.gtk.cvs 
Request: Send a blank email to php-gtk-cvs+get-1975@lists.php.net to get a copy of this message
andrei Sat Oct 29 16:45:39 2005 EDT Modified files: /php-gtk/main phpg_support.c Log: Fix a nasty and convoluted crash bug that occurs when we have to create an internal class for a GType at runtime *and* there are any userspace classes declared. http://cvs.php.net/diff.php/php-gtk/main/phpg_support.c?r1=1.11&r2=1.12&ty=u Index: php-gtk/main/phpg_support.c diff -u php-gtk/main/phpg_support.c:1.11 php-gtk/main/phpg_support.c:1.12 --- php-gtk/main/phpg_support.c:1.11 Fri Sep 23 06:23:55 2005 +++ php-gtk/main/phpg_support.c Sat Oct 29 16:45:38 2005 @@ -50,6 +50,7 @@ } if (ret == SUCCESS) { + memset(&result, 0, sizeof(zval)); ZVAL_NULL(&result); ret = pi->read(poh, &result TSRMLS_CC); if (ret == SUCCESS) { @@ -441,6 +442,23 @@ phpg_register_int_constant(ce, "gtype", sizeof("gtype")-1, gtype); + /* + * This is required to trick Zend into performing the global class table cleanup in a + * different manner. EG(full_table_cleanup) is 0 normally, and is set to 1 if any + * module is loaded via dl(), because the module may register internal classes. When + * we register an internal class at runtime, it is added to the end of the class list. + * shutdown_executor() has to remove user-declared classes from the class list. It + * does it by iterating through the list in reverse order and cleaning up all user + * classes until it encounters an internal class, but since we have just added an + * internal class at the very end, it stops right away and does not clean up the user + * ones. We circumvent it by pretending to be a dynamically loaded module so that the + * hash cleanup does not stop on the first internal class and proceeds through the + * whole table. + * + * Whether there is a better way to do it is still to be seen. + */ + EG(full_tables_cleanup) = 1; + return ce; } /* }}} */

« previous php.gtk.cvs (#1975) next »