php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #77454
Patch mb_scrub.patch revision 2019-01-13 16:27 UTC by 64796c6e69 at gmail dot com

Patch mb_scrub.patch for mbstring related Bug #77454

Patch version 2019-01-13 16:27 UTC

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

Developer: 64796c6e69@gmail.com

diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index 264c6020ca..17df6036dc 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -4953,11 +4953,9 @@ PHP_FUNCTION(mb_chr)
 /* }}} */
 
 
-static inline char* php_mb_scrub(const char* str, size_t str_len, const mbfl_encoding *enc)
+static inline char* php_mb_scrub(const char* str, size_t str_len, const mbfl_encoding *enc, size_t *ret_len)
 {
-	size_t ret_len;
-
-	return php_mb_convert_encoding_ex(str, str_len, enc, enc, &ret_len);
+	return php_mb_convert_encoding_ex(str, str_len, enc, enc, ret_len);
 }
 
 
@@ -4969,6 +4967,7 @@ PHP_FUNCTION(mb_scrub)
 	size_t str_len;
 	zend_string *enc_name = NULL;
 	char *ret;
+	size_t ret_len;
 
 	ZEND_PARSE_PARAMETERS_START(1, 2)
 		Z_PARAM_STRING(str, str_len)
@@ -4981,13 +4980,13 @@ PHP_FUNCTION(mb_scrub)
 		RETURN_FALSE;
 	}
 
-	ret = php_mb_scrub(str, str_len, enc);
+	ret = php_mb_scrub(str, str_len, enc, &ret_len);
 
 	if (ret == NULL) {
 		RETURN_FALSE;
 	}
 
-	RETVAL_STRING(ret);
+	RETVAL_STRINGL(ret, ret_len);
 	efree(ret);
 }
 /* }}} */
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 11:01:29 2024 UTC