summaryrefslogtreecommitdiffstats
path: root/61748491a773a7f47694e2fd97dc2c3c61ce9f18.patch
diff options
context:
space:
mode:
Diffstat (limited to '61748491a773a7f47694e2fd97dc2c3c61ce9f18.patch')
-rw-r--r--61748491a773a7f47694e2fd97dc2c3c61ce9f18.patch171
1 files changed, 171 insertions, 0 deletions
diff --git a/61748491a773a7f47694e2fd97dc2c3c61ce9f18.patch b/61748491a773a7f47694e2fd97dc2c3c61ce9f18.patch
new file mode 100644
index 0000000..d9710e8
--- /dev/null
+++ b/61748491a773a7f47694e2fd97dc2c3c61ce9f18.patch
@@ -0,0 +1,171 @@
+From 61748491a773a7f47694e2fd97dc2c3c61ce9f18 Mon Sep 17 00:00:00 2001
+From: Yoshio HANAWA <y@hnw.jp>
+Date: Wed, 2 Oct 2019 23:53:44 +0900
+Subject: [PATCH] Refactoring
+
+---
+ .travis.yml | 3 +--
+ tests/date_007.phpt | 2 +-
+ tests/date_008.phpt | 2 +-
+ tests/date_override_007.phpt | 2 +-
+ tests/date_override_008.phpt | 2 +-
+ tests/immutable_007.phpt | 2 +-
+ tests/immutable_008.phpt | 2 +-
+ tests/immutable_override_007.phpt | 2 +-
+ tests/immutable_override_008.phpt | 2 +-
+ timecop_php7.c | 17 ++++++++---------
+ 10 files changed, 17 insertions(+), 19 deletions(-)
+
+diff --git a/tests/date_007.phpt b/tests/date_007.phpt
+index db490d8..759c09c 100644
+--- a/tests/date_007.phpt
++++ b/tests/date_007.phpt
+@@ -58,7 +58,7 @@ string\(32\) "2010-09-02 03:04:05\.000000-07:00"
+ string\(32\) "2010-12-24 03:04:05\.000000-08:00"
+ string\(32\) "2010-01-02 05:00:00\.000000\+09:00"
+ string\(32\) "2010-01-02 00:00:59\.000000-08:00"
+-string\(32\) "2010-01-02 (00|03):(00|04):(00|05)\.654321-08:00"
++string\(32\) "2010-01-02 (00:00:00|03:04:05)\.654321-08:00"
+ string\(32\) "2012-03-31 12:34:56\.000000-07:00"
+ string\(32\) "1970-01-01 12:34:56\.000000-08:00"
+ string\(32\) "1970-01-01 19:00:00\.000000-05:00"
+diff --git a/tests/date_008.phpt b/tests/date_008.phpt
+index 851c953..b91c833 100644
+--- a/tests/date_008.phpt
++++ b/tests/date_008.phpt
+@@ -59,7 +59,7 @@ string\(32\) "2010-09-02 03:04:05\.000000-07:00"
+ string\(32\) "2010-12-24 03:04:05\.000000-08:00"
+ string\(32\) "2010-01-02 05:00:00\.000000\+09:00"
+ string\(32\) "2010-01-02 00:00:59\.000000-08:00"
+-string\(32\) "2010-01-02 (00|03):(00|04):(00|05)\.654321-08:00"
++string\(32\) "2010-01-02 (00:00:00|03:04:05)\.654321-08:00"
+ string\(32\) "2012-03-31 12:34:56\.000000-07:00"
+ string\(32\) "1970-01-01 12:34:56\.000000-08:00"
+ string\(32\) "1970-01-01 19:00:00\.000000-05:00"
+diff --git a/tests/date_override_007.phpt b/tests/date_override_007.phpt
+index 6dd8311..c34708f 100644
+--- a/tests/date_override_007.phpt
++++ b/tests/date_override_007.phpt
+@@ -60,7 +60,7 @@ string\(32\) "2010-09-02 03:04:05\.000000-07:00"
+ string\(32\) "2010-12-24 03:04:05\.000000-08:00"
+ string\(32\) "2010-01-02 05:00:00\.000000\+09:00"
+ string\(32\) "2010-01-02 00:00:59\.000000-08:00"
+-string\(32\) "2010-01-02 (00|03):(00|04):(00|05)\.654321-08:00"
++string\(32\) "2010-01-02 (00:00:00|03:04:05)\.654321-08:00"
+ string\(32\) "2012-03-31 12:34:56\.000000-07:00"
+ string\(32\) "1970-01-01 12:34:56\.000000-08:00"
+ string\(32\) "1970-01-01 19:00:00\.000000-05:00"
+diff --git a/tests/date_override_008.phpt b/tests/date_override_008.phpt
+index 8d38c04..1764c0a 100644
+--- a/tests/date_override_008.phpt
++++ b/tests/date_override_008.phpt
+@@ -61,7 +61,7 @@ string\(32\) "2010-09-02 03:04:05\.000000-07:00"
+ string\(32\) "2010-12-24 03:04:05\.000000-08:00"
+ string\(32\) "2010-01-02 05:00:00\.000000\+09:00"
+ string\(32\) "2010-01-02 00:00:59\.000000-08:00"
+-string\(32\) "2010-01-02 (00|03):(00|04):(00|05)\.654321-08:00"
++string\(32\) "2010-01-02 (00:00:00|03:04:05)\.654321-08:00"
+ string\(32\) "2012-03-31 12:34:56\.000000-07:00"
+ string\(32\) "1970-01-01 12:34:56\.000000-08:00"
+ string\(32\) "1970-01-01 19:00:00\.000000-05:00"
+diff --git a/tests/immutable_007.phpt b/tests/immutable_007.phpt
+index 3bcf5c0..36249d2 100644
+--- a/tests/immutable_007.phpt
++++ b/tests/immutable_007.phpt
+@@ -58,7 +58,7 @@ string\(32\) "2010-09-02 03:04:05\.000000-07:00"
+ string\(32\) "2010-12-24 03:04:05\.000000-08:00"
+ string\(32\) "2010-01-02 05:00:00\.000000\+09:00"
+ string\(32\) "2010-01-02 00:00:59\.000000-08:00"
+-string\(32\) "2010-01-02 (00|03):(00|04):(00|05)\.654321-08:00"
++string\(32\) "2010-01-02 (00:00:00|03:04:05)\.654321-08:00"
+ string\(32\) "2012-03-31 12:34:56\.000000-07:00"
+ string\(32\) "1970-01-01 12:34:56\.000000-08:00"
+ string\(32\) "1970-01-01 19:00:00\.000000-05:00"
+diff --git a/tests/immutable_008.phpt b/tests/immutable_008.phpt
+index 8fd738f..06f1539 100644
+--- a/tests/immutable_008.phpt
++++ b/tests/immutable_008.phpt
+@@ -59,7 +59,7 @@ string\(32\) "2010-09-02 03:04:05\.000000-07:00"
+ string\(32\) "2010-12-24 03:04:05\.000000-08:00"
+ string\(32\) "2010-01-02 05:00:00\.000000\+09:00"
+ string\(32\) "2010-01-02 00:00:59\.000000-08:00"
+-string\(32\) "2010-01-02 (00|03):(00|04):(00|05)\.654321-08:00"
++string\(32\) "2010-01-02 (00:00:00|03:04:05)\.654321-08:00"
+ string\(32\) "2012-03-31 12:34:56\.000000-07:00"
+ string\(32\) "1970-01-01 12:34:56\.000000-08:00"
+ string\(32\) "1970-01-01 19:00:00\.000000-05:00"
+diff --git a/tests/immutable_override_007.phpt b/tests/immutable_override_007.phpt
+index 7d26767..38390ab 100644
+--- a/tests/immutable_override_007.phpt
++++ b/tests/immutable_override_007.phpt
+@@ -60,7 +60,7 @@ string\(32\) "2010-09-02 03:04:05\.000000-07:00"
+ string\(32\) "2010-12-24 03:04:05\.000000-08:00"
+ string\(32\) "2010-01-02 05:00:00\.000000\+09:00"
+ string\(32\) "2010-01-02 00:00:59\.000000-08:00"
+-string\(32\) "2010-01-02 (00|03):(00|04):(00|05)\.654321-08:00"
++string\(32\) "2010-01-02 (00:00:00|03:04:05)\.654321-08:00"
+ string\(32\) "2012-03-31 12:34:56\.000000-07:00"
+ string\(32\) "1970-01-01 12:34:56\.000000-08:00"
+ string\(32\) "1970-01-01 19:00:00\.000000-05:00"
+diff --git a/tests/immutable_override_008.phpt b/tests/immutable_override_008.phpt
+index 567ae25..b7dfa4a 100644
+--- a/tests/immutable_override_008.phpt
++++ b/tests/immutable_override_008.phpt
+@@ -66,7 +66,7 @@ string\(32\) "2010-09-02 03:04:05\.000000-07:00"
+ string\(32\) "2010-12-24 03:04:05\.000000-08:00"
+ string\(32\) "2010-01-02 05:00:00\.000000\+09:00"
+ string\(32\) "2010-01-02 00:00:59\.000000-08:00"
+-string\(32\) "2010-01-02 (00|03):(00|04):(00|05)\.654321-08:00"
++string\(32\) "2010-01-02 (00:00:00|03:04:05)\.654321-08:00"
+ string\(32\) "2012-03-31 12:34:56\.000000-07:00"
+ string\(32\) "1970-01-01 12:34:56\.000000-08:00"
+ string\(32\) "1970-01-01 19:00:00\.000000-05:00"
+diff --git a/timecop_php7.c b/timecop_php7.c
+index df430cd..0e95945 100644
+--- a/timecop_php7.c
++++ b/timecop_php7.c
+@@ -1433,6 +1433,8 @@ static void _timecop_date_create_from_format(INTERNAL_FUNCTION_PARAMETERS, int i
+
+ call_php_function_with_3_params(ORIG_FUNC_NAME("date_create_from_format"), &dt, &orig_format, &orig_time, orig_timezone);
+ if (Z_TYPE(dt) == IS_FALSE) {
++ zval_ptr_dtor(&orig_format);
++ zval_ptr_dtor(&orig_time);
+ RETURN_FALSE;
+ }
+
+@@ -1443,6 +1445,7 @@ static void _timecop_date_create_from_format(INTERNAL_FUNCTION_PARAMETERS, int i
+
+ if (immutable) {
+ call_php_method_with_1_params(NULL, TIMECOP_G(ce_DateTimeImmutable), "createfrommutable", &dti, &dt);
++ zval_ptr_dtor(&dt);
+ RETURN_ZVAL(&dti, 1, 1);
+ }
+
+@@ -1458,7 +1461,11 @@ static void _timecop_date_create_from_format(INTERNAL_FUNCTION_PARAMETERS, int i
+ call_php_method_with_1_params(&dt, TIMECOP_G(ce_DateTime), "format", &fixed_time, &tmp);
+ zval_ptr_dtor(&tmp);
+
+- if (memchr(orig_format_str, 'g', orig_format_len) ||
++ if (
++#if PHP_VERSION_ID >= 70300
++ memchr(orig_format_str, 'u', orig_format_len) ||
++#endif
++ memchr(orig_format_str, 'g', orig_format_len) ||
+ memchr(orig_format_str, 'h', orig_format_len) ||
+ memchr(orig_format_str, 'G', orig_format_len) ||
+ memchr(orig_format_str, 'H', orig_format_len) ||
+@@ -1478,14 +1485,6 @@ static void _timecop_date_create_from_format(INTERNAL_FUNCTION_PARAMETERS, int i
+ memchr(orig_format_str, 'l', orig_format_len) ||
+ memchr(orig_format_str, 'U', orig_format_len)) {
+ ZVAL_STRING(&fixed_format, "Y-m-d H:i:s.??????");
+- } else if (memchr(orig_format_str, 'u', orig_format_len)) {
+- #if PHP_VERSION_ID >= 70300
+- ZVAL_STRING(&fixed_format, "Y-m-d ??:??:??.??????");
+- #elif PHP_VERSION_ID >= 70100
+- ZVAL_STRING(&fixed_format, "Y-m-d H:i:s.u");
+- #else
+- ZVAL_STRING(&fixed_format, "Y-m-d H:i:s.??????");
+- #endif
+ } else {
+ #if PHP_VERSION_ID >= 70100
+ ZVAL_STRING(&fixed_format, "Y-m-d H:i:s.u");