ext/intl: Call DateTimeInterface::getTimestamp() directly (#17487)

This commit is contained in:
Gina Peter Banyard 2025-01-19 17:28:36 +00:00 committed by GitHub
parent b8ee4c2b19
commit a100450cd9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 28 deletions

View file

@ -64,8 +64,8 @@ static bool valid_format(zval *z) {
U_CFUNC PHP_FUNCTION(datefmt_format_object)
{
zval *object,
*format = NULL;
zend_object *object;
zval *format = NULL;
char *locale_str = NULL;
size_t locale_len;
bool pattern = false;
@ -78,7 +78,7 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object)
timeStyle = DateFormat::kDefault;
ZEND_PARSE_PARAMETERS_START(1, 3)
Z_PARAM_OBJECT(object)
Z_PARAM_OBJ(object)
Z_PARAM_OPTIONAL
Z_PARAM_ZVAL(format)
Z_PARAM_STRING_OR_NULL(locale_str, locale_len)
@ -149,9 +149,9 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object)
timeStyle = (DateFormat::EStyle)(timeStyle & ~DateFormat::kRelative);
}
zend_class_entry *instance_ce = Z_OBJCE_P(object);
zend_class_entry *instance_ce = object->ce;
if (instanceof_function(instance_ce, Calendar_ce_ptr)) {
Calendar *obj_cal = calendar_fetch_native_calendar(Z_OBJ_P(object));
Calendar *obj_cal = calendar_fetch_native_calendar(object);
if (obj_cal == NULL) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"datefmt_format_object: bad IntlCalendar instance: "