php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #72979
Patch php-7.0.3-aix-strfmon.patch revision 2016-08-30 15:59 UTC by matthieu dot sarter dot external at atos dot net

Patch php-7.0.3-aix-strfmon.patch for Strings related Bug #72979

Patch version 2016-08-30 15:59 UTC

Return to Bug #72979 | Download this patch
Patch Revisions:

Developer: matthieu.sarter.external@atos.net

diff -Nur php-7.0.3.orig/ext/standard/string.c php-7.0.3-aix/ext/standard/string.c
--- php-7.0.3.orig/ext/standard/string.c	2016-02-02 17:32:26 +0100
+++ php-7.0.3-aix/ext/standard/string.c	2016-03-14 14:41:01 +0100
@@ -5602,7 +5602,15 @@
 		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));

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC