From ab34c77a5a9c8611d1fc87601fcd72c9defb809d Mon Sep 17 00:00:00 2001 From: USAMI Kenta Date: Thu, 11 Jul 2019 18:54:00 +0900 Subject: [PATCH] Fix return value when DateTimeImmutable::createFromFormat() for PHP 5 --- timecop_php5.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/timecop_php5.c b/timecop_php5.c index 316d74a..5c16177 100644 --- a/timecop_php5.c +++ b/timecop_php5.c @@ -1520,6 +1520,12 @@ static void _timecop_date_create_from_format(INTERNAL_FUNCTION_PARAMETERS, int i if (memchr(orig_format_str, '!', orig_format_len) || memchr(orig_format_str, '|', orig_format_len)) { + + if (immutable) { + call_php_function_with_3_params(ORIG_FUNC_NAME("date_create_immutable_from_format"), &new_dt, &orig_format, &orig_time, orig_timezone); + RETURN_ZVAL(new_dt, 1, 1); + } + RETURN_ZVAL(dt, 1, 1); }