Skip to content

Commit 091d77f

Browse files
committed
Avoid magic method hash lookups
1 parent 43aca31 commit 091d77f

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

Zend/zend_exceptions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ ZEND_API ZEND_COLD void zend_exception_error(zend_object *ex, int severity) /* {
984984
zend_string *str, *file = NULL;
985985
zend_long line = 0;
986986

987-
zend_call_method_with_0_params(&exception, ce_exception, NULL, "__tostring", &tmp);
987+
zend_call_method_with_0_params(&exception, ce_exception, &ex->ce->__tostring, "__tostring", &tmp);
988988
if (!EG(exception)) {
989989
if (Z_TYPE(tmp) != IS_STRING) {
990990
zend_error(E_WARNING, "%s::__toString() must return a string", ZSTR_VAL(ce_exception->name));

ext/intl/calendar/calendar_methods.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time)
11411141
if (!(Z_TYPE_P(zv_arg) == IS_OBJECT && instanceof_function(
11421142
Z_OBJCE_P(zv_arg), php_date_get_date_ce()))) {
11431143
object_init_ex(&zv_tmp, php_date_get_date_ce());
1144-
zend_call_method_with_1_params(&zv_tmp, NULL, NULL, "__construct", NULL, zv_arg);
1144+
zend_call_method_with_1_params(&zv_tmp, NULL, &Z_OBJCE(zv_tmp)->constructor, "__construct", NULL, zv_arg);
11451145
zv_datetime = &zv_tmp;
11461146
if (EG(exception)) {
11471147
zend_object_store_ctor_failed(Z_OBJ(zv_tmp));
@@ -1257,7 +1257,7 @@ U_CFUNC PHP_FUNCTION(intlcal_to_date_time)
12571257

12581258
/* Finally, instantiate object and call constructor */
12591259
object_init_ex(return_value, php_date_get_date_ce());
1260-
zend_call_method_with_2_params(return_value, NULL, NULL, "__construct", NULL, &ts_zval, timezone_zval);
1260+
zend_call_method_with_2_params(return_value, NULL, &Z_OBJCE_P(return_value)->constructor, "__construct", NULL, &ts_zval, timezone_zval);
12611261
if (EG(exception)) {
12621262
intl_errors_set(CALENDAR_ERROR_P(co), U_ILLEGAL_ARGUMENT_ERROR,
12631263
"intlcal_to_date_time: DateTime constructor has thrown exception",

ext/intl/timezone/timezone_class.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ U_CFUNC zval *timezone_convert_to_datetimezone(const TimeZone *timeZone,
9898
goto error;
9999
}
100100
ZVAL_STR(&arg, u8str);
101-
zend_call_method_with_1_params(ret, NULL, NULL, "__construct", NULL, &arg);
101+
zend_call_method_with_1_params(ret, NULL, &Z_OBJCE_P(ret)->constructor, "__construct", NULL, &arg);
102102
if (EG(exception)) {
103103
spprintf(&message, 0,
104104
"%s: DateTimeZone constructor threw exception", func);

sapi/phpdbg/phpdbg_prompt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ static inline void phpdbg_handle_exception(void) /* {{{ */
775775
EG(exception) = NULL;
776776

777777
ZVAL_OBJ(&zv, ex);
778-
zend_call_method_with_0_params(&zv, ex->ce, NULL, "__tostring", &tmp);
778+
zend_call_method_with_0_params(&zv, ex->ce, &ex->ce->__tostring, "__tostring", &tmp);
779779
file = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("file"), 1, &rv));
780780
line = zval_get_long(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("line"), 1, &rv));
781781

0 commit comments

Comments
 (0)