summaryrefslogtreecommitdiffstats
path: root/ab34c77a5a9c8611d1fc87601fcd72c9defb809d.patch
blob: 9ca56058858d044790023739ea65cc86cf80dbea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
From ab34c77a5a9c8611d1fc87601fcd72c9defb809d Mon Sep 17 00:00:00 2001
From: USAMI Kenta <tadsan@zonu.me>
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);
 	}