From ef9b34bc5ae76a1a961108085e5d21e8ad679b18 Mon Sep 17 00:00:00 2001 From: Michael Wallner 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"]=> From be621b64a9a5faea34741430db84cfe16b7b40b6 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 23 Jun 2017 15:24:38 +0200 Subject: [PATCH] fix pq\DateTime::createFromFormat() proto for 7.2 --- src/php_pq_misc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/php_pq_misc.c b/src/php_pq_misc.c index 3f824ed..08f10c3 100644 --- a/src/php_pq_misc.c +++ b/src/php_pq_misc.c @@ -139,7 +139,11 @@ static PHP_METHOD(pqdt, __toString) ZEND_BEGIN_ARG_INFO_EX(ai_pqdt_create_from_format, 0, 0, 2) ZEND_ARG_INFO(0, format) ZEND_ARG_INFO(0, datetime) +#if PHP_VERSION_ID >= 70200 + ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 1) +#else ZEND_ARG_INFO(0, timezone) +#endif ZEND_END_ARG_INFO(); static PHP_METHOD(pqdt, createFromFormat) {