com php-src: Fixed bug #72979 money_format stores wrong length on AIX: NEWS ext/standard/string.c
| From: | Joe Watkins | Date: | Mon, 09 Jan 2017 05:31:41 +0000 |
| Subject: | com php-src: Fixed bug #72979 money_format stores wrong length on AIX: NEWS ext/standard/string.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-96642@lists.php.net to get a copy of this message | ||
Commit: 8dd523a21604bfb0c8ac70367396507ce9fe77cb
Author: Joe Watkins <krakjoe@php.net> Mon, 9 Jan 2017 05:31:41 +0000
Parents: 8c653c163a7c6f8fa3c1394bd1d482480c226177
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8dd523a21604bfb0c8ac70367396507ce9fe77cb
Log:
Fixed bug #72979 money_format stores wrong length on AIX
Bugs:
https://bugs.php.net/72979
Changed paths:
M NEWS
M ext/standard/string.c
Diff:
diff --git a/NEWS b/NEWS
index 224ed83..75b8509 100644
--- a/NEWS
+++ b/NEWS
@@ -27,6 +27,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 613247b..8fd2c55 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -5514,7 +5514,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));