From: Michael Wallner Date: Tue, 15 Nov 2016 08:53:42 +0000 (+0100) Subject: fix issue #23 (PHP-7.1 JSON compat) X-Git-Tag: v2.1.2~6 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=ef9b34bc5ae76a1a961108085e5d21e8ad679b18;p=m6w6%2Fext-pq fix issue #23 (PHP-7.1 JSON compat) --- 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"]=>