summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Watkins <krakjoe@php.net>2017-01-09 05:32:22 +0000
committerJoe Watkins <krakjoe@php.net>2017-01-09 05:32:50 +0000
commitbf6eb656732ca7f09bcfdcc7e11fb3b64a3dcc7d (patch)
treedcdd5b60352c61cbb46ba5f07252d207f14e0546
parent0738a78c59f4a3fabfb38b63c80a6c863736ba34 (diff)
parent8dd523a21604bfb0c8ac70367396507ce9fe77cb (diff)
downloadphp-git-bf6eb656732ca7f09bcfdcc7e11fb3b64a3dcc7d.tar.gz
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: Fixed bug #72979 money_format stores wrong length on AIX
-rw-r--r--NEWS1
-rw-r--r--ext/standard/string.c8
2 files changed, 9 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index ef94120e60..1da14c8b58 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,7 @@ PHP NEWS
. Fixed bug #47021 (SoapClient stumbles over WSDL delivered with
"Transfer-Encoding: chunked"). (Rowan Collins)
. Fixed bug #72974 (imap is undefined service on AIX). (matthieu.sarter)
+ . Fixed bug #72979 (money_format stores wrong length AIX). (matthieu.sarter)
- ZIP:
. Fixed bug #70103 (ZipArchive::addGlob ignores remove_all_path option). (cmb,
diff --git a/ext/standard/string.c b/ext/standard/string.c
index cd2dd7b8c9..27b32b36e9 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -5531,7 +5531,15 @@ PHP_FUNCTION(money_format)
zend_string_free(str);
RETURN_FALSE;
}
+#ifdef _AIX
+ /*
+ On AIX strfmon seems to include the terminating \0 in the length returned by strfmon,
+ despite the documentation indicating it is not included.
+ */
+ ZSTR_LEN(str) = strlen(ZSTR_VAL(str));
+#else
ZSTR_LEN(str) = (size_t)res_len;
+#endif
ZSTR_VAL(str)[ZSTR_LEN(str)] = '\0';
RETURN_NEW_STR(zend_string_truncate(str, ZSTR_LEN(str), 0));