diff options
author | Dmitry Stogov <dmitry@zend.com> | 2018-07-02 17:03:50 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2018-07-02 17:03:50 +0300 |
commit | 091d77f28a78a700ce0e72457606e01ed696de83 (patch) | |
tree | 3167f9e6df3b4f4935c3cc0b5d65d421d472f2a3 | |
parent | 43aca3118ab011b878ec577904eafc18f86f69ae (diff) | |
download | php-git-091d77f28a78a700ce0e72457606e01ed696de83.tar.gz |
Avoid magic method hash lookups
-rw-r--r-- | Zend/zend_exceptions.c | 2 | ||||
-rw-r--r-- | ext/intl/calendar/calendar_methods.cpp | 4 | ||||
-rw-r--r-- | ext/intl/timezone/timezone_class.cpp | 2 | ||||
-rw-r--r-- | sapi/phpdbg/phpdbg_prompt.c | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 72a3c806e5..81ee386e56 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -984,7 +984,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(&exception, ce_exception, NULL, "__tostring", &tmp); + zend_call_method_with_0_params(&exception, ce_exception, &ex->ce->__tostring, "__tostring", &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)); diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp index 8c6aaed103..f5e0daf149 100644 --- a/ext/intl/calendar/calendar_methods.cpp +++ b/ext/intl/calendar/calendar_methods.cpp @@ -1141,7 +1141,7 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time) if (!(Z_TYPE_P(zv_arg) == IS_OBJECT && instanceof_function( Z_OBJCE_P(zv_arg), php_date_get_date_ce()))) { object_init_ex(&zv_tmp, php_date_get_date_ce()); - zend_call_method_with_1_params(&zv_tmp, NULL, NULL, "__construct", NULL, zv_arg); + zend_call_method_with_1_params(&zv_tmp, NULL, &Z_OBJCE(zv_tmp)->constructor, "__construct", NULL, zv_arg); zv_datetime = &zv_tmp; if (EG(exception)) { zend_object_store_ctor_failed(Z_OBJ(zv_tmp)); @@ -1257,7 +1257,7 @@ U_CFUNC PHP_FUNCTION(intlcal_to_date_time) /* Finally, instantiate object and call constructor */ object_init_ex(return_value, php_date_get_date_ce()); - zend_call_method_with_2_params(return_value, NULL, NULL, "__construct", NULL, &ts_zval, timezone_zval); + zend_call_method_with_2_params(return_value, NULL, &Z_OBJCE_P(return_value)->constructor, "__construct", NULL, &ts_zval, timezone_zval); if (EG(exception)) { intl_errors_set(CALENDAR_ERROR_P(co), U_ILLEGAL_ARGUMENT_ERROR, "intlcal_to_date_time: DateTime constructor has thrown exception", diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp index 2bf8c990ab..929797a96e 100644 --- a/ext/intl/timezone/timezone_class.cpp +++ b/ext/intl/timezone/timezone_class.cpp @@ -98,7 +98,7 @@ U_CFUNC zval *timezone_convert_to_datetimezone(const TimeZone *timeZone, goto error; } ZVAL_STR(&arg, u8str); - zend_call_method_with_1_params(ret, NULL, NULL, "__construct", NULL, &arg); + zend_call_method_with_1_params(ret, NULL, &Z_OBJCE_P(ret)->constructor, "__construct", NULL, &arg); if (EG(exception)) { spprintf(&message, 0, "%s: DateTimeZone constructor threw exception", func); diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c index 220288493e..067ae73913 100644 --- a/sapi/phpdbg/phpdbg_prompt.c +++ b/sapi/phpdbg/phpdbg_prompt.c @@ -775,7 +775,7 @@ static inline void phpdbg_handle_exception(void) /* {{{ */ EG(exception) = NULL; ZVAL_OBJ(&zv, ex); - zend_call_method_with_0_params(&zv, ex->ce, NULL, "__tostring", &tmp); + zend_call_method_with_0_params(&zv, ex->ce, &ex->ce->__tostring, "__tostring", &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)); |