summaryrefslogtreecommitdiffstats
path: root/pq-upstream.patch
blob: 6581539d06f8fb08be98a01c106169be155c8dce (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
From ef9b34bc5ae76a1a961108085e5d21e8ad679b18 Mon Sep 17 00:00:00 2001
From: Michael Wallner <mike@php.net>
Date: Tue, 15 Nov 2016 09:53:42 +0100
Subject: [PATCH] fix issue #23 (PHP-7.1 JSON compat)

---
 src/php_pq_params.c |  3 +++
 tests/conv001.phpt  | 12 ++++++------
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/php_pq_params.c b/src/php_pq_params.c
index 0f7ba50..5a5156f 100644
--- a/src/php_pq_params.c
+++ b/src/php_pq_params.c
@@ -83,6 +83,9 @@ static zend_string *object_param_to_string(php_pq_params_t *p, zval *zobj, Oid t
 	case PHP_PQ_OID_JSONB:
 #	endif
 	case PHP_PQ_OID_JSON:
+#	if PHP_VERSION_ID >= 70100
+		JSON_G(encode_max_depth) = PHP_JSON_PARSER_DEFAULT_DEPTH;
+#	endif
 		php_json_encode(&str, zobj, PHP_JSON_UNESCAPED_UNICODE);
 		smart_str_0(&str);
 		return str.s;
diff --git a/tests/conv001.phpt b/tests/conv001.phpt
index 8533753..b24da0e 100644
--- a/tests/conv001.phpt
+++ b/tests/conv001.phpt
@@ -328,7 +328,7 @@ array(1) {
       ["format"]=>
       string(11) "Y-m-d H:i:s"
       ["date"]=>
-      string(26) "%d-%d-%d %d:%d:%d.000000"
+      string(26) "%d-%d-%d %d:%d:%d.%d"
       ["timezone_type"]=>
       int(1)
       ["timezone"]=>
@@ -339,7 +339,7 @@ array(1) {
       ["format"]=>
       string(13) "Y-m-d H:i:s.u"
       ["date"]=>
-      string(26) "%d-%d-%d %d:%d:%d.000000"
+      string(26) "%d-%d-%d %d:%d:%d.%d"
       ["timezone_type"]=>
       int(3)
       ["timezone"]=>
@@ -350,7 +350,7 @@ array(1) {
       ["format"]=>
       string(14) "Y-m-d H:i:s.uO"
       ["date"]=>
-      string(26) "%d-%d-%d %d:%d:%d.000000"
+      string(26) "%d-%d-%d %d:%d:%d.%d"
       ["timezone_type"]=>
       int(1)
       ["timezone"]=>
@@ -372,7 +372,7 @@ array(1) {
       ["format"]=>
       string(11) "Y-m-d H:i:s"
       ["date"]=>
-      string(26) "%d-%d-%d %d:%d:%d.000000"
+      string(26) "%d-%d-%d %d:%d:%d.%d"
       ["timezone_type"]=>
       int(1)
       ["timezone"]=>
@@ -383,7 +383,7 @@ array(1) {
       ["format"]=>
       string(13) "Y-m-d H:i:s.u"
       ["date"]=>
-      string(26) "%d-%d-%d %d:%d:%d.000000"
+      string(26) "%d-%d-%d %d:%d:%d.%d"
       ["timezone_type"]=>
       int(3)
       ["timezone"]=>
@@ -394,7 +394,7 @@ array(1) {
       ["format"]=>
       string(14) "Y-m-d H:i:s.uO"
       ["date"]=>
-      string(26) "%d-%d-%d %d:%d:%d.000000"
+      string(26) "%d-%d-%d %d:%d:%d.%d"
       ["timezone_type"]=>
       int(1)
       ["timezone"]=>