summaryrefslogtreecommitdiff
path: root/ext/mbstring/tests/bug49536.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mbstring/tests/bug49536.phpt')
-rw-r--r--ext/mbstring/tests/bug49536.phpt20
1 files changed, 20 insertions, 0 deletions
diff --git a/ext/mbstring/tests/bug49536.phpt b/ext/mbstring/tests/bug49536.phpt
new file mode 100644
index 000000000..32685d226
--- /dev/null
+++ b/ext/mbstring/tests/bug49536.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #49536 (mb_detect_encoding() returns incorrect results when strict_mode is turned on)
+--SKIPIF--
+<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
+--FILE--
+<?php
+// non-strict mode
+var_dump(mb_detect_encoding("A\x81", "SJIS", false));
+// strict mode
+var_dump(mb_detect_encoding("A\x81", "SJIS", true));
+// non-strict mode
+var_dump(mb_detect_encoding("\xc0\x00", "UTF-8", false));
+// strict mode
+var_dump(mb_detect_encoding("\xc0\x00", "UTF-8", true));
+?>
+--EXPECT--
+string(4) "SJIS"
+bool(false)
+string(5) "UTF-8"
+bool(false)