diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2020-01-22 09:43:51 +0100 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-01-22 09:43:51 +0100 |
commit | 94c9dc498ffdedd9ae91357bd3345ba31f232220 (patch) | |
tree | 871c17ffe598ec83e1a0ee6b0238dfc33469af77 /ext/mbstring/tests/bug79149.phpt | |
parent | d904be08808ba0b7164907e01392d0dabbf3077e (diff) | |
download | php-git-94c9dc498ffdedd9ae91357bd3345ba31f232220.tar.gz |
Fix #79149: SEGV in mb_convert_encoding with non-string encodings
We must not assume that `hash_entry` `IS_STRING`, but rather use
`encoding_str` which is guaranteed to be.
Diffstat (limited to 'ext/mbstring/tests/bug79149.phpt')
-rw-r--r-- | ext/mbstring/tests/bug79149.phpt | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ext/mbstring/tests/bug79149.phpt b/ext/mbstring/tests/bug79149.phpt new file mode 100644 index 0000000000..fc3751d933 --- /dev/null +++ b/ext/mbstring/tests/bug79149.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #79149 (SEGV in mb_convert_encoding with non-string encodings) +--SKIPIF-- +<?php +if (!extension_loaded('mbstring')) die('skip mbstring extension not available'); +?> +--FILE-- +<?php +var_dump(mb_convert_encoding("", "UTF-8", [0])); +var_dump(mb_convert_encoding('foo', 'UTF-8', array(['bar'], ['baz']))); +?> +--EXPECTF-- +Warning: mb_convert_encoding(): Illegal character encoding specified in %s on line %d +string(0) "" + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d + +Warning: mb_convert_encoding(): Illegal character encoding specified in %s on line %d +string(3) "foo" |