]> granicus.if.org Git - php/commitdiff
This commit was manufactured by cvs2svn to create branch 'PHP_4_3'.
authorSVN Migration <svn@php.net>
Fri, 15 Nov 2002 15:59:08 +0000 (15:59 +0000)
committerSVN Migration <svn@php.net>
Fri, 15 Nov 2002 15:59:08 +0000 (15:59 +0000)
ext/mbstring/tests/overload01.phpt [new file with mode: 0644]
ext/mbstring/tests/overload02.phpt [new file with mode: 0644]
ext/standard/tests/array/bug20381.phpt [new file with mode: 0644]

diff --git a/ext/mbstring/tests/overload01.phpt b/ext/mbstring/tests/overload01.phpt
new file mode 100644 (file)
index 0000000..b0990e8
--- /dev/null
@@ -0,0 +1,25 @@
+--TEST--
+Function overloading test 1
+--SKIPIF--
+<?php 
+       extension_loaded('mbstring') or die('skip mbstring not available'); 
+       if (!function_exists("mail")) {
+               die('skip mail() function is not available.');
+       }
+?>
+--INI--
+output_handler=
+mbstring.func_overload=7
+mbstring.internal_encoding=EUC-JP
+--FILE--
+<?php
+echo mb_internal_encoding()."\n";
+
+$ngchars = array('ǽ','ɽ','»½','¥½');
+$str = '¸µÏ½ÍÜ»½Ðò¼Òº¾µ½É½¸½Ç½ÎÏɽ¼¨±½ÌÈÄä˽ÎÏŽÉÕ¹½Ê¸·½»ÒͽÃÎñ½Æ¬¥½¥Õ¥¡¡¼';
+var_dump(strlen($str));
+var_dump(mb_strlen($str));
+--EXPECT--
+EUC-JP
+int(33)
+int(33)
diff --git a/ext/mbstring/tests/overload02.phpt b/ext/mbstring/tests/overload02.phpt
new file mode 100644 (file)
index 0000000..9b5cecd
--- /dev/null
@@ -0,0 +1,36 @@
+--TEST--
+Function overloading test 2 
+--SKIPIF--
+<?php 
+       extension_loaded('mbstring') or die('skip mbstring not available'); 
+       if (!function_exists("mail")) {
+               die('skip mail() function is not available.');
+       }
+       if (!function_exists("mb_ereg_replace")) {
+               die('skip mb_ereg_replace() function is not available.');
+       }
+?>
+--INI--
+output_handler=
+mbstring.func_overload=7
+mbstring.internal_encoding=EUC-JP
+--FILE--
+<?php
+echo mb_internal_encoding()."\n";
+
+$ngchars = array('ǽ','ɽ','»½','¥½');
+$str = '¸µÏ½ÍÜ»½Ðò¼Òº¾µ½É½¸½Ç½ÎÏɽ¼¨±½ÌÈÄä˽ÎÏŽÉÕ¹½Ê¸·½»ÒͽÃÎñ½Æ¬¥½¥Õ¥¡¡¼';
+$converted_str = mb_convert_encoding($str, 'Shift_JIS');
+mb_regex_encoding('Shift_JIS');
+foreach($ngchars as $c) {
+       $c = mb_convert_encoding($c, 'Shift_JIS');
+       $replaced = mb_convert_encoding(ereg_replace($c, '!!', $converted_str), mb_internal_encoding(), 'Shift_JIS');
+       var_dump(strpos($replaced, '!!'));
+}
+?>
+--EXPECT--
+EUC-JP
+int(10)
+int(8)
+int(3)
+int(29)
diff --git a/ext/standard/tests/array/bug20381.phpt b/ext/standard/tests/array/bug20381.phpt
new file mode 100644 (file)
index 0000000..1adaa86
--- /dev/null
@@ -0,0 +1,79 @@
+--TEST--
+Bug #20381 (array_merge_recursive mangles input arrays)
+--FILE--
+<?php
+$a = array(
+       'a1' => 1,
+       'a2' => array( 1, 2, 3 ),
+       'a3' => array(
+               'a' => array( 10, 20, 30 ),
+               'b' => 'b'
+               )
+       );
+$b = array( 'a1' => 2,
+       'a2' => array( 3, 4, 5 ),
+       'a3' => array(
+               'c' => 'cc',
+               'a' => array( 10, 40 )
+               )
+       );
+
+var_dump($a);
+array_merge_recursive( $a, $b );
+var_dump($a);
+?>
+--EXPECT--
+array(3) {
+  ["a1"]=>
+  int(1)
+  ["a2"]=>
+  array(3) {
+    [0]=>
+    int(1)
+    [1]=>
+    int(2)
+    [2]=>
+    int(3)
+  }
+  ["a3"]=>
+  array(2) {
+    ["a"]=>
+    array(3) {
+      [0]=>
+      int(10)
+      [1]=>
+      int(20)
+      [2]=>
+      int(30)
+    }
+    ["b"]=>
+    string(1) "b"
+  }
+}
+array(3) {
+  ["a1"]=>
+  int(1)
+  ["a2"]=>
+  array(3) {
+    [0]=>
+    int(1)
+    [1]=>
+    int(2)
+    [2]=>
+    int(3)
+  }
+  ["a3"]=>
+  array(2) {
+    ["a"]=>
+    array(3) {
+      [0]=>
+      int(10)
+      [1]=>
+      int(20)
+      [2]=>
+      int(30)
+    }
+    ["b"]=>
+    string(1) "b"
+  }
+}