summaryrefslogtreecommitdiff
path: root/ext/mbstring/tests
diff options
context:
space:
mode:
authorRui Hirokawa <hirokawa@php.net>2011-09-24 02:12:17 +0000
committerRui Hirokawa <hirokawa@php.net>2011-09-24 02:12:17 +0000
commita6a3bd010aefe9a543d450105ea7310196c8235e (patch)
tree1232343298d8116c77b7c3b8b6d497c78b0c6c77 /ext/mbstring/tests
parentbf2dfb5fffa49095d5ebe3b05591f4976ef4610d (diff)
downloadphp-git-a6a3bd010aefe9a543d450105ea7310196c8235e.tar.gz
MFH: fixed #40685: removed '&' in mb_decode_numericentity().
Diffstat (limited to 'ext/mbstring/tests')
-rw-r--r--ext/mbstring/tests/bug40685.phpt25
1 files changed, 25 insertions, 0 deletions
diff --git a/ext/mbstring/tests/bug40685.phpt b/ext/mbstring/tests/bug40685.phpt
new file mode 100644
index 0000000000..1a673e5d15
--- /dev/null
+++ b/ext/mbstring/tests/bug40685.phpt
@@ -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) "="