summaryrefslogtreecommitdiff
path: root/ext/mbstring/tests
diff options
context:
space:
mode:
authorMoriyoshi Koizumi <moriyoshi@php.net>2003-12-18 09:50:20 +0000
committerMoriyoshi Koizumi <moriyoshi@php.net>2003-12-18 09:50:20 +0000
commitb8ea4e6fd218444162ad762000abaabe1cb1b5d1 (patch)
treec800252dcacf070c16a1a28f369a99f568af03e2 /ext/mbstring/tests
parent749cf47ef7e4272f0bda107abe5247dc73f913ef (diff)
downloadphp-git-b8ea4e6fd218444162ad762000abaabe1cb1b5d1.tar.gz
Fix bug #26639 (mb_convert_variables() clutters variables beyond the references)
Diffstat (limited to 'ext/mbstring/tests')
-rw-r--r--ext/mbstring/tests/bug26639.phpt100
1 files changed, 100 insertions, 0 deletions
diff --git a/ext/mbstring/tests/bug26639.phpt b/ext/mbstring/tests/bug26639.phpt
new file mode 100644
index 0000000000..651e6f45be
--- /dev/null
+++ b/ext/mbstring/tests/bug26639.phpt
@@ -0,0 +1,100 @@
+--TEST--
+Bug #26639 (mb_convert_variables() clutters variables beyond the references)
+--SKIPIF--
+<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
+--FILE--
+<?php
+$a = "あいうえお";
+$b = $a;
+mb_convert_variables("EUC-JP", "Shift_JIS", $b);
+debug_zval_dump($a);
+debug_zval_dump($b);
+unset($a);
+unset($b);
+
+$a = "あいうえお";
+$b = &$a;
+mb_convert_variables("EUC-JP", "Shift_JIS", $b);
+debug_zval_dump($a);
+debug_zval_dump($b);
+unset($a);
+unset($b);
+
+$a = "あいうえお";
+$b = array($a);
+$c = $b;
+mb_convert_variables("EUC-JP", "Shift_JIS", $c);
+debug_zval_dump($b);
+debug_zval_dump($c);
+unset($a);
+unset($b);
+unset($c);
+
+$a = "あいうえお";
+$b = array(&$a);
+$c = $b;
+mb_convert_variables("euc-jp", "shift_jis", $c);
+debug_zval_dump($b);
+debug_zval_dump($c);
+unset($a);
+unset($b);
+unset($c);
+
+$a = "あいうえお";
+$b = array($a);
+$c = &$b;
+mb_convert_variables("euc-jp", "shift_jis", $c);
+debug_zval_dump($b);
+debug_zval_dump($c);
+unset($a);
+unset($b);
+unset($c);
+
+$a = "あいうえお";
+$b = array(&$a);
+$c = &$b;
+mb_convert_variables("euc-jp", "shift_jis", $c);
+debug_zval_dump($b);
+debug_zval_dump($c);
+unset($a);
+unset($b);
+unset($c);
+?>
+--EXPECT--
+string(10) "あいうえお" refcount(2)
+string(10) "、「、、、ヲ、ィ、ェ" refcount(2)
+string(10) "、「、、、ヲ、ィ、ェ" refcount(1)
+string(10) "、「、、、ヲ、ィ、ェ" refcount(1)
+array(1) refcount(2){
+ [0]=>
+ string(10) "あいうえお" refcount(2)
+}
+array(1) refcount(2){
+ [0]=>
+ string(10) "、「、、、ヲ、ィ、ェ" refcount(1)
+}
+array(1) refcount(2){
+ [0]=>
+ &string(10) "あいうえお" refcount(2)
+}
+array(1) refcount(2){
+ [0]=>
+ string(10) "、「、、、ヲ、ィ、ェ" refcount(1)
+}
+array(1) refcount(1){
+ [0]=>
+ string(10) "、「、、、ヲ、ィ、ェ" refcount(2)
+}
+array(1) refcount(1){
+ [0]=>
+ string(10) "、「、、、ヲ、ィ、ェ" refcount(2)
+}
+array(1) refcount(1){
+ [0]=>
+ string(10) "、「、、、ヲ、ィ、ェ" refcount(2)
+}
+array(1) refcount(1){
+ [0]=>
+ string(10) "、「、、、ヲ、ィ、ェ" refcount(2)
+}
+