1--TEST-- 2mb_parse_str() 3--SKIPIF-- 4<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> 5--FAIL-- 6register_globals calls killed the ability for mb_parse_str() to register into the global scope 7--INI-- 8arg_separator.input=& 9--FILE-- 10<?php 11$queries = array( 12 "foo=abc&bar=def", 13 "%2bfoo=def&-bar=jkl", 14 "foo[]=abc&foo[]=def&foo[]=ghi&bar[]=jkl" 15); 16function test($query) { 17 $foo = ''; 18 $bar = ''; 19 mb_parse_str($query, $array); 20 var_dump($array); 21 var_dump($foo); 22 var_dump($bar); 23 mb_parse_str($query); 24 var_dump($foo); 25 var_dump($bar); 26} 27foreach ($queries as $query) { 28 test($query); 29} 30?> 31--EXPECT-- 32array(2) { 33 ["foo"]=> 34 string(3) "abc" 35 ["bar"]=> 36 string(3) "def" 37} 38string(0) "" 39string(0) "" 40string(3) "abc" 41string(3) "def" 42array(2) { 43 ["+foo"]=> 44 string(3) "def" 45 ["-bar"]=> 46 string(3) "jkl" 47} 48string(0) "" 49string(0) "" 50string(0) "" 51string(0) "" 52array(2) { 53 ["foo"]=> 54 array(3) { 55 [0]=> 56 string(3) "abc" 57 [1]=> 58 string(3) "def" 59 [2]=> 60 string(3) "ghi" 61 } 62 ["bar"]=> 63 array(1) { 64 [0]=> 65 string(3) "jkl" 66 } 67} 68string(0) "" 69string(0) "" 70array(3) { 71 [0]=> 72 string(3) "abc" 73 [1]=> 74 string(3) "def" 75 [2]=> 76 string(3) "ghi" 77} 78array(1) { 79 [0]=> 80 string(3) "jkl" 81} 82