xref: /PHP-7.2/ext/mbstring/tests/bug40685.phpt (revision 3d888412)
1--TEST--
2Bug #40685 (mb_decode_numericentity() removes '&' in the string)
3--SKIPIF--
4<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
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--EXPECTF--
18string(1) "&"
19string(3) "&&&"
20string(2) "&#"
21string(3) "&#x"
22string(4) "&#61"
23string(5) "&#x3D"
24string(1) "="
25string(1) "="
26