]> granicus.if.org Git - php/commitdiff
added tests for #40685.
authorRui Hirokawa <hirokawa@php.net>
Sat, 24 Sep 2011 02:11:48 +0000 (02:11 +0000)
committerRui Hirokawa <hirokawa@php.net>
Sat, 24 Sep 2011 02:11:48 +0000 (02:11 +0000)
ext/mbstring/tests/bug40685.phpt [new file with mode: 0644]

diff --git a/ext/mbstring/tests/bug40685.phpt b/ext/mbstring/tests/bug40685.phpt
new file mode 100644 (file)
index 0000000..1a673e5
--- /dev/null
@@ -0,0 +1,25 @@
+--TEST--
+Bug #40685 (mb_decode_numericentity() removes '&' in the string)
+--SKIPIF--
+<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
+--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('&#61', $map, 'UTF-8'));
+var_dump(mb_decode_numericentity('&#x3d', $map, 'UTF-8'));
+var_dump(mb_decode_numericentity('&#61;', $map, 'UTF-8'));
+var_dump(mb_decode_numericentity('&#x3d;', $map, 'UTF-8'));
+?>
+--EXPECTF--
+string(1) "&"
+string(3) "&&&"
+string(2) "&#"
+string(3) "&#x"
+string(4) "&#61"
+string(5) "&#x3D"
+string(1) "="
+string(1) "="