cvs: ZendEngine2(PHP_5_2) / zend_object_handlers.c
[email protected] ("Felipe Pena") Fri, 12 Jun 2009 21:33:46 -0000
| Newsgroups | php.zend-engine.cvs |
|---|---|
| Message-ID | <cvsfelipe1244842426@cvsserver> |
felipe Fri Jun 12 21:33:46 2009 UTC
Modified files: (Branch: PHP_5_2)
/ZendEngine2 zend_object_handlers.c
Log:
- MFH some changes (from last fix on 5.3+)
- Constified method_name arg in zend_get_user_call_function()
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_object_handlers.c?r1=1.135.2.6.2.34&r2=1.135.2.6.2.35&diff_format=u
Index: ZendEngine2/zend_object_handlers.c
diff -u ZendEngine2/zend_object_handlers.c:1.135.2.6.2.34 ZendEngine2/zend_object_handlers.c:1.135.2.6.2.35
--- ZendEngine2/zend_object_handlers.c:1.135.2.6.2.34 Tue May 12 23:01:38 2009
+++ ZendEngine2/zend_object_handlers.c Fri Jun 12 21:33:46 2009
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_object_handlers.c,v 1.135.2.6.2.34 2009/05/12 23:01:38 felipe Exp $ */
+/* $Id: zend_object_handlers.c,v 1.135.2.6.2.35 2009/06/12 21:33:46 felipe Exp $ */
#include "zend.h"
#include "zend_globals.h"
@@ -762,15 +762,15 @@
}
-static inline union _zend_function *zend_get_user_call_function(zend_object *zobj, char *method_name, int method_len) /* {{{ */
+static inline union _zend_function *zend_get_user_call_function(zend_class_entry *ce, const char *method_name, int method_len) /* {{{ */
{
zend_internal_function *call_user_call = emalloc(sizeof(zend_internal_function));
call_user_call->type = ZEND_INTERNAL_FUNCTION;
- call_user_call->module = zobj->ce->module;
+ call_user_call->module = ce->module;
call_user_call->handler = zend_std_call_user_call;
call_user_call->arg_info = NULL;
call_user_call->num_args = 0;
- call_user_call->scope = zobj->ce;
+ call_user_call->scope = ce;
call_user_call->fn_flags = 0;
call_user_call->function_name = estrndup(method_name, method_len);
call_user_call->pass_rest_by_reference = 0;
@@ -796,7 +796,7 @@
if (zend_hash_find(&zobj->ce->function_table, lc_method_name, method_len+1, (void **)&fbc) == FAILURE) {
free_alloca_with_limit(lc_method_name, use_heap);
if (zobj->ce->__call) {
- return zend_get_user_call_function(zobj, method_name, method_len);
+ return zend_get_user_call_function(zobj->ce, method_name, method_len);
} else {
return NULL;
}
@@ -814,7 +814,7 @@
fbc = updated_fbc;
} else {
if (zobj->ce->__call) {
- fbc = zend_get_user_call_function(zobj, method_name, method_len);
+ fbc = zend_get_user_call_function(zobj->ce, method_name, method_len);
} else {
zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : "");
}
@@ -840,7 +840,7 @@
*/
if (!zend_check_protected(zend_get_function_root_class(fbc), EG(scope))) {
if (zobj->ce->__call) {
- fbc = zend_get_user_call_function(zobj, method_name, method_len);
+ fbc = zend_get_user_call_function(zobj->ce, method_name, method_len);
} else {
zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : "");
}
@@ -868,20 +868,7 @@
EG(This) &&
Z_OBJ_HT_P(EG(This))->get_class_entry &&
instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
- zend_internal_function *call_user_call = emalloc(sizeof(zend_internal_function));
-
- call_user_call->type = ZEND_INTERNAL_FUNCTION;
- call_user_call->module = ce->module;
- call_user_call->handler = zend_std_call_user_call;
- call_user_call->arg_info = NULL;
- call_user_call->num_args = 0;
- call_user_call->scope = ce;
- call_user_call->fn_flags = 0;
- call_user_call->function_name = estrndup(function_name_strval, function_name_strlen);
- call_user_call->pass_rest_by_reference = 0;
- call_user_call->return_reference = ZEND_RETURN_VALUE;
-
- return (union _zend_function *)call_user_call;
+ return zend_get_user_call_function(ce, function_name_strval, function_name_strlen);
} else {
char *class_name = ce->name;