mirror of
https://github.com/php/php-src.git
synced 2026-04-22 23:48:14 +02:00
76a92c26e3
Since mb_decode_numericentity does not require all HTML entities to end with ';', but allows them to be terminated by ANY non-digit character, it doesn't make sense that valid entities which butt up against the end of the input string are not converted. As it turned out, supporting this case also made it possible to simplify the code nicely.
26 lines
745 B
PHP
26 lines
745 B
PHP
--TEST--
|
|
Bug #40685 (mb_decode_numericentity() removes '&' in the string)
|
|
--EXTENSIONS--
|
|
mbstring
|
|
--FILE--
|
|
<?php
|
|
$map = array(0, 0x10FFFF, 0, 0xFFFFFF);
|
|
var_dump(mb_decode_numericentity('&', $map, 'UTF-8'));
|
|
var_dump(mb_decode_numericentity('&&&', $map, 'UTF-8'));
|
|
var_dump(mb_decode_numericentity('&#', $map, 'UTF-8'));
|
|
var_dump(mb_decode_numericentity('&#x', $map, 'UTF-8'));
|
|
var_dump(mb_decode_numericentity('=', $map, 'UTF-8'));
|
|
var_dump(mb_decode_numericentity('=', $map, 'UTF-8'));
|
|
var_dump(mb_decode_numericentity('=', $map, 'UTF-8'));
|
|
var_dump(mb_decode_numericentity('=', $map, 'UTF-8'));
|
|
?>
|
|
--EXPECT--
|
|
string(1) "&"
|
|
string(3) "&&&"
|
|
string(2) "&#"
|
|
string(3) "&#x"
|
|
string(1) "="
|
|
string(1) "="
|
|
string(1) "="
|
|
string(1) "="
|