diff options
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/mbstring/mbstring.c | 8 | ||||
| -rw-r--r-- | ext/mbstring/tests/bug76704.phpt | 16 | 
2 files changed, 20 insertions, 4 deletions
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index eceafdd29c..bb464d0008 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -709,7 +709,7 @@ static const mbfl_encoding *php_mb_get_encoding(const char *encoding_name) {  }  /* {{{ static int php_mb_parse_encoding_list() - *  Return 0 if input contains any illegal encoding, otherwise 1. + *  Return FAILURE if input contains any illegal encoding, otherwise SUCCESS.   *  Even if any illegal encoding is detected the result may contain a list   *  of parsed encodings.   */ @@ -786,7 +786,7 @@ php_mb_parse_encoding_list(const char *value, size_t value_length, const mbfl_en  					*entry++ = encoding;  					n++;  				} else { -					ret = 0; +					ret = FAILURE;  				}  			}  			p1 = p2 + 1; @@ -802,7 +802,7 @@ php_mb_parse_encoding_list(const char *value, size_t value_length, const mbfl_en  			if (return_list) {  				*return_list = NULL;  			} -			ret = 0; +			ret = FAILURE;  		}  		if (return_size) {  			*return_size = n; @@ -815,7 +815,7 @@ php_mb_parse_encoding_list(const char *value, size_t value_length, const mbfl_en  /* }}} */  /* {{{ static int php_mb_parse_encoding_array() - *  Return 0 if input contains any illegal encoding, otherwise 1. + *  Return FAILURE if input contains any illegal encoding, otherwise SUCCESS.   *  Even if any illegal encoding is detected the result may contain a list   *  of parsed encodings.   */ diff --git a/ext/mbstring/tests/bug76704.phpt b/ext/mbstring/tests/bug76704.phpt new file mode 100644 index 0000000000..502f7e3ef6 --- /dev/null +++ b/ext/mbstring/tests/bug76704.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #76704 (mb_detect_order return value varies based on argument type) +--SKIPIF-- +<?php +if (!extension_loaded('mbstring')) die('skip mbstring extension not available'); +?> +--FILE-- +<?php +var_dump(mb_detect_order('Foo, UTF-8')); +var_dump(mb_detect_order(['Foo', 'UTF-8'])) +?> +===DONE=== +--EXPECT-- +bool(false) +bool(false) +===DONE===  | 
