Hi,

I've fixed all the issues I found in the original patch (attached).

However then I realized that speed-up was caused by bugs that leaded to render pages in improper way. After fix the speed-up disappear. :(

So now I don't see any reason to include it into 5.3.

Thanks. Dmitry.

Lukas Kahwe Smith wrote:

On 11.03.2009, at 17:10, Rasmus Lerdorf wrote:
Anyway, it's very good job and 20-30% speedup on some real-life
applications makes sense to include it into 5.3 (from my point of view).

Makes sense to me as well, especially since I don't see any drawbacks
for non-accelerated scripts.

I also think some of those applications that didn't show any gains could
be trivially modified to make use of it.  Moving from conditionally
loaded stuff to lazy-loaded is likely to speed things up.  Depending of
course on how granular the conditional loading is.


Can we get this patch to release quality by this weekend?
So that people can test it on Monday/Tuesday ahead of RC1?

regards,
Lukas Kahwe Smith
m...@pooteeweet.org



Index: Zend/zend.c
===================================================================
RCS file: /repository/ZendEngine2/zend.c,v
retrieving revision 1.308.2.12.2.35.2.29
diff -u -p -d -r1.308.2.12.2.35.2.29 zend.c
--- Zend/zend.c 18 Feb 2009 10:55:08 -0000      1.308.2.12.2.35.2.29
+++ Zend/zend.c 13 Mar 2009 13:46:07 -0000
@@ -550,6 +550,10 @@ static void executor_globals_ctor(zend_e
        EG(current_module) = NULL;
        EG(exit_status) = 0;
        EG(active) = 0;
+       EG(lookup_function_hook) = NULL;
+       EG(lookup_class_hook) = NULL;
+       EG(defined_function_hook) = NULL;
+       EG(declared_class_hook) = NULL;
 }
 /* }}} */
 
Index: Zend/zend_API.c
===================================================================
RCS file: /repository/ZendEngine2/zend_API.c,v
retrieving revision 1.296.2.27.2.34.2.60
diff -u -p -d -r1.296.2.27.2.34.2.60 zend_API.c
--- Zend/zend_API.c     14 Jan 2009 11:56:08 -0000      1.296.2.27.2.34.2.60
+++ Zend/zend_API.c     13 Mar 2009 13:46:07 -0000
@@ -2180,7 +2180,7 @@ ZEND_API zend_class_entry *zend_register
 
        if (!parent_ce && parent_name) {
                zend_class_entry **pce;
-               if (zend_hash_find(CG(class_table), parent_name, 
strlen(parent_name)+1, (void **) &pce)==FAILURE) {
+               if (zend_find_class(CG(class_table), parent_name, 
strlen(parent_name)+1, &pce TSRMLS_CC)==FAILURE) {
                        return NULL;
                } else {
                        parent_ce = *pce;
@@ -2228,14 +2228,20 @@ ZEND_API zend_class_entry *zend_register
 ZEND_API int zend_register_class_alias_ex(const char *name, int name_len, 
zend_class_entry *ce TSRMLS_DC) /* {{{ */
 {
        char *lcname = zend_str_tolower_dup(name, name_len);
-       int ret;
+       ulong hash = zend_inline_hash_func(lcname, name_len+1);
+       zend_class_entry **pce;
 
-       ret = zend_hash_add(CG(class_table), lcname, name_len+1, &ce, 
sizeof(zend_class_entry *), NULL);
-       efree(lcname);
-       if (ret == SUCCESS) {
-               ce->refcount++;
+       if((EG(lookup_class_hook) &&
+               /* Check if we have a same-name class already exsiting in our 
hook, then fail as we would normally below.
+                * This could happen if we have two classes with the same name, 
and one of them is being bound at run-time */
+           EG(lookup_class_hook)(lcname, name_len+1, hash, &pce) == SUCCESS) ||
+          zend_hash_quick_add(CG(class_table), lcname, name_len+1, hash, &ce, 
sizeof(zend_class_entry *), NULL) == FAILURE) {
+               efree(lcname);
+               return FAILURE;
        }
-       return ret;
+       efree(lcname);
+       ce->refcount++;
+       return SUCCESS;
 }
 /* }}} */
 
@@ -2412,7 +2418,7 @@ static int zend_is_callable_check_func(i
                }
                /* Check if function with given name exists.
                 * This may be a compound name that includes namespace name */
-               if (zend_hash_find(EG(function_table), lmname, mlen+1, 
(void**)&fcc->function_handler) == SUCCESS) {
+               if (zend_find_function(EG(function_table), lmname, mlen+1, 
&fcc->function_handler TSRMLS_CC) == SUCCESS) {
                        efree(lmname);
                        return 1;
                }
@@ -3552,6 +3558,86 @@ ZEND_API void zend_restore_error_handlin
 }
 /* }}} */
 
+ZEND_API int zend_quick_find_function(HashTable *function_table, const char 
*name, int len, zend_uint h, zend_function **fe TSRMLS_DC) /* {{{ */
+{
+       if (zend_hash_quick_find(function_table, name, len, h, (void**)fe) == 
SUCCESS) {
+               return SUCCESS;
+       } else if (EG(lookup_function_hook)) {
+               return EG(lookup_function_hook)(name, len, h, fe);
+       }
+       return FAILURE;
+}
+/* }}} */
+
+ZEND_API int zend_find_function(HashTable *function_table, const char *name, 
int len, zend_function **fe TSRMLS_DC) /* {{{ */
+{
+       ulong h = zend_inline_hash_func(name, len);
+
+       if (zend_hash_quick_find(function_table, name, len, h, (void**)fe) == 
SUCCESS) {
+               return SUCCESS;
+       } else if (EG(lookup_function_hook)) {
+               return EG(lookup_function_hook)(name, len, h, fe);
+       }
+       return FAILURE;
+}
+/* }}} */
+
+ZEND_API int zend_quick_find_class(HashTable *class_table, const char *name, 
int len, zend_uint h, zend_class_entry ***ce TSRMLS_DC) /* {{{ */
+{
+       if (zend_hash_quick_find(class_table, name, len, h, (void**)ce) == 
SUCCESS) {
+               return SUCCESS;
+       } else if (EG(lookup_class_hook)) {
+               return EG(lookup_class_hook)(name, len, h, ce);
+       }
+       return FAILURE;
+}
+/* }}} */
+
+ZEND_API int zend_find_class(HashTable *class_table, const char *name, int 
len, zend_class_entry ***ce TSRMLS_DC) /* {{{ */
+{
+       ulong h = zend_inline_hash_func(name, len);
+
+       if (zend_hash_quick_find(class_table, name, len, h, (void**)ce) == 
SUCCESS) {
+               return SUCCESS;
+       } else if (EG(lookup_class_hook)) {
+               return EG(lookup_class_hook)(name, len, h, ce);
+       }
+       return FAILURE;
+}
+/* }}} */
+
+ZEND_API zend_lookup_function_hook_t 
zend_set_lookup_function_hook(zend_lookup_function_hook_t new_hook TSRMLS_DC) { 
/* {{{ */
+       zend_lookup_function_hook_t old_hook;
+       old_hook = EG(lookup_function_hook);
+       EG(lookup_function_hook) = new_hook;
+       return old_hook;
+} 
+/* }}} */
+
+ZEND_API zend_defined_function_hook_t 
zend_set_defined_function_hook(zend_defined_function_hook_t new_hook TSRMLS_DC) 
{ /* {{{ */
+       zend_defined_function_hook_t old_hook;
+       old_hook = EG(defined_function_hook);
+       EG(defined_function_hook) = new_hook;
+       return old_hook;
+}
+/* }}} */
+
+ZEND_API zend_lookup_class_hook_t 
zend_set_lookup_class_hook(zend_lookup_class_hook_t new_hook TSRMLS_DC) { /* 
{{{ */
+       zend_lookup_class_hook_t old_hook;
+       old_hook = EG(lookup_class_hook);
+       EG(lookup_class_hook) = new_hook;
+       return old_hook;
+}
+/* }}} */
+
+ZEND_API zend_declared_class_hook_t 
zend_set_declared_class_hook(zend_declared_class_hook_t new_hook TSRMLS_DC) { 
/* {{{ */
+       zend_declared_class_hook_t old_hook;
+       old_hook = EG(declared_class_hook);
+       EG(declared_class_hook) = new_hook;
+       return old_hook;
+}
+/* }}} */
+
 /*
  * Local variables:
  * tab-width: 4
Index: Zend/zend_API.h
===================================================================
RCS file: /repository/ZendEngine2/zend_API.h,v
retrieving revision 1.207.2.8.2.8.2.24
diff -u -p -d -r1.207.2.8.2.8.2.24 zend_API.h
--- Zend/zend_API.h     31 Dec 2008 11:15:31 -0000      1.207.2.8.2.8.2.24
+++ Zend/zend_API.h     13 Mar 2009 13:46:07 -0000
@@ -322,6 +322,17 @@ ZEND_API zval *zend_read_static_property
 
 ZEND_API zend_class_entry *zend_get_class_entry(const zval *zobject TSRMLS_DC);
 ZEND_API int zend_get_object_classname(const zval *object, char **class_name, 
zend_uint *class_name_len TSRMLS_DC);
+
+ZEND_API int zend_quick_find_function(HashTable *function_table, const char 
*name, int len, zend_uint h, zend_function **fe TSRMLS_DC);
+ZEND_API int zend_find_function(HashTable *function_table, const char *name, 
int len, zend_function **fe TSRMLS_DC);
+ZEND_API int zend_quick_find_class(HashTable *class_table, const char *name, 
int len, zend_uint h, zend_class_entry ***ce TSRMLS_DC);
+ZEND_API int zend_find_class(HashTable *class_table, const char *name, int 
len, zend_class_entry ***ce TSRMLS_DC);
+
+ZEND_API zend_lookup_function_hook_t 
zend_set_lookup_function_hook(zend_lookup_function_hook_t new_hook TSRMLS_DC);
+ZEND_API zend_defined_function_hook_t 
zend_set_defined_function_hook(zend_defined_function_hook_t new_hook TSRMLS_DC);
+ZEND_API zend_lookup_class_hook_t 
zend_set_lookup_class_hook(zend_lookup_class_hook_t new_hook TSRMLS_DC);
+ZEND_API zend_declared_class_hook_t 
zend_set_declared_class_hook(zend_declared_class_hook_t new_hook TSRMLS_DC);
+
 ZEND_API char *zend_get_type_by_const(int type);
 
 #define getThis() (this_ptr)
Index: Zend/zend_builtin_functions.c
===================================================================
RCS file: /repository/ZendEngine2/zend_builtin_functions.c,v
retrieving revision 1.277.2.12.2.25.2.46
diff -u -p -d -r1.277.2.12.2.25.2.46 zend_builtin_functions.c
--- Zend/zend_builtin_functions.c       8 Mar 2009 17:28:38 -0000       
1.277.2.12.2.25.2.46
+++ Zend/zend_builtin_functions.c       13 Mar 2009 13:46:07 -0000
@@ -1199,7 +1199,7 @@ ZEND_FUNCTION(class_exists)
                        len--;
                }
        
-               found = zend_hash_find(EG(class_table), name, len+1, (void **) 
&ce);
+               found = zend_find_class(EG(class_table), name, len+1, &ce 
TSRMLS_CC);
                free_alloca(lc_name, use_heap);
                RETURN_BOOL(found == SUCCESS && !((*ce)->ce_flags & 
ZEND_ACC_INTERFACE));
        }
@@ -1242,7 +1242,7 @@ ZEND_FUNCTION(interface_exists)
                        len--;
                }
 
-               found = zend_hash_find(EG(class_table), name, len+1, (void **) 
&ce);
+               found = zend_find_class(EG(class_table), name, len+1, &ce 
TSRMLS_CC);
                free_alloca(lc_name, use_heap);
                RETURN_BOOL(found == SUCCESS && (*ce)->ce_flags & 
ZEND_ACC_INTERFACE);
        }
@@ -1279,7 +1279,7 @@ ZEND_FUNCTION(function_exists)
                name_len--;
        }
 
-       retval = (zend_hash_find(EG(function_table), name, name_len+1, (void 
**)&func) == SUCCESS);
+       retval = (zend_find_function(EG(function_table), name, name_len+1, 
&func TSRMLS_CC) == SUCCESS);
        
        efree(lcname);
 
@@ -1315,7 +1315,7 @@ ZEND_FUNCTION(class_alias)
                lc_name = do_alloca(class_name_len + 1, use_heap);
                zend_str_tolower_copy(lc_name, class_name, class_name_len);
        
-               found = zend_hash_find(EG(class_table), lc_name, 
class_name_len+1, (void **) &ce);
+               found = zend_find_class(EG(class_table), lc_name, 
class_name_len+1, &ce TSRMLS_CC);
                free_alloca(lc_name, use_heap);
        } else {
                found = zend_lookup_class(class_name, class_name_len, &ce 
TSRMLS_CC);
@@ -1579,6 +1579,7 @@ ZEND_FUNCTION(get_declared_classes)
 
        array_init(return_value);
        zend_hash_apply_with_arguments(EG(class_table) TSRMLS_CC, 
(apply_func_args_t) copy_class_or_interface_name, 3, return_value, mask, 
comply);
+       if (EG(declared_class_hook)) EG(declared_class_hook)(return_value, 
mask, comply);
 }
 /* }}} */
 
@@ -1595,6 +1596,7 @@ ZEND_FUNCTION(get_declared_interfaces)
 
        array_init(return_value);
        zend_hash_apply_with_arguments(EG(class_table) TSRMLS_CC, 
(apply_func_args_t) copy_class_or_interface_name, 3, return_value, mask, 
comply);
+       if (EG(declared_class_hook)) EG(declared_class_hook)(return_value, 
mask, comply);
 }
 /* }}} */
 
@@ -1637,6 +1639,7 @@ ZEND_FUNCTION(get_defined_functions)
        array_init(return_value);
 
        zend_hash_apply_with_arguments(EG(function_table) TSRMLS_CC, 
(apply_func_args_t) copy_function_name, 2, internal, user);
+       if (EG(defined_function_hook)) EG(defined_function_hook)(internal, 
user);
 
        if (zend_hash_add(Z_ARRVAL_P(return_value), "internal", 
sizeof("internal"), (void **)&internal, sizeof(zval *), NULL) == FAILURE) {
                zval_ptr_dtor(&internal);
@@ -1696,7 +1699,7 @@ ZEND_FUNCTION(create_function)
        if (retval==SUCCESS) {
                zend_function new_function, *func;
 
-               if (zend_hash_find(EG(function_table), LAMBDA_TEMP_FUNCNAME, 
sizeof(LAMBDA_TEMP_FUNCNAME), (void **) &func)==FAILURE) {
+               if (zend_find_function(EG(function_table), 
LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME), &func TSRMLS_CC)==FAILURE) {
                        zend_error(E_ERROR, "Unexpected inconsistency in 
create_function()");
                        RETURN_FALSE;
                }
Index: Zend/zend_compile.c
===================================================================
RCS file: /repository/ZendEngine2/zend_compile.c,v
retrieving revision 1.647.2.27.2.41.2.103
diff -u -p -d -r1.647.2.27.2.41.2.103 zend_compile.c
--- Zend/zend_compile.c 10 Mar 2009 10:01:44 -0000      1.647.2.27.2.41.2.103
+++ Zend/zend_compile.c 13 Mar 2009 13:46:08 -0000
@@ -1556,7 +1556,7 @@ int zend_do_begin_function_call(znode *f
        } 
 
        lcname = zend_str_tolower_dup(function_name->u.constant.value.str.val, 
function_name->u.constant.value.str.len);
-       if ((zend_hash_find(CG(function_table), lcname, 
function_name->u.constant.value.str.len+1, (void **) &function)==FAILURE) ||
+       if ((zend_hash_find(CG(function_table), lcname, 
function_name->u.constant.value.str.len+1, (void**)&function)==FAILURE) ||
                ((CG(compiler_options) & 
ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS) &&
                (function->type == ZEND_INTERNAL_FUNCTION))) {
                        zend_do_begin_dynamic_function_call(function_name, 0 
TSRMLS_CC);
@@ -2890,17 +2890,27 @@ ZEND_API void zend_do_implement_interfac
 ZEND_API int do_bind_function(zend_op *opline, HashTable *function_table, 
zend_bool compile_time)
 {
        zend_function *function;
+       ulong hash;
+       TSRMLS_FETCH();
 
        if (opline->opcode != ZEND_DECLARE_FUNCTION) {
                zend_error(E_COMPILE_ERROR, "Internal compiler error.  Please 
report!");
        }
 
-       zend_hash_find(function_table, opline->op1.u.constant.value.str.val, 
opline->op1.u.constant.value.str.len, (void *) &function);
-       if (zend_hash_add(function_table, opline->op2.u.constant.value.str.val, 
opline->op2.u.constant.value.str.len+1, function, sizeof(zend_function), 
NULL)==FAILURE) {
+       if (zend_find_function(function_table, 
opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, 
&function TSRMLS_CC) == FAILURE) {
+               zend_error(E_COMPILE_ERROR, "Internal Zend error - Missing 
function information for %s", opline->op1.u.constant.value.str.val);
+               return NULL;
+       }
+       hash = zend_inline_hash_func(opline->op2.u.constant.value.str.val, 
opline->op2.u.constant.value.str.len+1);
+       if((EG(lookup_function_hook) &&
+               /* Check if we have a same-name function already exsiting in 
our hook, then fail as we would normally below.
+                * This could happen if we have two functions with the same 
name, and one of them is being bound at run-time */
+           EG(lookup_function_hook)(opline->op2.u.constant.value.str.val, 
opline->op2.u.constant.value.str.len+1, hash, &function) == SUCCESS) ||
+          zend_hash_quick_add(function_table, 
opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, 
hash, function, sizeof(zend_function), NULL)==FAILURE) {
                int error_level = compile_time ? E_COMPILE_ERROR : E_ERROR;
                zend_function *function;
 
-               if (zend_hash_find(function_table, 
opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, 
(void *) &function)==SUCCESS
+               if (zend_hash_quick_find(function_table, 
opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, 
hash, (void *) &function)==SUCCESS
                        && function->type==ZEND_USER_FUNCTION
                        && ((zend_op_array *) function)->last>0) {
                        zend_error(error_level, "Cannot redeclare %s() 
(previously declared in %s:%d)",
@@ -2922,15 +2932,20 @@ ZEND_API int do_bind_function(zend_op *o
 ZEND_API zend_class_entry *do_bind_class(const zend_op *opline, HashTable 
*class_table, zend_bool compile_time TSRMLS_DC)
 {
        zend_class_entry *ce, **pce;
+       ulong hash = 
zend_inline_hash_func(opline->op1.u.constant.value.str.val, 
opline->op1.u.constant.value.str.len);
 
-       if (zend_hash_find(class_table, opline->op1.u.constant.value.str.val, 
opline->op1.u.constant.value.str.len, (void **) &pce)==FAILURE) {
+       if (zend_find_class(class_table, opline->op1.u.constant.value.str.val, 
opline->op1.u.constant.value.str.len, &pce TSRMLS_CC)==FAILURE) {
                zend_error(E_COMPILE_ERROR, "Internal Zend error - Missing 
class information for %s", opline->op1.u.constant.value.str.val);
                return NULL;
-       } else {
-               ce = *pce;
        }
+       ce = *pce;
        ce->refcount++;
-       if (zend_hash_add(class_table, opline->op2.u.constant.value.str.val, 
opline->op2.u.constant.value.str.len+1, &ce, sizeof(zend_class_entry *), 
NULL)==FAILURE) {
+       hash = zend_inline_hash_func(opline->op2.u.constant.value.str.val, 
opline->op2.u.constant.value.str.len+1);
+       if((EG(lookup_class_hook) &&
+               /* Check if we have a same-name class already exsiting in our 
hook, then fail as we would normally below.
+                * This could happen if we have two classes with the same name, 
and one of them is being bound at run-time */
+           EG(lookup_class_hook)(opline->op2.u.constant.value.str.val, 
opline->op2.u.constant.value.str.len+1, hash, &pce) == SUCCESS) ||
+          zend_hash_quick_add(class_table, 
opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, 
hash, &ce, sizeof(zend_class_entry *), NULL)==FAILURE) {
                ce->refcount--;
                if (!compile_time) {
                        /* If we're in compile time, in practice, it's quite 
possible
@@ -2953,11 +2968,9 @@ ZEND_API zend_class_entry *do_bind_class
 ZEND_API zend_class_entry *do_bind_inherited_class(const zend_op *opline, 
HashTable *class_table, zend_class_entry *parent_ce, zend_bool compile_time 
TSRMLS_DC)
 {
        zend_class_entry *ce, **pce;
-       int found_ce;
-
-       found_ce = zend_hash_find(class_table, 
opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, 
(void **) &pce);
+       ulong hash;
 
-       if (found_ce == FAILURE) {
+       if (zend_find_class(class_table, opline->op1.u.constant.value.str.val, 
opline->op1.u.constant.value.str.len, &pce TSRMLS_CC) == FAILURE) {
                if (!compile_time) {
                        /* If we're in compile time, in practice, it's quite 
possible
                         * that we'll never reach this class declaration at 
runtime,
@@ -2980,7 +2993,12 @@ ZEND_API zend_class_entry *do_bind_inher
        ce->refcount++;
 
        /* Register the derived class */
-       if (zend_hash_add(class_table, opline->op2.u.constant.value.str.val, 
opline->op2.u.constant.value.str.len+1, pce, sizeof(zend_class_entry *), 
NULL)==FAILURE) {
+       hash = zend_inline_hash_func(opline->op2.u.constant.value.str.val, 
opline->op2.u.constant.value.str.len+1);
+       if((EG(lookup_class_hook) &&
+               /* Check if we have a same-name class already exsiting in our 
hook, then fail as we would normally below.
+                * This could happen if we have two classes with the same name, 
and one of them is being bound at run-time */
+           EG(lookup_class_hook)(opline->op2.u.constant.value.str.val, 
opline->op2.u.constant.value.str.len+1, hash, &pce) == SUCCESS) ||
+          zend_hash_quick_add(class_table, 
opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, 
hash, pce, sizeof(zend_class_entry *), NULL)==FAILURE) {
                zend_error(E_COMPILE_ERROR, "Cannot redeclare class %s", 
ce->name);
                ce->refcount--;
                zend_hash_destroy(&ce->function_table);
@@ -5164,11 +5182,12 @@ void zend_do_use(znode *ns_name, znode *
        if (CG(current_namespace)) {
                /* Prefix import name with current namespace name to avoid 
conflicts with classes */
                char *ns_name = emalloc(Z_STRLEN_P(CG(current_namespace)) + 1 + 
Z_STRLEN_P(name) + 1);
+               zend_class_entry **dummy;
 
                zend_str_tolower_copy(ns_name, 
Z_STRVAL_P(CG(current_namespace)), Z_STRLEN_P(CG(current_namespace)));
                ns_name[Z_STRLEN_P(CG(current_namespace))] = '\\';
                memcpy(ns_name+Z_STRLEN_P(CG(current_namespace))+1, lcname, 
Z_STRLEN_P(name)+1);
-               if (zend_hash_exists(CG(class_table), ns_name, 
Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name)+1)) {
+               if (zend_find_class(CG(class_table), ns_name, 
Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name)+1, &dummy TSRMLS_CC) 
== SUCCESS) {
                        char *tmp = zend_str_tolower_dup(Z_STRVAL_P(ns), 
Z_STRLEN_P(ns));
 
                        if (Z_STRLEN_P(ns) != Z_STRLEN_P(CG(current_namespace)) 
+ 1 + Z_STRLEN_P(name) ||
@@ -5178,7 +5197,7 @@ void zend_do_use(znode *ns_name, znode *
                        efree(tmp);
                }
                efree(ns_name);
-       } else if (zend_hash_find(CG(class_table), lcname, Z_STRLEN_P(name)+1, 
(void**)&pce) == SUCCESS &&
+       } else if (zend_find_class(CG(class_table), lcname, Z_STRLEN_P(name)+1, 
&pce TSRMLS_CC) == SUCCESS &&
                   (*pce)->type == ZEND_USER_CLASS &&
                   (*pce)->filename == CG(compiled_filename)) {
                char *tmp = zend_str_tolower_dup(Z_STRVAL_P(ns), 
Z_STRLEN_P(ns));
Index: Zend/zend_execute_API.c
===================================================================
RCS file: /repository/ZendEngine2/zend_execute_API.c,v
retrieving revision 1.331.2.20.2.24.2.72
diff -u -p -d -r1.331.2.20.2.24.2.72 zend_execute_API.c
--- Zend/zend_execute_API.c     5 Mar 2009 16:49:47 -0000       
1.331.2.20.2.24.2.72
+++ Zend/zend_execute_API.c     13 Mar 2009 13:46:08 -0000
@@ -1014,6 +1014,7 @@ ZEND_API int zend_lookup_class_ex(const 
        zend_fcall_info fcall_info;
        zend_fcall_info_cache fcall_cache;
        char dummy = 1;
+       ulong hash;
        ALLOCA_FLAG(use_heap)
 
        if (name == NULL || !name_length) {
@@ -1029,7 +1030,8 @@ ZEND_API int zend_lookup_class_ex(const 
                lc_length -= 1;
        }
 
-       if (zend_hash_find(EG(class_table), lc_name, lc_length, (void **) ce) 
== SUCCESS) {
+       hash = zend_inline_hash_func(lc_name, lc_length);
+       if (zend_quick_find_class(EG(class_table), lc_name, lc_length, hash, ce 
TSRMLS_CC) == SUCCESS) {
                free_alloca(lc_free, use_heap);
                return SUCCESS;
        }
@@ -1047,7 +1049,7 @@ ZEND_API int zend_lookup_class_ex(const 
                zend_hash_init(EG(in_autoload), 0, NULL, NULL, 0);
        }
 
-       if (zend_hash_add(EG(in_autoload), lc_name, lc_length, (void**)&dummy, 
sizeof(char), NULL) == FAILURE) {
+       if (zend_hash_quick_add(EG(in_autoload), lc_name, lc_length, hash, 
(void**)&dummy, sizeof(char), NULL) == FAILURE) {
                free_alloca(lc_free, use_heap);
                return FAILURE;
        }
@@ -1095,8 +1097,9 @@ ZEND_API int zend_lookup_class_ex(const 
                return FAILURE;
        }
 
-       retval = zend_hash_find(EG(class_table), lc_name, lc_length, (void **) 
ce);
+       retval = zend_quick_find_class(EG(class_table), lc_name, lc_length, 
hash, ce TSRMLS_CC);
        free_alloca(lc_free, use_heap);
+
        return retval;
 }
 /* }}} */
Index: Zend/zend_globals.h
===================================================================
RCS file: /repository/ZendEngine2/zend_globals.h,v
retrieving revision 1.141.2.3.2.7.2.22
diff -u -p -d -r1.141.2.3.2.7.2.22 zend_globals.h
--- Zend/zend_globals.h 16 Jan 2009 00:57:43 -0000      1.141.2.3.2.7.2.22
+++ Zend/zend_globals.h 13 Mar 2009 13:46:08 -0000
@@ -160,6 +160,10 @@ struct _zend_compiler_globals {
 #endif
 };
 
+typedef int (*zend_lookup_function_hook_t)(const char *name, int len, ulong 
hash, zend_function** fe_pp);
+typedef int (*zend_lookup_class_hook_t)(const char* name, int len, ulong hash, 
zend_class_entry*** ce_pp);
+typedef int (*zend_defined_function_hook_t)(zval *internal, zval *user);
+typedef int (*zend_declared_class_hook_t)(zval *classes, zend_uint mask, 
zend_uint comply);
 
 struct _zend_executor_globals {
        zval **return_value_ptr_ptr;
@@ -254,6 +258,11 @@ struct _zend_executor_globals {
 
        zend_bool active; 
 
+       zend_lookup_function_hook_t     lookup_function_hook;
+       zend_defined_function_hook_t    defined_function_hook;
+       zend_lookup_class_hook_t                lookup_class_hook;
+       zend_declared_class_hook_t              declared_class_hook;
+
        void *reserved[ZEND_MAX_RESERVED_RESOURCES];
 };
 
Index: Zend/zend_vm_def.h
===================================================================
RCS file: /repository/ZendEngine2/zend_vm_def.h,v
retrieving revision 1.59.2.29.2.48.2.85
diff -u -p -d -r1.59.2.29.2.48.2.85 zend_vm_def.h
--- Zend/zend_vm_def.h  10 Mar 2009 10:01:44 -0000      1.59.2.29.2.48.2.85
+++ Zend/zend_vm_def.h  13 Mar 2009 13:46:08 -0000
@@ -2061,7 +2061,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_N
        zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), 
EX(called_scope));
 
        if (OP2_TYPE == IS_CONST) {
-               if (zend_hash_quick_find(EG(function_table), 
Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant)+1, 
opline->extended_value, (void **) &EX(fbc)) == FAILURE) {
+               if (zend_quick_find_function(EG(function_table), 
Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant)+1, 
opline->extended_value, &EX(fbc) TSRMLS_CC) == FAILURE) {
                        zend_error_noreturn(E_ERROR, "Call to undefined 
function %s()", Z_STRVAL(opline->op2.u.constant));
                }
        } else {
@@ -2089,7 +2089,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_N
                } else {
                        lcname = zend_str_tolower_dup(function_name_strval, 
function_name_strlen);
                }
-               if (zend_hash_find(EG(function_table), lcname, 
function_name_strlen+1, (void **) &EX(fbc)) == FAILURE) {
+               if (zend_find_function(EG(function_table), lcname, 
function_name_strlen+1, &EX(fbc) TSRMLS_CC) == FAILURE) {
                        zend_error_noreturn(E_ERROR, "Call to undefined 
function %s()", function_name_strval);
                }
                efree(lcname);
@@ -2109,9 +2109,9 @@ ZEND_VM_HANDLER(69, ZEND_INIT_NS_FCALL_B
        ZEND_VM_INC_OPCODE();
        zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), 
EX(called_scope));
 
-       if (zend_hash_quick_find(EG(function_table), 
Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant)+1, 
opline->extended_value, (void **) &EX(fbc))==FAILURE) {
+       if (zend_quick_find_function(EG(function_table), 
Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant)+1, 
opline->extended_value, &EX(fbc) TSRMLS_CC)==FAILURE) {
                char *short_name = 
Z_STRVAL(opline->op1.u.constant)+Z_LVAL(op_data->op1.u.constant);
-               if (zend_hash_quick_find(EG(function_table), short_name, 
Z_STRLEN(opline->op1.u.constant)-Z_LVAL(op_data->op1.u.constant)+1, 
op_data->extended_value, (void **) &EX(fbc))==FAILURE) {
+               if (zend_quick_find_function(EG(function_table), short_name, 
Z_STRLEN(opline->op1.u.constant)-Z_LVAL(op_data->op1.u.constant)+1, 
op_data->extended_value, &EX(fbc) TSRMLS_CC)==FAILURE) {
                        zend_error_noreturn(E_ERROR, "Call to undefined 
function %s()", Z_STRVAL(opline->op2.u.constant));
                }
        }
@@ -2408,7 +2408,7 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, CONST
 
        zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), 
EX(called_scope));
 
-       if (zend_hash_quick_find(EG(function_table), fname->value.str.val, 
fname->value.str.len+1, Z_LVAL(opline->op2.u.constant), (void **) 
&EX(function_state).function)==FAILURE) {
+       if (zend_quick_find_function(EG(function_table), fname->value.str.val, 
fname->value.str.len+1, Z_LVAL(opline->op2.u.constant), 
&EX(function_state).function TSRMLS_CC)==FAILURE) {
                zend_error_noreturn(E_ERROR, "Call to undefined function %s()", 
fname->value.str.val);
        }
        EX(object) = NULL;
@@ -4169,8 +4169,8 @@ ZEND_VM_HANDLER(145, ZEND_DECLARE_INHERI
        zend_op *opline = EX(opline);
        zend_class_entry **pce, **pce_orig;
 
-       if (zend_hash_find(EG(class_table), Z_STRVAL(opline->op2.u.constant), 
Z_STRLEN(opline->op2.u.constant)+1, (void**)&pce) == FAILURE ||
-           (zend_hash_find(EG(class_table), Z_STRVAL(opline->op1.u.constant), 
Z_STRLEN(opline->op1.u.constant), (void**)&pce_orig) == SUCCESS &&
+       if (zend_find_class(EG(class_table), Z_STRVAL(opline->op2.u.constant), 
Z_STRLEN(opline->op2.u.constant)+1, &pce TSRMLS_CC) == FAILURE ||
+           (zend_find_class(EG(class_table), Z_STRVAL(opline->op1.u.constant), 
Z_STRLEN(opline->op1.u.constant), &pce_orig TSRMLS_CC) == SUCCESS &&
             *pce != *pce_orig)) {
                do_bind_inherited_class(opline, EG(class_table), 
EX_T(opline->extended_value).class_entry, 0 TSRMLS_CC);
        }
@@ -4385,7 +4385,7 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA
        zend_op *opline = EX(opline);
        zend_function *op_array;
 
-       if (zend_hash_quick_find(EG(function_table), 
Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), 
Z_LVAL(opline->op2.u.constant), (void *) &op_array) == FAILURE ||
+       if (zend_quick_find_function(EG(function_table), 
Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), 
Z_LVAL(opline->op2.u.constant), &op_array TSRMLS_CC) == FAILURE ||
            op_array->type != ZEND_USER_FUNCTION) {
                zend_error_noreturn(E_ERROR, "Base lambda function for closure 
not found");
        }
Index: Zend/zend_vm_execute.h
===================================================================
RCS file: /repository/ZendEngine2/zend_vm_execute.h,v
retrieving revision 1.62.2.30.2.49.2.85
diff -u -p -d -r1.62.2.30.2.49.2.85 zend_vm_execute.h
--- Zend/zend_vm_execute.h      10 Mar 2009 10:01:44 -0000      
1.62.2.30.2.49.2.85
+++ Zend/zend_vm_execute.h      13 Mar 2009 13:46:09 -0000
@@ -570,8 +570,8 @@ static int ZEND_FASTCALL  ZEND_DECLARE_I
        zend_op *opline = EX(opline);
        zend_class_entry **pce, **pce_orig;
 
-       if (zend_hash_find(EG(class_table), Z_STRVAL(opline->op2.u.constant), 
Z_STRLEN(opline->op2.u.constant)+1, (void**)&pce) == FAILURE ||
-           (zend_hash_find(EG(class_table), Z_STRVAL(opline->op1.u.constant), 
Z_STRLEN(opline->op1.u.constant), (void**)&pce_orig) == SUCCESS &&
+       if (zend_find_class(EG(class_table), Z_STRVAL(opline->op2.u.constant), 
Z_STRLEN(opline->op2.u.constant)+1, &pce TSRMLS_CC) == FAILURE ||
+           (zend_find_class(EG(class_table), Z_STRVAL(opline->op1.u.constant), 
Z_STRLEN(opline->op1.u.constant), &pce_orig TSRMLS_CC) == SUCCESS &&
             *pce != *pce_orig)) {
                do_bind_inherited_class(opline, EG(class_table), 
EX_T(opline->extended_value).class_entry, 0 TSRMLS_CC);
        }
@@ -741,7 +741,7 @@ static int ZEND_FASTCALL  ZEND_INIT_FCAL
        zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), 
EX(called_scope));
 
        if (IS_CONST == IS_CONST) {
-               if (zend_hash_quick_find(EG(function_table), 
Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant)+1, 
opline->extended_value, (void **) &EX(fbc)) == FAILURE) {
+               if (zend_quick_find_function(EG(function_table), 
Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant)+1, 
opline->extended_value, &EX(fbc) TSRMLS_CC) == FAILURE) {
                        zend_error_noreturn(E_ERROR, "Call to undefined 
function %s()", Z_STRVAL(opline->op2.u.constant));
                }
        } else {
@@ -769,7 +769,7 @@ static int ZEND_FASTCALL  ZEND_INIT_FCAL
                } else {
                        lcname = zend_str_tolower_dup(function_name_strval, 
function_name_strlen);
                }
-               if (zend_hash_find(EG(function_table), lcname, 
function_name_strlen+1, (void **) &EX(fbc)) == FAILURE) {
+               if (zend_find_function(EG(function_table), lcname, 
function_name_strlen+1, &EX(fbc) TSRMLS_CC) == FAILURE) {
                        zend_error_noreturn(E_ERROR, "Call to undefined 
function %s()", function_name_strval);
                }
                efree(lcname);
@@ -789,9 +789,9 @@ static int ZEND_FASTCALL  ZEND_INIT_NS_F
        ZEND_VM_INC_OPCODE();
        zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), 
EX(called_scope));
 
-       if (zend_hash_quick_find(EG(function_table), 
Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant)+1, 
opline->extended_value, (void **) &EX(fbc))==FAILURE) {
+       if (zend_quick_find_function(EG(function_table), 
Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant)+1, 
opline->extended_value, &EX(fbc) TSRMLS_CC)==FAILURE) {
                char *short_name = 
Z_STRVAL(opline->op1.u.constant)+Z_LVAL(op_data->op1.u.constant);
-               if (zend_hash_quick_find(EG(function_table), short_name, 
Z_STRLEN(opline->op1.u.constant)-Z_LVAL(op_data->op1.u.constant)+1, 
op_data->extended_value, (void **) &EX(fbc))==FAILURE) {
+               if (zend_quick_find_function(EG(function_table), short_name, 
Z_STRLEN(opline->op1.u.constant)-Z_LVAL(op_data->op1.u.constant)+1, 
op_data->extended_value, &EX(fbc) TSRMLS_CC)==FAILURE) {
                        zend_error_noreturn(E_ERROR, "Call to undefined 
function %s()", Z_STRVAL(opline->op2.u.constant));
                }
        }
@@ -938,7 +938,7 @@ static int ZEND_FASTCALL  ZEND_INIT_FCAL
        zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), 
EX(called_scope));
 
        if (IS_TMP_VAR == IS_CONST) {
-               if (zend_hash_quick_find(EG(function_table), 
Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant)+1, 
opline->extended_value, (void **) &EX(fbc)) == FAILURE) {
+               if (zend_quick_find_function(EG(function_table), 
Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant)+1, 
opline->extended_value, &EX(fbc) TSRMLS_CC) == FAILURE) {
                        zend_error_noreturn(E_ERROR, "Call to undefined 
function %s()", Z_STRVAL(opline->op2.u.constant));
                }
        } else {
@@ -966,7 +966,7 @@ static int ZEND_FASTCALL  ZEND_INIT_FCAL
                } else {
                        lcname = zend_str_tolower_dup(function_name_strval, 
function_name_strlen);
                }
-               if (zend_hash_find(EG(function_table), lcname, 
function_name_strlen+1, (void **) &EX(fbc)) == FAILURE) {
+               if (zend_find_function(EG(function_table), lcname, 
function_name_strlen+1, &EX(fbc) TSRMLS_CC) == FAILURE) {
                        zend_error_noreturn(E_ERROR, "Call to undefined 
function %s()", function_name_strval);
                }
                efree(lcname);
@@ -1043,7 +1043,7 @@ static int ZEND_FASTCALL  ZEND_INIT_FCAL
        zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), 
EX(called_scope));
 
        if (IS_VAR == IS_CONST) {
-               if (zend_hash_quick_find(EG(function_table), 
Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant)+1, 
opline->extended_value, (void **) &EX(fbc)) == FAILURE) {
+               if (zend_quick_find_function(EG(function_table), 
Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant)+1, 
opline->extended_value, &EX(fbc) TSRMLS_CC) == FAILURE) {
                        zend_error_noreturn(E_ERROR, "Call to undefined 
function %s()", Z_STRVAL(opline->op2.u.constant));
                }
        } else {
@@ -1071,7 +1071,7 @@ static int ZEND_FASTCALL  ZEND_INIT_FCAL
                } else {
                        lcname = zend_str_tolower_dup(function_name_strval, 
function_name_strlen);
                }
-               if (zend_hash_find(EG(function_table), lcname, 
function_name_strlen+1, (void **) &EX(fbc)) == FAILURE) {
+               if (zend_find_function(EG(function_table), lcname, 
function_name_strlen+1, &EX(fbc) TSRMLS_CC) == FAILURE) {
                        zend_error_noreturn(E_ERROR, "Call to undefined 
function %s()", function_name_strval);
                }
                efree(lcname);
@@ -1176,7 +1176,7 @@ static int ZEND_FASTCALL  ZEND_INIT_FCAL
        zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), 
EX(called_scope));
 
        if (IS_CV == IS_CONST) {
-               if (zend_hash_quick_find(EG(function_table), 
Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant)+1, 
opline->extended_value, (void **) &EX(fbc)) == FAILURE) {
+               if (zend_quick_find_function(EG(function_table), 
Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant)+1, 
opline->extended_value, &EX(fbc) TSRMLS_CC) == FAILURE) {
                        zend_error_noreturn(E_ERROR, "Call to undefined 
function %s()", Z_STRVAL(opline->op2.u.constant));
                }
        } else {
@@ -1204,7 +1204,7 @@ static int ZEND_FASTCALL  ZEND_INIT_FCAL
                } else {
                        lcname = zend_str_tolower_dup(function_name_strval, 
function_name_strlen);
                }
-               if (zend_hash_find(EG(function_table), lcname, 
function_name_strlen+1, (void **) &EX(fbc)) == FAILURE) {
+               if (zend_find_function(EG(function_table), lcname, 
function_name_strlen+1, &EX(fbc) TSRMLS_CC) == FAILURE) {
                        zend_error_noreturn(E_ERROR, "Call to undefined 
function %s()", function_name_strval);
                }
                efree(lcname);
@@ -1556,7 +1556,7 @@ static int ZEND_FASTCALL  ZEND_DO_FCALL_
 
        zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), 
EX(called_scope));
 
-       if (zend_hash_quick_find(EG(function_table), fname->value.str.val, 
fname->value.str.len+1, Z_LVAL(opline->op2.u.constant), (void **) 
&EX(function_state).function)==FAILURE) {
+       if (zend_quick_find_function(EG(function_table), fname->value.str.val, 
fname->value.str.len+1, Z_LVAL(opline->op2.u.constant), 
&EX(function_state).function TSRMLS_CC)==FAILURE) {
                zend_error_noreturn(E_ERROR, "Call to undefined function %s()", 
fname->value.str.val);
        }
        EX(object) = NULL;
@@ -2904,7 +2904,7 @@ static int ZEND_FASTCALL  ZEND_DECLARE_L
        zend_op *opline = EX(opline);
        zend_function *op_array;
 
-       if (zend_hash_quick_find(EG(function_table), 
Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), 
Z_LVAL(opline->op2.u.constant), (void *) &op_array) == FAILURE ||
+       if (zend_quick_find_function(EG(function_table), 
Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), 
Z_LVAL(opline->op2.u.constant), &op_array TSRMLS_CC) == FAILURE ||
            op_array->type != ZEND_USER_FUNCTION) {
                zend_error_noreturn(E_ERROR, "Base lambda function for closure 
not found");
        }
Index: ext/pdo/pdo_stmt.c
===================================================================
RCS file: /repository/php-src/ext/pdo/pdo_stmt.c,v
retrieving revision 1.118.2.38.2.24.2.42
diff -u -p -d -r1.118.2.38.2.24.2.42 pdo_stmt.c
--- ext/pdo/pdo_stmt.c  31 Dec 2008 11:15:40 -0000      1.118.2.38.2.24.2.42
+++ ext/pdo/pdo_stmt.c  13 Mar 2009 13:46:11 -0000
@@ -856,10 +856,18 @@ static int make_callable_ex(pdo_stmt_t *
        }
 
        zend_str_tolower_copy(fname, fname, strlen(fname));
-       fci->function_table = ce ? &ce->function_table : EG(function_table);
-       if (zend_hash_find(fci->function_table, fname, strlen(fname)+1, (void 
**)&function_handler) == FAILURE) {
-               pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied 
function does not exist" TSRMLS_CC);
-               return 0;
+       if (ce) {
+               fci->function_table = &ce->function_table;
+               if (zend_hash_find(fci->function_table, fname, strlen(fname)+1, 
(void **)&function_handler) == FAILURE) {
+                       pdo_raise_impl_error(stmt->dbh, stmt, "HY000", 
"user-supplied function does not exist" TSRMLS_CC);
+                       return 0;
+               }
+       } else {
+               fci->function_table = EG(function_table);
+               if (zend_find_function(fci->function_table, fname, 
strlen(fname)+1, &function_handler TSRMLS_CC) == FAILURE) {
+                       pdo_raise_impl_error(stmt->dbh, stmt, "HY000", 
"user-supplied function does not exist" TSRMLS_CC);
+                       return 0;
+               }
        }
        efree(cname ? cname : fname);
 
Index: ext/reflection/php_reflection.c
===================================================================
RCS file: /repository/php-src/ext/reflection/php_reflection.c,v
retrieving revision 1.164.2.33.2.45.2.53
diff -u -p -d -r1.164.2.33.2.45.2.53 php_reflection.c
--- ext/reflection/php_reflection.c     1 Feb 2009 15:06:19 -0000       
1.164.2.33.2.45.2.53
+++ ext/reflection/php_reflection.c     13 Mar 2009 13:46:11 -0000
@@ -1076,7 +1076,7 @@ static void _extension_string(string *st
 
                /* Is there a better way of doing this? */
                while (func->fname) {
-                       if (zend_hash_find(EG(function_table), func->fname, 
strlen(func->fname) + 1, (void**) &fptr) == FAILURE) {
+                       if (zend_find_function(EG(function_table), func->fname, 
strlen(func->fname) + 1, &fptr TSRMLS_CC) == FAILURE) {
                                zend_error(E_WARNING, "Internal error: Cannot 
find extension function %s in global function table", func->fname);
                                func++;
                                continue;
@@ -1513,7 +1513,7 @@ ZEND_METHOD(reflection_function, __const
                Z_ADDREF_P(closure);
        } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", 
&name_str, &name_len) == SUCCESS) {
                lcname = zend_str_tolower_dup(name_str, name_len);
-               if (zend_hash_find(EG(function_table), lcname, name_len + 1, 
(void **)&fptr) == FAILURE) {
+               if (zend_find_function(EG(function_table), lcname, name_len + 
1, &fptr TSRMLS_CC) == FAILURE) {
                        efree(lcname);
                        zend_throw_exception_ex(reflection_exception_ptr, 0 
TSRMLS_CC, 
                                "Function %s() does not exist", name_str);
@@ -1989,7 +1989,7 @@ ZEND_METHOD(reflection_parameter, __cons
 
                                lcname_len = Z_STRLEN_P(reference);
                                lcname = 
zend_str_tolower_dup(Z_STRVAL_P(reference), lcname_len);
-                               if (zend_hash_find(EG(function_table), lcname, 
lcname_len + 1, (void**) &fptr) == FAILURE) {
+                               if (zend_find_function(EG(function_table), 
lcname, lcname_len + 1, &fptr TSRMLS_CC) == FAILURE) {
                                        efree(lcname);
                                        
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                                                "Function %s() does not exist", 
Z_STRVAL_P(reference));
@@ -4759,7 +4759,7 @@ ZEND_METHOD(reflection_extension, getFun
 
                /* Is there a better way of doing this? */
                while (func->fname) {
-                       if (zend_hash_find(EG(function_table), func->fname, 
strlen(func->fname) + 1, (void**) &fptr) == FAILURE) {
+                       if (zend_find_function(EG(function_table), func->fname, 
strlen(func->fname) + 1, &fptr TSRMLS_CC) == FAILURE) {
                                zend_error(E_WARNING, "Internal error: Cannot 
find extension function %s in global function table", func->fname);
                                func++;
                                continue;
Index: ext/soap/soap.c
===================================================================
RCS file: /repository/php-src/ext/soap/soap.c,v
retrieving revision 1.156.2.28.2.30.2.32
diff -u -p -d -r1.156.2.28.2.30.2.32 soap.c
--- ext/soap/soap.c     18 Feb 2009 13:25:48 -0000      1.156.2.28.2.30.2.32
+++ ext/soap/soap.c     13 Mar 2009 13:46:12 -0000
@@ -1364,7 +1364,7 @@ PHP_METHOD(SoapServer, setClass)
        found = zend_lookup_class(classname, classname_len, &ce TSRMLS_CC);
 #else
        char *class_name = estrdup(classname);
-       found = zend_hash_find(EG(class_table), php_strtolower(class_name, 
classname_len), classname_len + 1, (void **)&ce);
+       found = zend_find_class(EG(class_table), php_strtolower(class_name, 
classname_len), classname_len + 1, &ce TSRMLS_CC);
        efree(class_name);
 #endif
        if (found != FAILURE) {
@@ -1517,7 +1517,7 @@ PHP_METHOD(SoapServer, addFunction)
                                key = emalloc(key_len + 1);
                                zend_str_tolower_copy(key, 
Z_STRVAL_PP(tmp_function), key_len);
 
-                               if (zend_hash_find(EG(function_table), key, 
key_len+1, (void**)&f) == FAILURE) {
+                               if (zend_find_function(EG(function_table), key, 
key_len+1, &f TSRMLS_CC) == FAILURE) {
                                        php_error_docref(NULL TSRMLS_CC, 
E_WARNING, "Tried to add a non existant function '%s'", 
Z_STRVAL_PP(tmp_function));
                                        return;
                                }
@@ -1539,7 +1539,7 @@ PHP_METHOD(SoapServer, addFunction)
                key = emalloc(key_len + 1);
                zend_str_tolower_copy(key, Z_STRVAL_P(function_name), key_len);
 
-               if (zend_hash_find(EG(function_table), key, key_len+1, 
(void**)&f) == FAILURE) {
+               if (zend_find_function(EG(function_table), key, key_len+1, &f 
TSRMLS_CC) == FAILURE) {
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to 
add a non existant function '%s'", Z_STRVAL_P(function_name));
                        return;
                }
@@ -1592,6 +1592,7 @@ PHP_METHOD(SoapServer, handle)
        xmlCharEncodingHandlerPtr old_encoding;
        HashTable *old_class_map, *old_typemap;
        int old_features;
+       zend_function *dummy;
 
        SOAP_SERVER_BEGIN_CODE();
 
@@ -1871,6 +1872,7 @@ PHP_METHOD(SoapServer, handle)
        /* Process soap headers */
        if (soap_headers != NULL) {
                soapHeader *header = soap_headers;
+
                while (header != NULL) {
                        soapHeader *h = header;
 
@@ -1884,7 +1886,9 @@ PHP_METHOD(SoapServer, handle)
                        }
 
                        fn_name = 
estrndup(Z_STRVAL(h->function_name),Z_STRLEN(h->function_name));
-                       if (zend_hash_exists(function_table, 
php_strtolower(fn_name, Z_STRLEN(h->function_name)), Z_STRLEN(h->function_name) 
+ 1) ||
+                       if ((function_table == EG(function_table) &&
+                            zend_find_function(function_table, 
php_strtolower(fn_name, Z_STRLEN(h->function_name)), Z_STRLEN(h->function_name) 
+ 1, &dummy TSRMLS_CC)) || 
+                           zend_hash_exists(function_table, 
php_strtolower(fn_name, Z_STRLEN(h->function_name)), Z_STRLEN(h->function_name) 
+ 1) ||
                            ((service->type == SOAP_CLASS || service->type == 
SOAP_OBJECT) &&
                             zend_hash_exists(function_table, 
ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)))) {
                                if (service->type == SOAP_CLASS || 
service->type == SOAP_OBJECT) {
@@ -1935,7 +1939,9 @@ PHP_METHOD(SoapServer, handle)
        }
 
        fn_name = estrndup(Z_STRVAL(function_name),Z_STRLEN(function_name));
-       if (zend_hash_exists(function_table, php_strtolower(fn_name, 
Z_STRLEN(function_name)), Z_STRLEN(function_name) + 1) ||
+       if ((function_table == EG(function_table) &&
+            zend_find_function(function_table, php_strtolower(fn_name, 
Z_STRLEN(function_name)), Z_STRLEN(function_name) + 1, &dummy TSRMLS_CC) == 
SUCCESS) ||
+           zend_hash_exists(function_table, php_strtolower(fn_name, 
Z_STRLEN(function_name)), Z_STRLEN(function_name) + 1) ||
            ((service->type == SOAP_CLASS || service->type == SOAP_OBJECT) &&
             zend_hash_exists(function_table, ZEND_CALL_FUNC_NAME, 
sizeof(ZEND_CALL_FUNC_NAME)))) {
                if (service->type == SOAP_CLASS || service->type == 
SOAP_OBJECT) {
Index: ext/spl/php_spl.c
===================================================================
RCS file: /repository/php-src/ext/spl/php_spl.c,v
retrieving revision 1.52.2.28.2.17.2.35
diff -u -p -d -r1.52.2.28.2.17.2.35 php_spl.c
--- ext/spl/php_spl.c   26 Jan 2009 11:38:03 -0000      1.52.2.28.2.17.2.35
+++ ext/spl/php_spl.c   13 Mar 2009 13:46:12 -0000
@@ -74,7 +74,7 @@ static zend_class_entry * spl_find_ce_by
                lc_name = do_alloca(len + 1, use_heap);
                zend_str_tolower_copy(lc_name, name, len);
 
-               found = zend_hash_find(EG(class_table), lc_name, len +1, (void 
**) &ce);
+               found = zend_find_class(EG(class_table), lc_name, len +1, &ce 
TSRMLS_CC);
                free_alloca(lc_name, use_heap);
        } else {
                found = zend_lookup_class(name, len, &ce TSRMLS_CC);
@@ -228,6 +228,7 @@ static int spl_autoload(const char *clas
        zend_op_array *new_op_array;
        zval *result = NULL;
        int ret;
+       zend_class_entry **dummy_pce;
 
        class_file_len = spprintf(&class_file, 0, "%s%s", lc_name, 
file_extension);
 
@@ -262,7 +263,7 @@ static int spl_autoload(const char *clas
                        }
 
                        efree(class_file);
-                       return zend_hash_exists(EG(class_table), 
(char*)lc_name, class_name_len+1);
+                       return zend_find_class(EG(class_table), (char*)lc_name, 
class_name_len+1, &dummy_pce TSRMLS_CC) == SUCCESS;
                }
        }
        efree(class_file);
@@ -374,6 +375,7 @@ PHP_FUNCTION(spl_autoload_call)
        ulong dummy;
        HashPosition function_pos;
        autoload_func_info *alfi;
+       zend_class_entry **dummy_pce;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &class_name) 
== FAILURE || Z_TYPE_P(class_name) != IS_STRING) {
                return;
@@ -393,7 +395,7 @@ PHP_FUNCTION(spl_autoload_call)
                        if (retval) {
                                zval_ptr_dtor(&retval);
                        }
-                       if (zend_hash_exists(EG(class_table), lc_name, 
class_name_len + 1)) {
+                       if (zend_find_class(EG(class_table), lc_name, 
class_name_len + 1, &dummy_pce TSRMLS_CC) == SUCCESS) {
                                break;
                        }
                        zend_hash_move_forward_ex(SPL_G(autoload_functions), 
&function_pos);
@@ -626,7 +628,7 @@ PHP_FUNCTION(spl_autoload_functions)
        autoload_func_info *alfi;
 
        if (!EG(autoload_func)) {
-               if (zend_hash_find(EG(function_table), ZEND_AUTOLOAD_FUNC_NAME, 
sizeof(ZEND_AUTOLOAD_FUNC_NAME), (void **) &fptr) == SUCCESS) {
+               if (zend_find_function(EG(function_table), 
ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME), &fptr TSRMLS_CC) == 
SUCCESS) {
                        array_init(return_value);
                        add_next_index_stringl(return_value, 
ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME)-1, 1);
                        return;
Index: ext/wddx/wddx.c
===================================================================
RCS file: /repository/php-src/ext/wddx/wddx.c,v
retrieving revision 1.119.2.10.2.17.2.18
diff -u -p -d -r1.119.2.10.2.17.2.18 wddx.c
--- ext/wddx/wddx.c     31 Dec 2008 11:15:46 -0000      1.119.2.10.2.17.2.18
+++ ext/wddx/wddx.c     13 Mar 2009 13:46:13 -0000
@@ -964,8 +964,8 @@ static void php_wddx_pop_element(void *u
                                                zend_bool incomplete_class = 0;
 
                                                
zend_str_tolower(Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data));
-                                               if 
(zend_hash_find(EG(class_table), Z_STRVAL_P(ent1->data),
-                                                                               
   Z_STRLEN_P(ent1->data)+1, (void **) &pce)==FAILURE) {
+                                               if 
(zend_find_class(EG(class_table), Z_STRVAL_P(ent1->data),
+                                                                               
   Z_STRLEN_P(ent1->data)+1, &pce TSRMLS_CC)==FAILURE) {
                                                        incomplete_class = 1;
                                                        pce = &PHP_IC_ENTRY;
                                                }

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to