php-src/ext/xml/tests/bug49687.phpt
Gustavo André dos Santos Lopes e69b1ff2c4 - Fixed bug #49687 (utf8_decode vulnerabilities and deficiencies in the number
of reported malformed sequences). (Gustavo)
#Made a public interface for get_next_char/utf-8 in trunk to use in utf8_decode.
#In PHP 5.3, trunk's get_next_char was copied to xml.c because 5.3's
#get_next_char is different and is not prepared to recover appropriately from
#errors.
2010-10-27 18:13:25 +00:00

25 lines
484 B
PHP

--TEST--
Bug #49687 Several utf8_decode deficiencies and vulnerabilities
--SKIPIF--
<?php
require_once("skipif.inc");
if (!extension_loaded('xml')) die ("skip xml extension not available");
?>
--FILE--
<?php
$tests = array(
"\x41\xC2\x3E\x42",
"\xE3\x80\x22",
"\x41\x98\xBA\x42\xE2\x98\x43\xE2\x98\xBA\xE2\x98",
);
foreach ($tests as $t) {
echo bin2hex(utf8_decode($t)), "\n";
}
echo "Done.\n";
--EXPECT--
413f3e42
3f22
413f3f423f433f3f
Done.