xref: /PHP-8.2/ext/mbstring/tests/bug40685.phpt (revision 76a92c26)
1--TEST--
2Bug #40685 (mb_decode_numericentity() removes '&' in the string)
3--EXTENSIONS--
4mbstring
5--FILE--
6<?php
7$map = array(0, 0x10FFFF, 0, 0xFFFFFF);
8var_dump(mb_decode_numericentity('&', $map, 'UTF-8'));
9var_dump(mb_decode_numericentity('&&&', $map, 'UTF-8'));
10var_dump(mb_decode_numericentity('&#', $map, 'UTF-8'));
11var_dump(mb_decode_numericentity('&#x', $map, 'UTF-8'));
12var_dump(mb_decode_numericentity('&#61', $map, 'UTF-8'));
13var_dump(mb_decode_numericentity('&#x3d', $map, 'UTF-8'));
14var_dump(mb_decode_numericentity('&#61;', $map, 'UTF-8'));
15var_dump(mb_decode_numericentity('&#x3d;', $map, 'UTF-8'));
16?>
17--EXPECT--
18string(1) "&"
19string(3) "&&&"
20string(2) "&#"
21string(3) "&#x"
22string(1) "="
23string(1) "="
24string(1) "="
25string(1) "="
26