From: Thies C. Arntzen Date: Mon, 6 Aug 2001 13:36:08 +0000 (+0000) Subject: we can no longer register internal-classes once the script is started. X-Git-Tag: PRE_ENGINE2_SPLIT~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a35df189b8e6a580261e4cce0339b0f0d2a0d4c3;p=php we can no longer register internal-classes once the script is started. therefore the "incomplete class" is now registered at MINIT time. --- diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index cc19b0dfaa..5bd25d7171 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -26,6 +26,7 @@ #include "internal_functions_registry.h" #include "php_standard.h" #include "php_math.h" +#include "php_incomplete_class.h" #include "ext/standard/info.h" #include "zend_operators.h" #include @@ -722,6 +723,8 @@ static void basic_globals_ctor(php_basic_globals *basic_globals_p TSRMLS_DC) #ifdef PHP_WIN32 CoInitialize(NULL); #endif + + BG(incomplete_class) = php_create_incomplete_class(TSRMLS_C); } static void basic_globals_dtor(php_basic_globals *basic_globals_p TSRMLS_DC) @@ -797,6 +800,7 @@ PHP_MINIT_FUNCTION(basic) PHP_MINIT(url_scanner_ex)(INIT_FUNC_ARGS_PASSTHRU); #endif + if(PG(allow_url_fopen)) { if (FAILURE==php_register_url_wrapper("http", php_fopen_url_wrap_http TSRMLS_CC)) { return FAILURE; @@ -853,7 +857,6 @@ PHP_RINIT_FUNCTION(basic) BG(locale_string) = NULL; BG(user_compare_func_name) = NULL; BG(array_walk_func_name) = NULL; - BG(incomplete_class) = NULL; #ifdef HAVE_MMAP BG(mmap_file) = NULL; #endif diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c index 44470006f1..246e8d556c 100644 --- a/ext/standard/incomplete_class.c +++ b/ext/standard/incomplete_class.c @@ -97,9 +97,7 @@ zend_class_entry *php_create_incomplete_class(TSRMLS_D) incomplete_class_get_property, incomplete_class_set_property); - BG(incomplete_class) = zend_register_internal_class(&incomplete_class TSRMLS_CC); - - return (BG(incomplete_class)); + return zend_register_internal_class(&incomplete_class TSRMLS_CC); } /* }}} */ diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h index 7d294f519d..47d54b7b04 100644 --- a/ext/standard/php_incomplete_class.h +++ b/ext/standard/php_incomplete_class.h @@ -26,10 +26,6 @@ #define PHP_IC_ENTRY \ BG(incomplete_class) -#define PHP_IC_ENTRY_READ \ - (PHP_IC_ENTRY ? PHP_IC_ENTRY : php_create_incomplete_class(TSRMLS_C)) - - #define PHP_SET_CLASS_ATTRIBUTES(struc) \ /* OBJECTS_FIXME: Fix for new object model */ \ if (Z_OBJCE_P(struc) == BG(incomplete_class)) { \ diff --git a/ext/standard/var.c b/ext/standard/var.c index a47231f36f..66e9625f60 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -525,7 +525,7 @@ PHPAPI int php_var_unserialize(zval **rval, const char **p, const char *max, Has if (zend_hash_find(EG(class_table), class_name, i+1, (void **) &ce)==FAILURE) { incomplete_class = 1; - ce = PHP_IC_ENTRY_READ; + ce = PHP_IC_ENTRY; } } else { /* old php 3.0 data 'o' */ ce = &zend_standard_class_def; diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index 204f043201..36328879ee 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -836,7 +836,7 @@ static void php_wddx_pop_element(void *user_data, const char *name) if (zend_hash_find(EG(class_table), Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data)+1, (void **) &ce)==FAILURE) { incomplete_class = 1; - ce = PHP_IC_ENTRY_READ; + ce = PHP_IC_ENTRY; } /* Initialize target object */