diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 0204e14a58f6..54030c58f0f7 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -920,7 +920,7 @@ ZEND_API ZEND_COLD void zend_exception_error(zend_object *ex, int severity) /* { zend_string *str, *file = NULL; zend_long line = 0; - zend_call_method_with_0_params(Z_OBJ(exception), ce_exception, &ex->ce->__tostring, "__tostring", &tmp); + zend_call_method_with_0_params_ex(Z_OBJ(exception), ce_exception, &ex->ce->__tostring, ZSTR_KNOWN(ZEND_STR_MAGIC_TO_STRING), &tmp); if (!EG(exception)) { if (Z_TYPE(tmp) != IS_STRING) { zend_error(E_WARNING, "%s::__toString() must return a string", ZSTR_VAL(ce_exception->name)); @@ -941,7 +941,7 @@ ZEND_API ZEND_COLD void zend_exception_error(zend_object *ex, int severity) /* { } zend_error_va(E_WARNING, (file && ZSTR_LEN(file) > 0) ? ZSTR_VAL(file) : NULL, line, - "Uncaught %s in exception handling during call to %s::__tostring()", + "Uncaught %s in exception handling during call to %s::__toString()", ZSTR_VAL(Z_OBJCE(zv)->name), ZSTR_VAL(ce_exception->name)); if (file) { diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index 8fffde76ff79..6b3d91f44763 100644 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -33,6 +33,24 @@ ZEND_API zend_class_entry *zend_ce_stringable; /* {{{ zend_call_method Only returns the returned zval if retval_ptr != NULL */ ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, size_t function_name_len, zval *retval_ptr, int param_count, zval* arg1, zval* arg2) +{ + zend_string *function_name_str = NULL; + zval *retval; + + if (!fn_proxy || !*fn_proxy) { + function_name_str = zend_string_init(function_name, function_name_len, 0); + } + retval = zend_call_method_ex(object, obj_ce, fn_proxy, function_name_str, retval_ptr, param_count, arg1, arg2); + if (function_name_str) { + zend_string_efree(function_name_str); + } + + return retval; +} +/* }}} */ + +/* {{{ zend_call_method_ex */ +ZEND_API zval* zend_call_method_ex(zend_object *object, zend_class_entry *obj_ce, zend_function **fn_proxy, zend_string *function_name, zval *retval_ptr, int param_count, zval* arg1, zval* arg2) { int result; zend_fcall_info fci; @@ -53,12 +71,13 @@ ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, z fci.params = params; fci.no_separation = 1; + ZEND_ASSERT(function_name || (fn_proxy && *fn_proxy)); + if (!fn_proxy && !obj_ce) { /* no interest in caching and no information already present that is * needed later inside zend_call_function. */ - ZVAL_STRINGL(&fci.function_name, function_name, function_name_len); + ZVAL_STR(&fci.function_name, function_name); result = zend_call_function(&fci, NULL); - zval_ptr_dtor(&fci.function_name); } else { zend_fcall_info_cache fcic; ZVAL_UNDEF(&fci.function_name); /* Unused */ @@ -68,17 +87,16 @@ ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, z } if (!fn_proxy || !*fn_proxy) { if (EXPECTED(obj_ce)) { - fcic.function_handler = zend_hash_str_find_ptr( - &obj_ce->function_table, function_name, function_name_len); + fcic.function_handler = zend_hash_find_ptr(&obj_ce->function_table, function_name); if (UNEXPECTED(fcic.function_handler == NULL)) { /* error at c-level */ - zend_error_noreturn(E_CORE_ERROR, "Couldn't find implementation for method %s::%s", ZSTR_VAL(obj_ce->name), function_name); + zend_error_noreturn(E_CORE_ERROR, "Couldn't find implementation for method %s::%s", ZSTR_VAL(obj_ce->name), ZSTR_VAL(function_name)); } } else { - fcic.function_handler = zend_fetch_function_str(function_name, function_name_len); + fcic.function_handler = zend_fetch_function(function_name); if (UNEXPECTED(fcic.function_handler == NULL)) { /* error at c-level */ - zend_error_noreturn(E_CORE_ERROR, "Couldn't find implementation for function %s", function_name); + zend_error_noreturn(E_CORE_ERROR, "Couldn't find implementation for function %s", ZSTR_VAL(function_name)); } } if (fn_proxy) { @@ -94,8 +112,8 @@ ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, z zend_class_entry *called_scope = zend_get_called_scope(EG(current_execute_data)); if (obj_ce && - (!called_scope || - !instanceof_function(called_scope, obj_ce))) { + (!called_scope || + !instanceof_function(called_scope, obj_ce))) { fcic.called_scope = obj_ce; } else { fcic.called_scope = called_scope; @@ -104,13 +122,16 @@ ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, z fcic.object = object; result = zend_call_function(&fci, &fcic); } - if (result == FAILURE) { + if (UNEXPECTED(result == FAILURE)) { /* error at c-level */ - if (!obj_ce) { - obj_ce = object ? object->ce : NULL; - } - if (!EG(exception)) { - zend_error_noreturn(E_CORE_ERROR, "Couldn't execute method %s%s%s", obj_ce ? ZSTR_VAL(obj_ce->name) : "", obj_ce ? "::" : "", function_name); + if (UNEXPECTED(!EG(exception))) { + if (!obj_ce) { + obj_ce = object ? object->ce : NULL; + } + if (!function_name) { + function_name = (*fn_proxy)->common.function_name; + } + zend_error_noreturn(E_CORE_ERROR, "Couldn't execute method %s%s%s", obj_ce ? ZSTR_VAL(obj_ce->name) : "", obj_ce ? "::" : "", ZSTR_VAL(function_name)); } } if (!retval_ptr) { @@ -126,7 +147,7 @@ ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, z /* {{{ zend_user_it_new_iterator */ ZEND_API void zend_user_it_new_iterator(zend_class_entry *ce, zval *object, zval *retval) { - zend_call_method_with_0_params(Z_OBJ_P(object), ce, &ce->iterator_funcs_ptr->zf_new_iterator, "getiterator", retval); + zend_call_method_with_0_params_ex(Z_OBJ_P(object), ce, &ce->iterator_funcs_ptr->zf_new_iterator, ZSTR_KNOWN(ZEND_STR_GET_ITERATOR), retval); } /* }}} */ @@ -162,7 +183,7 @@ ZEND_API int zend_user_it_valid(zend_object_iterator *_iter) zval more; int result; - zend_call_method_with_0_params(Z_OBJ_P(object), iter->ce, &iter->ce->iterator_funcs_ptr->zf_valid, "valid", &more); + zend_call_method_with_0_params_ex(Z_OBJ_P(object), iter->ce, &iter->ce->iterator_funcs_ptr->zf_valid, ZSTR_KNOWN(ZEND_STR_VALID), &more); result = i_zend_is_true(&more); zval_ptr_dtor(&more); return result ? SUCCESS : FAILURE; @@ -178,7 +199,7 @@ ZEND_API zval *zend_user_it_get_current_data(zend_object_iterator *_iter) zval *object = &iter->it.data; if (Z_ISUNDEF(iter->value)) { - zend_call_method_with_0_params(Z_OBJ_P(object), iter->ce, &iter->ce->iterator_funcs_ptr->zf_current, "current", &iter->value); + zend_call_method_with_0_params_ex(Z_OBJ_P(object), iter->ce, &iter->ce->iterator_funcs_ptr->zf_current, ZSTR_KNOWN(ZEND_STR_CURRENT), &iter->value); } return &iter->value; } @@ -191,7 +212,7 @@ ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, zval *ke zval *object = &iter->it.data; zval retval; - zend_call_method_with_0_params(Z_OBJ_P(object), iter->ce, &iter->ce->iterator_funcs_ptr->zf_key, "key", &retval); + zend_call_method_with_0_params_ex(Z_OBJ_P(object), iter->ce, &iter->ce->iterator_funcs_ptr->zf_key, ZSTR_KNOWN(ZEND_STR_KEY), &retval); if (Z_TYPE(retval) != IS_UNDEF) { ZVAL_COPY_VALUE(key, &retval); @@ -212,7 +233,7 @@ ZEND_API void zend_user_it_move_forward(zend_object_iterator *_iter) zval *object = &iter->it.data; zend_user_it_invalidate_current(_iter); - zend_call_method_with_0_params(Z_OBJ_P(object), iter->ce, &iter->ce->iterator_funcs_ptr->zf_next, "next", NULL); + zend_call_method_with_0_params_ex(Z_OBJ_P(object), iter->ce, &iter->ce->iterator_funcs_ptr->zf_next, ZSTR_KNOWN(ZEND_STR_NEXT), NULL); } /* }}} */ @@ -223,7 +244,7 @@ ZEND_API void zend_user_it_rewind(zend_object_iterator *_iter) zval *object = &iter->it.data; zend_user_it_invalidate_current(_iter); - zend_call_method_with_0_params(Z_OBJ_P(object), iter->ce, &iter->ce->iterator_funcs_ptr->zf_rewind, "rewind", NULL); + zend_call_method_with_0_params_ex(Z_OBJ_P(object), iter->ce, &iter->ce->iterator_funcs_ptr->zf_rewind, ZSTR_KNOWN(ZEND_STR_REWIND), NULL); } /* }}} */ @@ -398,7 +419,7 @@ ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, size_t *b zval retval; int result; - zend_call_method_with_0_params(Z_OBJ_P(object), ce, &ce->serialize_func, "serialize", &retval); + zend_call_method_with_0_params_ex(Z_OBJ_P(object), ce, &ce->serialize_func, ZSTR_KNOWN(ZEND_STR_SERIALIZE), &retval); if (Z_TYPE(retval) == IS_UNDEF || EG(exception)) { @@ -439,7 +460,7 @@ ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const uns ZVAL_STRINGL(&zdata, (char*)buf, buf_len); - zend_call_method_with_1_params(Z_OBJ_P(object), ce, &ce->unserialize_func, "unserialize", NULL, &zdata); + zend_call_method_with_1_params_ex(Z_OBJ_P(object), ce, &ce->unserialize_func, ZSTR_KNOWN(ZEND_STR_UNSERIALIZE), NULL, &zdata); zval_ptr_dtor(&zdata); diff --git a/Zend/zend_interfaces.h b/Zend/zend_interfaces.h index dbdcd2a0742a..f9e3b06292c9 100644 --- a/Zend/zend_interfaces.h +++ b/Zend/zend_interfaces.h @@ -39,6 +39,7 @@ typedef struct _zend_user_iterator { } zend_user_iterator; ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, size_t function_name_len, zval *retval, int param_count, zval* arg1, zval* arg2); +ZEND_API zval* zend_call_method_ex(zend_object *object, zend_class_entry *obj_ce, zend_function **fn_proxy, zend_string *function_name, zval *retval_ptr, int param_count, zval* arg1, zval* arg2); #define zend_call_method_with_0_params(obj, obj_ce, fn_proxy, function_name, retval) \ zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 0, NULL, NULL) @@ -49,6 +50,15 @@ ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, z #define zend_call_method_with_2_params(obj, obj_ce, fn_proxy, function_name, retval, arg1, arg2) \ zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 2, arg1, arg2) +#define zend_call_method_with_0_params_ex(obj, obj_ce, fn_proxy, function_name, retval) \ + zend_call_method_ex(obj, obj_ce, fn_proxy, function_name, retval, 0, NULL, NULL) + +#define zend_call_method_with_1_params_ex(obj, obj_ce, fn_proxy, function_name, retval, arg1) \ + zend_call_method_ex(obj, obj_ce, fn_proxy, function_name, retval, 1, arg1, NULL) + +#define zend_call_method_with_2_params_ex(obj, obj_ce, fn_proxy, function_name, retval, arg1, arg2) \ + zend_call_method_ex(obj, obj_ce, fn_proxy, function_name, retval, 2, arg1, arg2) + #define REGISTER_MAGIC_INTERFACE(class_name, class_name_str) \ {\ zend_class_entry ce;\ diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index ce5411b0406b..6bf03141ba4b 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -149,7 +149,7 @@ ZEND_API HashTable *zend_std_get_debug_info(zend_object *object, int *is_temp) / return object->handlers->get_properties(object); } - zend_call_method_with_0_params(object, ce, &ce->__debugInfo, ZEND_DEBUGINFO_FUNC_NAME, &retval); + zend_call_method_with_0_params_ex(object, ce, &ce->__debugInfo, ZSTR_KNOWN(ZEND_STR_MAGIC_DEBUG_INFO), &retval); if (Z_TYPE(retval) == IS_ARRAY) { if (!Z_REFCOUNTED(retval)) { *is_temp = 1; @@ -918,7 +918,7 @@ ZEND_API zval *zend_std_read_dimension(zend_object *object, zval *offset, int ty GC_ADDREF(object); if (type == BP_VAR_IS) { - zend_call_method_with_1_params(object, ce, NULL, "offsetexists", rv, &tmp_offset); + zend_call_method_with_1_params_ex(object, ce, NULL, ZSTR_KNOWN(ZEND_STR_OFFSET_EXISTS), rv, &tmp_offset); if (UNEXPECTED(Z_ISUNDEF_P(rv))) { OBJ_RELEASE(object); zval_ptr_dtor(&tmp_offset); @@ -933,7 +933,7 @@ ZEND_API zval *zend_std_read_dimension(zend_object *object, zval *offset, int ty zval_ptr_dtor(rv); } - zend_call_method_with_1_params(object, ce, NULL, "offsetget", rv, &tmp_offset); + zend_call_method_with_1_params_ex(object, ce, NULL, ZSTR_KNOWN(ZEND_STR_OFFSET_GET), rv, &tmp_offset); OBJ_RELEASE(object); zval_ptr_dtor(&tmp_offset); @@ -964,7 +964,7 @@ ZEND_API void zend_std_write_dimension(zend_object *object, zval *offset, zval * ZVAL_COPY_DEREF(&tmp_offset, offset); } GC_ADDREF(object); - zend_call_method_with_2_params(object, ce, NULL, "offsetset", NULL, &tmp_offset, value); + zend_call_method_with_2_params_ex(object, ce, NULL, ZSTR_KNOWN(ZEND_STR_OFFSET_SET), NULL, &tmp_offset, value); OBJ_RELEASE(object); zval_ptr_dtor(&tmp_offset); } else { @@ -982,11 +982,11 @@ ZEND_API int zend_std_has_dimension(zend_object *object, zval *offset, int check if (EXPECTED(zend_class_implements_interface(ce, zend_ce_arrayaccess) != 0)) { ZVAL_COPY_DEREF(&tmp_offset, offset); GC_ADDREF(object); - zend_call_method_with_1_params(object, ce, NULL, "offsetexists", &retval, &tmp_offset); + zend_call_method_with_1_params_ex(object, ce, NULL, ZSTR_KNOWN(ZEND_STR_OFFSET_EXISTS), &retval, &tmp_offset); result = i_zend_is_true(&retval); zval_ptr_dtor(&retval); if (check_empty && result && EXPECTED(!EG(exception))) { - zend_call_method_with_1_params(object, ce, NULL, "offsetget", &retval, &tmp_offset); + zend_call_method_with_1_params_ex(object, ce, NULL, ZSTR_KNOWN(ZEND_STR_OFFSET_GET), &retval, &tmp_offset); result = i_zend_is_true(&retval); zval_ptr_dtor(&retval); } @@ -1138,7 +1138,7 @@ ZEND_API void zend_std_unset_dimension(zend_object *object, zval *offset) /* {{{ if (zend_class_implements_interface(ce, zend_ce_arrayaccess)) { ZVAL_COPY_DEREF(&tmp_offset, offset); GC_ADDREF(object); - zend_call_method_with_1_params(object, ce, NULL, "offsetunset", NULL, &tmp_offset); + zend_call_method_with_1_params_ex(object, ce, NULL, ZSTR_KNOWN(ZEND_STR_OFFSET_UNSET), NULL, &tmp_offset); OBJ_RELEASE(object); zval_ptr_dtor(&tmp_offset); } else { @@ -1801,7 +1801,7 @@ ZEND_API int zend_std_cast_object_tostring(zend_object *readobj, zval *writeobj, if (ce->__tostring) { zval retval; GC_ADDREF(readobj); - zend_call_method_with_0_params(readobj, ce, &ce->__tostring, "__tostring", &retval); + zend_call_method_with_0_params_ex(readobj, ce, &ce->__tostring, ZSTR_KNOWN(ZEND_STR_MAGIC_TO_STRING), &retval); zend_object_release(readobj); if (EXPECTED(Z_TYPE(retval) == IS_STRING)) { ZVAL_COPY_VALUE(writeobj, &retval); diff --git a/Zend/zend_string.c b/Zend/zend_string.c index 7eae674f08a2..48960bc79186 100644 --- a/Zend/zend_string.c +++ b/Zend/zend_string.c @@ -104,7 +104,7 @@ ZEND_API void zend_interned_strings_init(void) } /* known strings */ - zend_known_strings = pemalloc(sizeof(zend_string*) * ((sizeof(known_strings) / sizeof(known_strings[0]) - 1)), 1); + zend_known_strings = pemalloc(sizeof(zend_string *) * ((sizeof(known_strings) / sizeof(known_strings[0])) - 1), 1); for (i = 0; i < (sizeof(known_strings) / sizeof(known_strings[0])) - 1; i++) { str = zend_string_init(known_strings[i], strlen(known_strings[i]), 1); zend_known_strings[i] = zend_new_interned_string_permanent(str); diff --git a/Zend/zend_string.h b/Zend/zend_string.h index fa794278e5eb..cb703144a662 100644 --- a/Zend/zend_string.h +++ b/Zend/zend_string.h @@ -467,66 +467,96 @@ EMPTY_SWITCH_DEFAULT_CASE() } #define ZEND_KNOWN_STRINGS(_) \ - _(ZEND_STR_FILE, "file") \ - _(ZEND_STR_LINE, "line") \ - _(ZEND_STR_FUNCTION, "function") \ - _(ZEND_STR_CLASS, "class") \ - _(ZEND_STR_OBJECT, "object") \ - _(ZEND_STR_TYPE, "type") \ - _(ZEND_STR_OBJECT_OPERATOR, "->") \ - _(ZEND_STR_PAAMAYIM_NEKUDOTAYIM, "::") \ - _(ZEND_STR_ARGS, "args") \ - _(ZEND_STR_UNKNOWN, "unknown") \ - _(ZEND_STR_EVAL, "eval") \ - _(ZEND_STR_INCLUDE, "include") \ - _(ZEND_STR_REQUIRE, "require") \ - _(ZEND_STR_INCLUDE_ONCE, "include_once") \ - _(ZEND_STR_REQUIRE_ONCE, "require_once") \ - _(ZEND_STR_SCALAR, "scalar") \ - _(ZEND_STR_ERROR_REPORTING, "error_reporting") \ - _(ZEND_STR_STATIC, "static") \ - _(ZEND_STR_THIS, "this") \ - _(ZEND_STR_VALUE, "value") \ - _(ZEND_STR_KEY, "key") \ - _(ZEND_STR_MAGIC_INVOKE, "__invoke") \ - _(ZEND_STR_PREVIOUS, "previous") \ - _(ZEND_STR_CODE, "code") \ - _(ZEND_STR_MESSAGE, "message") \ - _(ZEND_STR_SEVERITY, "severity") \ - _(ZEND_STR_STRING, "string") \ - _(ZEND_STR_TRACE, "trace") \ - _(ZEND_STR_SCHEME, "scheme") \ - _(ZEND_STR_HOST, "host") \ - _(ZEND_STR_PORT, "port") \ - _(ZEND_STR_USER, "user") \ - _(ZEND_STR_PASS, "pass") \ - _(ZEND_STR_PATH, "path") \ - _(ZEND_STR_QUERY, "query") \ - _(ZEND_STR_FRAGMENT, "fragment") \ - _(ZEND_STR_NULL, "NULL") \ - _(ZEND_STR_BOOLEAN, "boolean") \ - _(ZEND_STR_INTEGER, "integer") \ - _(ZEND_STR_DOUBLE, "double") \ - _(ZEND_STR_ARRAY, "array") \ - _(ZEND_STR_RESOURCE, "resource") \ - _(ZEND_STR_CLOSED_RESOURCE, "resource (closed)") \ - _(ZEND_STR_NAME, "name") \ - _(ZEND_STR_ARGV, "argv") \ - _(ZEND_STR_ARGC, "argc") \ - _(ZEND_STR_ARRAY_CAPITALIZED, "Array") \ - _(ZEND_STR_BOOL, "bool") \ - _(ZEND_STR_INT, "int") \ - _(ZEND_STR_FLOAT, "float") \ - _(ZEND_STR_CALLABLE, "callable") \ - _(ZEND_STR_ITERABLE, "iterable") \ - _(ZEND_STR_VOID, "void") \ - _(ZEND_STR_FALSE, "false") \ - _(ZEND_STR_NULL_LOWERCASE, "null") \ - _(ZEND_STR_MIXED, "mixed") \ - + _(FILE, "file") \ + _(LINE, "line") \ + _(FUNCTION, "function") \ + _(CLASS, "class") \ + _(OBJECT, "object") \ + _(TYPE, "type") \ + _(OBJECT_OPERATOR, "->") \ + _(PAAMAYIM_NEKUDOTAYIM, "::") \ + _(ARGS, "args") \ + _(UNKNOWN, "unknown") \ + _(EVAL, "eval") \ + _(INCLUDE, "include") \ + _(REQUIRE, "require") \ + _(INCLUDE_ONCE, "include_once") \ + _(REQUIRE_ONCE, "require_once") \ + _(SCALAR, "scalar") \ + _(ERROR_REPORTING, "error_reporting") \ + _(STATIC, "static") \ + _(THIS, "this") \ + _(KEY, "key") \ + _(VALUE, "value") \ + _(PREVIOUS, "previous") \ + _(CODE, "code") \ + _(MESSAGE, "message") \ + _(SEVERITY, "severity") \ + _(STRING, "string") \ + _(TRACE, "trace") \ + _(SCHEME, "scheme") \ + _(HOST, "host") \ + _(PORT, "port") \ + _(USER, "user") \ + _(PASS, "pass") \ + _(PATH, "path") \ + _(QUERY, "query") \ + _(FRAGMENT, "fragment") \ + _(NULL, "NULL") \ + _(BOOLEAN, "boolean") \ + _(INTEGER, "integer") \ + _(DOUBLE, "double") \ + _(ARRAY, "array") \ + _(RESOURCE, "resource") \ + _(CLOSED_RESOURCE, "resource (closed)") \ + _(NAME, "name") \ + _(ARGV, "argv") \ + _(ARGC, "argc") \ + _(ARRAY_CAPITALIZED, "Array") \ + _(BOOL, "bool") \ + _(INT, "int") \ + _(FLOAT, "float") \ + _(CALLABLE, "callable") \ + _(ITERABLE, "iterable") \ + _(VOID, "void") \ + _(FALSE, "false") \ + _(NULL_LOWERCASE, "null") \ + _(MIXED, "mixed") \ + _(MAGIC_CONSTRUCT, "__construct") \ + _(MAGIC_INVOKE, "__invoke") \ + _(MAGIC_TO_STRING, "__tostring") \ + _(MAGIC_DEBUG_INFO, "__debuginfo") \ + _(SERIALIZE, "serialize") \ + _(UNSERIALIZE, "unserialize") \ + _(ACCEPT, "accept") \ + _(COMPARE, "compare") \ + _(COUNT, "count") \ + _(CURRENT, "current") \ + _(REWIND, "rewind") \ + _(NEXT, "next") \ + _(HASNEXT, "hasnext") \ + _(VALID, "valid") \ + _(SEEK, "seek") \ + _(ITEM, "item") \ + _(BEGIN_ITERATION, "beginiteration") \ + _(BEGIN_CHILDREN, "beginchildren") \ + _(CALL_HAS_CHILDREN, "callhaschildren") \ + _(CALL_GET_CHILDREN, "callgetchildren") \ + _(END_ITERATION, "enditeration") \ + _(END_CHILDREN, "endchildren") \ + _(GET_CURRENT_LINE, "getcurrentline") \ + _(GET_CHILDREN, "getchildren") \ + _(GET_HASH, "gethash") \ + _(GET_ITERATOR, "getiterator") \ + _(HAS_CHILDREN, "haschildren") \ + _(NEXT_ELEMENT, "nextelement") \ + _(OFFSET_EXISTS, "offsetexists") \ + _(OFFSET_GET, "offsetget") \ + _(OFFSET_SET, "offsetset") \ + _(OFFSET_UNSET, "offsetunset") \ typedef enum _zend_known_string_id { -#define _ZEND_STR_ID(id, str) id, +#define _ZEND_STR_ID(id, str) ZEND_STR_##id, ZEND_KNOWN_STRINGS(_ZEND_STR_ID) #undef _ZEND_STR_ID ZEND_STR_LAST_KNOWN diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index b8b0dc5e3a80..171c52504638 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -8465,7 +8465,7 @@ ZEND_VM_COLD_CONST_HANDLER(190, ZEND_COUNT, CONST|TMPVAR|CV, UNUSED) if (zend_class_implements_interface(zobj->ce, zend_ce_countable)) { zval retval; - zend_call_method_with_0_params(zobj, NULL, NULL, "count", &retval); + zend_call_method_with_0_params_ex(zobj, NULL, NULL, ZSTR_KNOWN(ZEND_STR_COUNT), &retval); count = zval_get_long(&retval); zval_ptr_dtor(&retval); break; diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 16779b66167d..10b840feec75 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -9283,7 +9283,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_CONST_ if (zend_class_implements_interface(zobj->ce, zend_ce_countable)) { zval retval; - zend_call_method_with_0_params(zobj, NULL, NULL, "count", &retval); + zend_call_method_with_0_params_ex(zobj, NULL, NULL, ZSTR_KNOWN(ZEND_STR_COUNT), &retval); count = zval_get_long(&retval); zval_ptr_dtor(&retval); break; @@ -16361,7 +16361,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_TMPVAR_UNUSED_HANDL if (zend_class_implements_interface(zobj->ce, zend_ce_countable)) { zval retval; - zend_call_method_with_0_params(zobj, NULL, NULL, "count", &retval); + zend_call_method_with_0_params_ex(zobj, NULL, NULL, ZSTR_KNOWN(ZEND_STR_COUNT), &retval); count = zval_get_long(&retval); zval_ptr_dtor(&retval); break; @@ -45206,7 +45206,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_CV_UNUSED_HANDLER(Z if (zend_class_implements_interface(zobj->ce, zend_ce_countable)) { zval retval; - zend_call_method_with_0_params(zobj, NULL, NULL, "count", &retval); + zend_call_method_with_0_params_ex(zobj, NULL, NULL, ZSTR_KNOWN(ZEND_STR_COUNT), &retval); count = zval_get_long(&retval); zval_ptr_dtor(&retval); break; diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index 9dc50ac28773..a5ef1f9b54ea 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -1529,7 +1529,7 @@ static zval *dom_nodelist_read_dimension(zend_object *object, zval *offset, int ZVAL_LONG(&offset_copy, zval_get_long(offset)); - zend_call_method_with_1_params(object, object->ce, NULL, "item", rv, &offset_copy); + zend_call_method_with_1_params_ex(object, object->ce, NULL, ZSTR_KNOWN(ZEND_STR_ITEM), rv, &offset_copy); return rv; } /* }}} end dom_nodelist_read_dimension */ diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index d67c4dee47ab..03e5d8bd8487 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -1242,8 +1242,8 @@ PHP_METHOD(Phar, __construct) ZVAL_STRINGL(&arg1, fname, fname_len); ZVAL_LONG(&arg2, flags); - zend_call_method_with_2_params(Z_OBJ_P(zobj), Z_OBJCE_P(zobj), - &spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg1, &arg2); + zend_call_method_with_2_params_ex(Z_OBJ_P(zobj), Z_OBJCE_P(zobj), + &spl_ce_RecursiveDirectoryIterator->constructor, ZSTR_KNOWN(ZEND_STR_MAGIC_CONSTRUCT), NULL, &arg1, &arg2); zval_ptr_dtor(&arg1); @@ -1764,8 +1764,8 @@ PHP_METHOD(Phar, buildFromDirectory) ZVAL_STRINGL(&arg, dir, dir_len); ZVAL_LONG(&arg2, SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS); - zend_call_method_with_2_params(Z_OBJ(iter), spl_ce_RecursiveDirectoryIterator, - &spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg, &arg2); + zend_call_method_with_2_params_ex(Z_OBJ(iter), spl_ce_RecursiveDirectoryIterator, + &spl_ce_RecursiveDirectoryIterator->constructor, ZSTR_KNOWN(ZEND_STR_MAGIC_CONSTRUCT), NULL, &arg, &arg2); zval_ptr_dtor(&arg); if (EG(exception)) { @@ -1780,8 +1780,8 @@ PHP_METHOD(Phar, buildFromDirectory) RETURN_THROWS(); } - zend_call_method_with_1_params(Z_OBJ(iteriter), spl_ce_RecursiveIteratorIterator, - &spl_ce_RecursiveIteratorIterator->constructor, "__construct", NULL, &iter); + zend_call_method_with_1_params_ex(Z_OBJ(iteriter), spl_ce_RecursiveIteratorIterator, + &spl_ce_RecursiveIteratorIterator->constructor, ZSTR_KNOWN(ZEND_STR_MAGIC_CONSTRUCT), NULL, &iter); if (EG(exception)) { zval_ptr_dtor(&iter); @@ -1803,8 +1803,8 @@ PHP_METHOD(Phar, buildFromDirectory) ZVAL_STRINGL(&arg2, regex, regex_len); - zend_call_method_with_2_params(Z_OBJ(regexiter), spl_ce_RegexIterator, - &spl_ce_RegexIterator->constructor, "__construct", NULL, &iteriter, &arg2); + zend_call_method_with_2_params_ex(Z_OBJ(regexiter), spl_ce_RegexIterator, + &spl_ce_RegexIterator->constructor, ZSTR_KNOWN(ZEND_STR_MAGIC_CONSTRUCT), NULL, &iteriter, &arg2); zval_ptr_dtor(&arg2); } @@ -2256,7 +2256,7 @@ static zend_object *phar_rename_archive(phar_archive_data **sphar, char *ext) /* ZVAL_STRINGL(&arg1, phar->fname, phar->fname_len); - zend_call_method_with_1_params(Z_OBJ(ret), ce, &ce->constructor, "__construct", NULL, &arg1); + zend_call_method_with_1_params_ex(Z_OBJ(ret), ce, &ce->constructor, ZSTR_KNOWN(ZEND_STR_MAGIC_CONSTRUCT), NULL, &arg1); zval_ptr_dtor(&arg1); return Z_OBJ(ret); } @@ -4539,8 +4539,8 @@ PHP_METHOD(PharFileInfo, __construct) ZVAL_STRINGL(&arg1, fname, fname_len); - zend_call_method_with_1_params(Z_OBJ_P(zobj), Z_OBJCE_P(zobj), - &spl_ce_SplFileInfo->constructor, "__construct", NULL, &arg1); + zend_call_method_with_1_params_ex(Z_OBJ_P(zobj), Z_OBJCE_P(zobj), + &spl_ce_SplFileInfo->constructor, ZSTR_KNOWN(ZEND_STR_MAGIC_CONSTRUCT), NULL, &arg1); zval_ptr_dtor(&arg1); } diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 0c5591b5b540..941503b6deb1 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -1995,7 +1995,7 @@ static int sxe_count_elements(zend_object *object, zend_long *count) /* {{{ */ intern = php_sxe_fetch_object(object); if (intern->fptr_count) { zval rv; - zend_call_method_with_0_params(object, intern->zo.ce, &intern->fptr_count, "count", &rv); + zend_call_method_with_0_params_ex(object, intern->zo.ce, &intern->fptr_count, ZSTR_KNOWN(ZEND_STR_COUNT), &rv); if (!Z_ISUNDEF(rv)) { *count = zval_get_long(&rv); zval_ptr_dtor(&rv); diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index ab263b6195f6..96b81ef7c23e 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -413,7 +413,7 @@ static zval *spl_array_read_dimension_ex(int check_inherited, zend_object *objec } else { SEPARATE_ARG_IF_REF(offset); } - zend_call_method_with_1_params(object, object->ce, &intern->fptr_offset_get, "offsetGet", rv, offset); + zend_call_method_with_1_params_ex(object, object->ce, &intern->fptr_offset_get, ZSTR_KNOWN(ZEND_STR_OFFSET_GET), rv, offset); zval_ptr_dtor(offset); if (!Z_ISUNDEF_P(rv)) { @@ -459,7 +459,7 @@ static void spl_array_write_dimension_ex(int check_inherited, zend_object *objec } else { SEPARATE_ARG_IF_REF(offset); } - zend_call_method_with_2_params(object, object->ce, &intern->fptr_offset_set, "offsetSet", NULL, offset, value); + zend_call_method_with_2_params_ex(object, object->ce, &intern->fptr_offset_set, ZSTR_KNOWN(ZEND_STR_OFFSET_SET), NULL, offset, value); zval_ptr_dtor(offset); return; } @@ -527,7 +527,7 @@ static void spl_array_unset_dimension_ex(int check_inherited, zend_object *objec if (check_inherited && intern->fptr_offset_del) { SEPARATE_ARG_IF_REF(offset); - zend_call_method_with_1_params(object, object->ce, &intern->fptr_offset_del, "offsetUnset", NULL, offset); + zend_call_method_with_1_params_ex(object, object->ce, &intern->fptr_offset_del, ZSTR_KNOWN(ZEND_STR_OFFSET_UNSET), NULL, offset); zval_ptr_dtor(offset); return; } @@ -612,7 +612,7 @@ static int spl_array_has_dimension_ex(int check_inherited, zend_object *object, if (check_inherited && intern->fptr_offset_has) { SEPARATE_ARG_IF_REF(offset); - zend_call_method_with_1_params(object, object->ce, &intern->fptr_offset_has, "offsetExists", &rv, offset); + zend_call_method_with_1_params_ex(object, object->ce, &intern->fptr_offset_has, ZSTR_KNOWN(ZEND_STR_OFFSET_EXISTS), &rv, offset); zval_ptr_dtor(offset); if (zend_is_true(&rv)) { @@ -1408,7 +1408,7 @@ int spl_array_object_count_elements(zend_object *object, zend_long *count) /* {{ if (intern->fptr_count) { zval rv; - zend_call_method_with_0_params(object, intern->std.ce, &intern->fptr_count, "count", &rv); + zend_call_method_with_0_params_ex(object, intern->std.ce, &intern->fptr_count, ZSTR_KNOWN(ZEND_STR_COUNT), &rv); if (Z_TYPE(rv) != IS_UNDEF) { *count = zval_get_long(&rv); zval_ptr_dtor(&rv); diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 0ab47396a056..9f02bd5d1699 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -461,7 +461,7 @@ static spl_filesystem_object *spl_filesystem_object_create_info(spl_filesystem_o if (ce->constructor->common.scope != spl_ce_SplFileInfo) { ZVAL_STRINGL(&arg1, file_path, file_path_len); - zend_call_method_with_1_params(Z_OBJ_P(return_value), ce, &ce->constructor, "__construct", NULL, &arg1); + zend_call_method_with_1_params_ex(Z_OBJ_P(return_value), ce, &ce->constructor, ZSTR_KNOWN(ZEND_STR_MAGIC_CONSTRUCT), NULL, &arg1); zval_ptr_dtor(&arg1); } else { spl_filesystem_info_set_filename(intern, file_path, file_path_len, use_copy); @@ -506,7 +506,7 @@ static spl_filesystem_object *spl_filesystem_object_create_type(int num_args, sp spl_filesystem_object_get_file_name(source); if (ce->constructor->common.scope != spl_ce_SplFileInfo) { ZVAL_STRINGL(&arg1, source->file_name, source->file_name_len); - zend_call_method_with_1_params(Z_OBJ_P(return_value), ce, &ce->constructor, "__construct", NULL, &arg1); + zend_call_method_with_1_params_ex(Z_OBJ_P(return_value), ce, &ce->constructor, ZSTR_KNOWN(ZEND_STR_MAGIC_CONSTRUCT), NULL, &arg1); zval_ptr_dtor(&arg1); } else { intern->file_name = estrndup(source->file_name, source->file_name_len); @@ -543,7 +543,7 @@ static spl_filesystem_object *spl_filesystem_object_create_type(int num_args, sp if (ce->constructor->common.scope != spl_ce_SplFileObject) { ZVAL_STRINGL(&arg1, source->file_name, source->file_name_len); ZVAL_STRINGL(&arg2, open_mode, open_mode_len); - zend_call_method_with_2_params(Z_OBJ_P(return_value), ce, &ce->constructor, "__construct", NULL, &arg1, &arg2); + zend_call_method_with_2_params_ex(Z_OBJ_P(return_value), ce, &ce->constructor, ZSTR_KNOWN(ZEND_STR_MAGIC_CONSTRUCT), NULL, &arg1, &arg2); zval_ptr_dtor(&arg1); zval_ptr_dtor(&arg2); } else { @@ -843,19 +843,19 @@ PHP_METHOD(DirectoryIterator, seek) if (intern->u.dir.index > pos) { /* we first rewind */ - zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_rewind, "rewind", NULL); + zend_call_method_with_0_params_ex(Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_rewind, ZSTR_KNOWN(ZEND_STR_REWIND), NULL); } while (intern->u.dir.index < pos) { int valid = 0; - zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_valid, "valid", &retval); + zend_call_method_with_0_params_ex(Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_valid, ZSTR_KNOWN(ZEND_STR_VALID), &retval); valid = zend_is_true(&retval); zval_ptr_dtor(&retval); if (!valid) { zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0, "Seek position " ZEND_LONG_FMT " is out of range", pos); RETURN_THROWS(); } - zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_next, "next", NULL); + zend_call_method_with_0_params_ex(Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_next, ZSTR_KNOWN(ZEND_STR_NEXT), NULL); } } /* }}} */ @@ -2025,7 +2025,7 @@ static int spl_filesystem_file_read_line_ex(zval * this_ptr, spl_filesystem_obje return spl_filesystem_file_read_csv(intern, intern->u.file.delimiter, intern->u.file.enclosure, intern->u.file.escape, NULL); } else { zend_execute_data *execute_data = EG(current_execute_data); - zend_call_method_with_0_params(Z_OBJ_P(this_ptr), Z_OBJCE_P(ZEND_THIS), &intern->u.file.func_getCurr, "getCurrentLine", &retval); + zend_call_method_with_0_params_ex(Z_OBJ_P(this_ptr), Z_OBJCE_P(ZEND_THIS), &intern->u.file.func_getCurr, ZSTR_KNOWN(ZEND_STR_GET_CURRENT_LINE), &retval); } if (!Z_ISUNDEF(retval)) { if (intern->u.file.current_line || !Z_ISUNDEF(intern->u.file.current_zval)) { diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index b11cfacc3c7f..8be97b82a474 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -465,7 +465,7 @@ static int spl_dllist_object_count_elements(zend_object *object, zend_long *coun if (intern->fptr_count) { zval rv; - zend_call_method_with_0_params(object, intern->std.ce, &intern->fptr_count, "count", &rv); + zend_call_method_with_0_params_ex(object, intern->std.ce, &intern->fptr_count, ZSTR_KNOWN(ZEND_STR_COUNT), &rv); if (!Z_ISUNDEF(rv)) { *count = zval_get_long(&rv); zval_ptr_dtor(&rv); diff --git a/ext/spl/spl_engine.h b/ext/spl/spl_engine.h index 44c6867e034e..d7e09ecf0c7e 100644 --- a/ext/spl/spl_engine.h +++ b/ext/spl/spl_engine.h @@ -31,7 +31,7 @@ static inline int spl_instantiate_arg_ex1(zend_class_entry *pce, zval *retval, z zend_function *func = pce->constructor; spl_instantiate(pce, retval); - zend_call_method(Z_OBJ_P(retval), pce, &func, ZSTR_VAL(func->common.function_name), ZSTR_LEN(func->common.function_name), NULL, 1, arg1, NULL); + zend_call_method_ex(Z_OBJ_P(retval), pce, &func, func->common.function_name, NULL, 1, arg1, NULL); return 0; } /* }}} */ @@ -42,7 +42,7 @@ static inline int spl_instantiate_arg_ex2(zend_class_entry *pce, zval *retval, z zend_function *func = pce->constructor; spl_instantiate(pce, retval); - zend_call_method(Z_OBJ_P(retval), pce, &func, ZSTR_VAL(func->common.function_name), ZSTR_LEN(func->common.function_name), NULL, 2, arg1, arg2); + zend_call_method_ex(Z_OBJ_P(retval), pce, &func, func->common.function_name, NULL, 2, arg1, arg2); return 0; } /* }}} */ diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index 2b86a85d5155..37d748c0fa26 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -351,7 +351,7 @@ static zval *spl_fixedarray_object_read_dimension(zend_object *object, zval *off } else { SEPARATE_ARG_IF_REF(offset); } - zend_call_method_with_1_params(object, intern->std.ce, &intern->fptr_offset_get, "offsetGet", rv, offset); + zend_call_method_with_1_params_ex(object, intern->std.ce, &intern->fptr_offset_get, ZSTR_KNOWN(ZEND_STR_OFFSET_GET), rv, offset); zval_ptr_dtor(offset); if (!Z_ISUNDEF_P(rv)) { return rv; @@ -404,7 +404,7 @@ static void spl_fixedarray_object_write_dimension(zend_object *object, zval *off SEPARATE_ARG_IF_REF(offset); } SEPARATE_ARG_IF_REF(value); - zend_call_method_with_2_params(object, intern->std.ce, &intern->fptr_offset_set, "offsetSet", NULL, offset, value); + zend_call_method_with_2_params_ex(object, intern->std.ce, &intern->fptr_offset_set, ZSTR_KNOWN(ZEND_STR_OFFSET_SET), NULL, offset, value); zval_ptr_dtor(value); zval_ptr_dtor(offset); return; @@ -442,7 +442,7 @@ static void spl_fixedarray_object_unset_dimension(zend_object *object, zval *off if (intern->fptr_offset_del) { SEPARATE_ARG_IF_REF(offset); - zend_call_method_with_1_params(object, intern->std.ce, &intern->fptr_offset_del, "offsetUnset", NULL, offset); + zend_call_method_with_1_params_ex(object, intern->std.ce, &intern->fptr_offset_del, ZSTR_KNOWN(ZEND_STR_OFFSET_UNSET), NULL, offset); zval_ptr_dtor(offset); return; } @@ -487,7 +487,7 @@ static int spl_fixedarray_object_has_dimension(zend_object *object, zval *offset zend_bool result; SEPARATE_ARG_IF_REF(offset); - zend_call_method_with_1_params(object, intern->std.ce, &intern->fptr_offset_has, "offsetExists", &rv, offset); + zend_call_method_with_1_params_ex(object, intern->std.ce, &intern->fptr_offset_has, ZSTR_KNOWN(ZEND_STR_OFFSET_EXISTS), &rv, offset); zval_ptr_dtor(offset); result = zend_is_true(&rv); zval_ptr_dtor(&rv); @@ -505,7 +505,7 @@ static int spl_fixedarray_object_count_elements(zend_object *object, zend_long * intern = spl_fixed_array_from_obj(object); if (intern->fptr_count) { zval rv; - zend_call_method_with_0_params(object, intern->std.ce, &intern->fptr_count, "count", &rv); + zend_call_method_with_0_params_ex(object, intern->std.ce, &intern->fptr_count, ZSTR_KNOWN(ZEND_STR_COUNT), &rv); if (!Z_ISUNDEF(rv)) { *count = zval_get_long(&rv); zval_ptr_dtor(&rv); diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c index 42484a753b47..826e3df24cba 100644 --- a/ext/spl/spl_heap.c +++ b/ext/spl/spl_heap.c @@ -126,7 +126,7 @@ static void spl_ptr_heap_pqueue_elem_ctor(void *elem) { /* {{{ */ static int spl_ptr_heap_cmp_cb_helper(zval *object, spl_heap_object *heap_object, zval *a, zval *b, zend_long *result) { /* {{{ */ zval zresult; - zend_call_method_with_2_params(Z_OBJ_P(object), heap_object->std.ce, &heap_object->fptr_cmp, "compare", &zresult, a, b); + zend_call_method_with_2_params_ex(Z_OBJ_P(object), heap_object->std.ce, &heap_object->fptr_cmp, ZSTR_KNOWN(ZEND_STR_COMPARE), &zresult, a, b); if (EG(exception)) { return FAILURE; @@ -472,7 +472,7 @@ static int spl_heap_object_count_elements(zend_object *object, zend_long *count) if (intern->fptr_count) { zval rv; - zend_call_method_with_0_params(object, intern->std.ce, &intern->fptr_count, "count", &rv); + zend_call_method_with_0_params_ex(object, intern->std.ce, &intern->fptr_count, ZSTR_KNOWN(ZEND_STR_COUNT), &rv); if (!Z_ISUNDEF(rv)) { *count = zval_get_long(&rv); zval_ptr_dtor(&rv); diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index a6ccc855c0ef..2248850d1405 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -191,7 +191,7 @@ static int spl_recursive_it_valid_ex(spl_recursive_it_object *object, zval *zthi level--; } if (object->endIteration && object->in_iteration) { - zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->endIteration, "endIteration", NULL); + zend_call_method_with_0_params_ex(Z_OBJ_P(zthis), object->ce, &object->endIteration, ZSTR_KNOWN(ZEND_STR_END_ITERATION), NULL); } object->in_iteration = 0; return FAILURE; @@ -257,9 +257,9 @@ static void spl_recursive_it_move_forward_ex(spl_recursive_it_object *object, zv ce = object->iterators[object->level].ce; zobject = &object->iterators[object->level].zobject; if (object->callHasChildren) { - zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->callHasChildren, "callHasChildren", &retval); + zend_call_method_with_0_params_ex(Z_OBJ_P(zthis), object->ce, &object->callHasChildren, ZSTR_KNOWN(ZEND_STR_CALL_HAS_CHILDREN), &retval); } else { - zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, NULL, "haschildren", &retval); + zend_call_method_with_0_params_ex(Z_OBJ_P(zobject), ce, NULL, ZSTR_KNOWN(ZEND_STR_HAS_CHILDREN), &retval); } if (EG(exception)) { if (!(object->flags & RIT_CATCH_GET_CHILD)) { @@ -294,7 +294,7 @@ static void spl_recursive_it_move_forward_ex(spl_recursive_it_object *object, zv } } if (object->nextElement) { - zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->nextElement, "nextelement", NULL); + zend_call_method_with_0_params_ex(Z_OBJ_P(zthis), object->ce, &object->nextElement, ZSTR_KNOWN(ZEND_STR_NEXT_ELEMENT), NULL); } object->iterators[object->level].state = RS_NEXT; if (EG(exception)) { @@ -307,7 +307,7 @@ static void spl_recursive_it_move_forward_ex(spl_recursive_it_object *object, zv return /* self */; case RS_SELF: if (object->nextElement && (object->mode == RIT_SELF_FIRST || object->mode == RIT_CHILD_FIRST)) { - zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->nextElement, "nextelement", NULL); + zend_call_method_with_0_params_ex(Z_OBJ_P(zthis), object->ce, &object->nextElement, ZSTR_KNOWN(ZEND_STR_NEXT_ELEMENT), NULL); } if (object->mode == RIT_SELF_FIRST) { object->iterators[object->level].state = RS_CHILD; @@ -319,9 +319,9 @@ static void spl_recursive_it_move_forward_ex(spl_recursive_it_object *object, zv ce = object->iterators[object->level].ce; zobject = &object->iterators[object->level].zobject; if (object->callGetChildren) { - zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->callGetChildren, "callGetChildren", &child); + zend_call_method_with_0_params_ex(Z_OBJ_P(zthis), object->ce, &object->callGetChildren, ZSTR_KNOWN(ZEND_STR_CALL_GET_CHILDREN), &child); } else { - zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, NULL, "getchildren", &child); + zend_call_method_with_0_params_ex(Z_OBJ_P(zobject), ce, NULL, ZSTR_KNOWN(ZEND_STR_GET_CHILDREN), &child); } if (EG(exception)) { @@ -357,7 +357,7 @@ static void spl_recursive_it_move_forward_ex(spl_recursive_it_object *object, zv sub_iter->funcs->rewind(sub_iter); } if (object->beginChildren) { - zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->beginChildren, "beginchildren", NULL); + zend_call_method_with_0_params_ex(Z_OBJ_P(zthis), object->ce, &object->beginChildren, ZSTR_KNOWN(ZEND_STR_BEGIN_CHILDREN), NULL); if (EG(exception)) { if (!(object->flags & RIT_CATCH_GET_CHILD)) { return; @@ -371,7 +371,7 @@ static void spl_recursive_it_move_forward_ex(spl_recursive_it_object *object, zv /* no more elements */ if (object->level > 0) { if (object->endChildren) { - zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->endChildren, "endchildren", NULL); + zend_call_method_with_0_params_ex(Z_OBJ_P(zthis), object->ce, &object->endChildren, ZSTR_KNOWN(ZEND_STR_END_CHILDREN), NULL); if (EG(exception)) { if (!(object->flags & RIT_CATCH_GET_CHILD)) { return; @@ -405,7 +405,7 @@ static void spl_recursive_it_rewind_ex(spl_recursive_it_object *object, zval *zt zend_iterator_dtor(sub_iter); zval_ptr_dtor(&object->iterators[object->level--].zobject); if (!EG(exception) && (!object->endChildren || object->endChildren->common.scope != spl_ce_RecursiveIteratorIterator)) { - zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->endChildren, "endchildren", NULL); + zend_call_method_with_0_params_ex(Z_OBJ_P(zthis), object->ce, &object->endChildren, ZSTR_KNOWN(ZEND_STR_END_CHILDREN), NULL); } } object->iterators = erealloc(object->iterators, sizeof(spl_sub_iterator)); @@ -415,7 +415,7 @@ static void spl_recursive_it_rewind_ex(spl_recursive_it_object *object, zval *zt sub_iter->funcs->rewind(sub_iter); } if (!EG(exception) && object->beginIteration && !object->in_iteration) { - zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->beginIteration, "beginIteration", NULL); + zend_call_method_with_0_params_ex(Z_OBJ_P(zthis), object->ce, &object->beginIteration, ZSTR_KNOWN(ZEND_STR_BEGIN_ITERATION), NULL); } object->in_iteration = 1; spl_recursive_it_move_forward_ex(object, zthis); @@ -488,7 +488,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling); if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate)) { - zend_call_method_with_0_params(Z_OBJ_P(iterator), Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator, "getiterator", &aggregate_retval); + zend_call_method_with_0_params_ex(Z_OBJ_P(iterator), Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator, ZSTR_KNOWN(ZEND_STR_GET_ITERATOR), &aggregate_retval); iterator = &aggregate_retval; } else { Z_ADDREF_P(iterator); @@ -511,7 +511,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling); if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate)) { - zend_call_method_with_0_params(Z_OBJ_P(iterator), Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator, "getiterator", &aggregate_retval); + zend_call_method_with_0_params_ex(Z_OBJ_P(iterator), Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator, ZSTR_KNOWN(ZEND_STR_GET_ITERATOR), &aggregate_retval); iterator = &aggregate_retval; } else { Z_ADDREF_P(iterator); @@ -769,7 +769,7 @@ PHP_METHOD(RecursiveIteratorIterator, callHasChildren) if (Z_TYPE_P(zobject) == IS_UNDEF) { RETURN_FALSE; } else { - zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, NULL, "haschildren", return_value); + zend_call_method_with_0_params_ex(Z_OBJ_P(zobject), ce, NULL, ZSTR_KNOWN(ZEND_STR_HAS_CHILDREN), return_value); if (Z_TYPE_P(return_value) == IS_UNDEF) { RETURN_FALSE; } @@ -794,7 +794,7 @@ PHP_METHOD(RecursiveIteratorIterator, callGetChildren) if (Z_TYPE_P(zobject) == IS_UNDEF) { return; } else { - zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, NULL, "getchildren", return_value); + zend_call_method_with_0_params_ex(Z_OBJ_P(zobject), ce, NULL, ZSTR_KNOWN(ZEND_STR_GET_CHILDREN), return_value); if (Z_TYPE_P(return_value) == IS_UNDEF) { RETURN_NULL(); } @@ -985,7 +985,7 @@ static void spl_recursive_tree_iterator_get_prefix(spl_recursive_it_object *obje smart_str_appendl(&str, ZSTR_VAL(object->prefix[0].s), ZSTR_LEN(object->prefix[0].s)); for (level = 0; level < object->level; ++level) { - zend_call_method_with_0_params(Z_OBJ(object->iterators[level].zobject), object->iterators[level].ce, NULL, "hasnext", &has_next); + zend_call_method_with_0_params_ex(Z_OBJ(object->iterators[level].zobject), object->iterators[level].ce, NULL, ZSTR_KNOWN(ZEND_STR_HASNEXT), &has_next); if (Z_TYPE(has_next) != IS_UNDEF) { if (Z_TYPE(has_next) == IS_TRUE) { smart_str_appendl(&str, ZSTR_VAL(object->prefix[1].s), ZSTR_LEN(object->prefix[1].s)); @@ -995,7 +995,7 @@ static void spl_recursive_tree_iterator_get_prefix(spl_recursive_it_object *obje zval_ptr_dtor(&has_next); } } - zend_call_method_with_0_params(Z_OBJ(object->iterators[level].zobject), object->iterators[level].ce, NULL, "hasnext", &has_next); + zend_call_method_with_0_params_ex(Z_OBJ(object->iterators[level].zobject), object->iterators[level].ce, NULL, ZSTR_KNOWN(ZEND_STR_HASNEXT), &has_next); if (Z_TYPE(has_next) != IS_UNDEF) { if (Z_TYPE(has_next) == IS_TRUE) { smart_str_appendl(&str, ZSTR_VAL(object->prefix[3].s), ZSTR_LEN(object->prefix[3].s)); @@ -1363,7 +1363,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z ce = ce_cast; } if (instanceof_function(ce, zend_ce_aggregate)) { - zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, &ce->iterator_funcs_ptr->zf_new_iterator, "getiterator", &retval); + zend_call_method_with_0_params_ex(Z_OBJ_P(zobject), ce, &ce->iterator_funcs_ptr->zf_new_iterator, ZSTR_KNOWN(ZEND_STR_GET_ITERATOR), &retval); if (EG(exception)) { zval_ptr_dtor(&retval); return NULL; @@ -1385,7 +1385,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z } zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling); spl_instantiate(spl_ce_ArrayIterator, &intern->u.append.zarrayit); - zend_call_method_with_0_params(Z_OBJ(intern->u.append.zarrayit), spl_ce_ArrayIterator, &spl_ce_ArrayIterator->constructor, "__construct", NULL); + zend_call_method_with_0_params_ex(Z_OBJ(intern->u.append.zarrayit), spl_ce_ArrayIterator, &spl_ce_ArrayIterator->constructor, ZSTR_KNOWN(ZEND_STR_MAGIC_CONSTRUCT), NULL); intern->u.append.iterator = spl_ce_ArrayIterator->get_iterator(spl_ce_ArrayIterator, &intern->u.append.zarrayit, 0); zend_restore_error_handling(&error_handling); return intern; @@ -1681,7 +1681,7 @@ static inline void spl_filter_it_fetch(zval *zthis, spl_dual_it_object *intern) zval retval; while (spl_dual_it_fetch(intern, 1) == SUCCESS) { - zend_call_method_with_0_params(Z_OBJ_P(zthis), intern->std.ce, NULL, "accept", &retval); + zend_call_method_with_0_params_ex(Z_OBJ_P(zthis), intern->std.ce, NULL, ZSTR_KNOWN(ZEND_STR_ACCEPT), &retval); if (Z_TYPE(retval) != IS_UNDEF) { if (zend_is_true(&retval)) { zval_ptr_dtor(&retval); @@ -1764,7 +1764,7 @@ PHP_METHOD(RecursiveFilterIterator, hasChildren) SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS); - zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "haschildren", return_value); + zend_call_method_with_0_params_ex(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, ZSTR_KNOWN(ZEND_STR_HAS_CHILDREN), return_value); } /* }}} */ /* {{{ proto RecursiveFilterIterator RecursiveFilterIterator::getChildren() @@ -1780,7 +1780,7 @@ PHP_METHOD(RecursiveFilterIterator, getChildren) SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS); - zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "getchildren", &retval); + zend_call_method_with_0_params_ex(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, ZSTR_KNOWN(ZEND_STR_GET_CHILDREN), &retval); if (!EG(exception) && Z_TYPE(retval) != IS_UNDEF) { spl_instantiate_arg_ex1(Z_OBJCE_P(ZEND_THIS), return_value, &retval); } @@ -1800,7 +1800,7 @@ PHP_METHOD(RecursiveCallbackFilterIterator, getChildren) SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS); - zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "getchildren", &retval); + zend_call_method_with_0_params_ex(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, ZSTR_KNOWN(ZEND_STR_GET_CHILDREN), &retval); if (!EG(exception) && Z_TYPE(retval) != IS_UNDEF) { spl_instantiate_arg_ex2(Z_OBJCE_P(ZEND_THIS), return_value, &retval, &intern->u.cbfilter->fci.function_name); } @@ -2091,7 +2091,7 @@ PHP_METHOD(RecursiveRegexIterator, getChildren) SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS); - zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "getchildren", &retval); + zend_call_method_with_0_params_ex(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, ZSTR_KNOWN(ZEND_STR_GET_CHILDREN), &retval); if (!EG(exception)) { zval args[5]; @@ -2125,7 +2125,7 @@ PHP_METHOD(RecursiveRegexIterator, accept) RETURN_BOOL(zend_hash_num_elements(Z_ARRVAL(intern->current.data)) > 0); } - zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), spl_ce_RegexIterator, NULL, "accept", return_value); + zend_call_method_with_0_params_ex(Z_OBJ_P(ZEND_THIS), spl_ce_RegexIterator, NULL, ZSTR_KNOWN(ZEND_STR_ACCEPT), return_value); } /* {{{ spl_dual_it_dtor */ @@ -2232,7 +2232,7 @@ static inline void spl_limit_it_seek(spl_dual_it_object *intern, zend_long pos) if (pos != intern->current.pos && instanceof_function(intern->inner.ce, spl_ce_SeekableIterator)) { ZVAL_LONG(&zpos, pos); spl_dual_it_free(intern); - zend_call_method_with_1_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "seek", NULL, &zpos); + zend_call_method_with_1_params_ex(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, ZSTR_KNOWN(ZEND_STR_SEEK), NULL, &zpos); if (!EG(exception)) { intern->current.pos = pos; if (spl_limit_it_valid(intern) == SUCCESS) { @@ -2365,7 +2365,7 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern) /* Recursion ? */ if (intern->dit_type == DIT_RecursiveCachingIterator) { zval retval, zchildren, zflags; - zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "haschildren", &retval); + zend_call_method_with_0_params_ex(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, ZSTR_KNOWN(ZEND_STR_HAS_CHILDREN), &retval); if (EG(exception)) { zval_ptr_dtor(&retval); if (intern->u.caching.flags & CIT_CATCH_GET_CHILD) { @@ -2375,7 +2375,7 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern) } } else { if (zend_is_true(&retval)) { - zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "getchildren", &zchildren); + zend_call_method_with_0_params_ex(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, ZSTR_KNOWN(ZEND_STR_GET_CHILDREN), &zchildren); if (EG(exception)) { zval_ptr_dtor(&zchildren); if (intern->u.caching.flags & CIT_CATCH_GET_CHILD) { diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index bcf3a3953592..9557ab7ca058 100644 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -78,8 +78,8 @@ void spl_SplObjectStorage_free_storage(zend_object *object) /* {{{ */ static int spl_object_storage_get_hash(zend_hash_key *key, spl_SplObjectStorage *intern, zval *obj) { if (intern->fptr_get_hash) { zval rv; - zend_call_method_with_1_params( - &intern->std, intern->std.ce, &intern->fptr_get_hash, "getHash", &rv, obj); + zend_call_method_with_1_params_ex( + &intern->std, intern->std.ce, &intern->fptr_get_hash, ZSTR_KNOWN(ZEND_STR_GET_HASH), &rv, obj); if (!Z_ISUNDEF(rv)) { if (Z_TYPE(rv) == IS_STRING) { key->key = Z_STR(rv); @@ -1034,7 +1034,7 @@ PHP_METHOD(MultipleIterator, rewind) zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos); while ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) != NULL && !EG(exception)) { it = &element->obj; - zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_rewind, "rewind", NULL); + zend_call_method_with_0_params_ex(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_rewind, ZSTR_KNOWN(ZEND_STR_REWIND), NULL); zend_hash_move_forward_ex(&intern->storage, &intern->pos); } } @@ -1057,7 +1057,7 @@ PHP_METHOD(MultipleIterator, next) zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos); while ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) != NULL && !EG(exception)) { it = &element->obj; - zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_next, "next", NULL); + zend_call_method_with_0_params_ex(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_next, ZSTR_KNOWN(ZEND_STR_NEXT), NULL); zend_hash_move_forward_ex(&intern->storage, &intern->pos); } } @@ -1087,7 +1087,7 @@ PHP_METHOD(MultipleIterator, valid) zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos); while ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) != NULL && !EG(exception)) { it = &element->obj; - zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_valid, "valid", &retval); + zend_call_method_with_0_params_ex(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_valid, ZSTR_KNOWN(ZEND_STR_VALID), &retval); if (!Z_ISUNDEF(retval)) { valid = (Z_TYPE(retval) == IS_TRUE); @@ -1123,7 +1123,7 @@ static void spl_multiple_iterator_get_all(spl_SplObjectStorage *intern, int get_ zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos); while ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) != NULL && !EG(exception)) { it = &element->obj; - zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_valid, "valid", &retval); + zend_call_method_with_0_params_ex(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_valid, ZSTR_KNOWN(ZEND_STR_VALID), &retval); if (!Z_ISUNDEF(retval)) { valid = Z_TYPE(retval) == IS_TRUE; @@ -1134,9 +1134,9 @@ static void spl_multiple_iterator_get_all(spl_SplObjectStorage *intern, int get_ if (valid) { if (SPL_MULTIPLE_ITERATOR_GET_ALL_CURRENT == get_type) { - zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_current, "current", &retval); + zend_call_method_with_0_params_ex(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_current, ZSTR_KNOWN(ZEND_STR_CURRENT), &retval); } else { - zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_key, "key", &retval); + zend_call_method_with_0_params_ex(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_key, ZSTR_KNOWN(ZEND_STR_KEY), &retval); } if (Z_ISUNDEF(retval)) { zend_throw_exception(spl_ce_RuntimeException, "Failed to call sub iterator method", 0); diff --git a/ext/standard/array.c b/ext/standard/array.c index 1789dd52d248..61bfddfd4656 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -736,7 +736,7 @@ PHP_FUNCTION(count) } /* if not and the object implements Countable we call its count() method */ if (instanceof_function(Z_OBJCE_P(array), zend_ce_countable)) { - zend_call_method_with_0_params(Z_OBJ_P(array), NULL, NULL, "count", &retval); + zend_call_method_with_0_params_ex(Z_OBJ_P(array), NULL, NULL, ZSTR_KNOWN(ZEND_STR_COUNT), &retval); if (Z_TYPE(retval) != IS_UNDEF) { RETVAL_LONG(zval_get_long(&retval)); zval_ptr_dtor(&retval); diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index d06895234370..48b11d39d7b0 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -1070,7 +1070,7 @@ static int do_cli(int argc, char **argv) /* {{{ */ memset(&execute_data, 0, sizeof(zend_execute_data)); EG(current_execute_data) = &execute_data; - zend_call_method_with_1_params(Z_OBJ(ref), pce, &pce->constructor, "__construct", NULL, &arg); + zend_call_method_with_1_params_ex(Z_OBJ(ref), pce, &pce->constructor, ZSTR_KNOWN(ZEND_STR_MAGIC_CONSTRUCT), NULL, &arg); if (EG(exception)) { zval tmp, *msg, rv; diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c index 14e09d72432f..19f4f20d2d26 100644 --- a/sapi/phpdbg/phpdbg_prompt.c +++ b/sapi/phpdbg/phpdbg_prompt.c @@ -726,7 +726,7 @@ static inline void phpdbg_handle_exception(void) /* {{{ */ EG(exception) = NULL; ZVAL_OBJ(&zv, ex); - zend_call_method_with_0_params(ex, ex->ce, &ex->ce->__tostring, "__tostring", &tmp); + zend_call_method_with_0_params_ex(ex, ex->ce, &ex->ce->__tostring, ZSTR_KNOWN(ZEND_STR_MAGIC_TO_STRING), &tmp); file = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("file"), 1, &rv)); line = zval_get_long(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("line"), 1, &rv));