Skip to content

Commit 8dd523a

Browse files
committed
Fixed bug #72979 money_format stores wrong length on AIX
1 parent 8c653c1 commit 8dd523a

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ PHP NEWS
2727
. Fixed bug #47021 (SoapClient stumbles over WSDL delivered with
2828
"Transfer-Encoding: chunked"). (Rowan Collins)
2929
. Fixed bug #72974 (imap is undefined service on AIX). (matthieu.sarter)
30+
. Fixed bug #72979 (money_format stores wrong length AIX). (matthieu.sarter)
3031

3132
- ZIP:
3233
. Fixed bug #70103 (ZipArchive::addGlob ignores remove_all_path option). (cmb,

ext/standard/string.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5514,7 +5514,15 @@ PHP_FUNCTION(money_format)
55145514
zend_string_free(str);
55155515
RETURN_FALSE;
55165516
}
5517+
#ifdef _AIX
5518+
/*
5519+
On AIX strfmon seems to include the terminating \0 in the length returned by strfmon,
5520+
despite the documentation indicating it is not included.
5521+
*/
5522+
ZSTR_LEN(str) = strlen(ZSTR_VAL(str));
5523+
#else
55175524
ZSTR_LEN(str) = (size_t)res_len;
5525+
#endif
55185526
ZSTR_VAL(str)[ZSTR_LEN(str)] = '\0';
55195527

55205528
RETURN_NEW_STR(zend_string_truncate(str, ZSTR_LEN(str), 0));

0 commit comments

Comments
 (0)