cvs: ZendEngine2 / zend_execute_API.c

From: Date: Wed, 26 Jun 2002 15:13:14 +0000
Subject: cvs: ZendEngine2 / zend_execute_API.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-211@lists.php.net to get a copy of this message
andi Wed Jun 26 11:13:14 2002 EDT Modified files: /ZendEngine2 zend_execute_API.c Log: - Autoloading support based on patch from Ivan Ristic. - Again I hope this feature ends up working well because if it doesn't we - might need to nuke it. This only works for global scoped classes and it - will never work for sub-classes so don't even ask!!!!! - Just define an __autoload() function in the global scope and it will be - called with the class name as the parameter if it doesn't manage to find - the class. Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.164 ZendEngine2/zend_execute_API.c:1.165 --- ZendEngine2/zend_execute_API.c:1.164 Sun Jun 16 14:25:05 2002 +++ ZendEngine2/zend_execute_API.c Wed Jun 26 11:13:14 2002 @@ -639,9 +639,36 @@ ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC) { - return zend_hash_find(EG(class_table), name, name_length+1, (void **) ce); -} + zval **args[1]; + zval *autoload_function; + zval *class_name; + zval *retval_ptr; + int retval; + + if (zend_hash_find(EG(class_table), name, name_length+1, (void **) ce) == SUCCESS) { + return SUCCESS; + } + + MAKE_STD_ZVAL(autoload_function); + ZVAL_STRINGL(autoload_function, "__autoload", sizeof("__autoload")-1, 1); + + MAKE_STD_ZVAL(class_name); + ZVAL_STRINGL(class_name, name, name_length, 1); + args[0] = &class_name; + retval = call_user_function_ex(EG(function_table), NULL, autoload_function, &retval_ptr, 1, args, 0, NULL TSRMLS_CC); + + zval_ptr_dtor(&autoload_function); + zval_ptr_dtor(&class_name); + + if (retval == FAILURE) { + return FAILURE; + } + + zval_ptr_dtor(&retval_ptr); + + return zend_hash_find(EG(class_table), name, name_length + 1, (void **) ce); +} ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC) {

« previous php.zend-engine.cvs (#211) next »