1--TEST-- 2mb_parse_str() test 2 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&fubar=ghi", 13 "%2bfoo=def&-bar=jkl#+fubar", 14 " foo[]=abc&foo[]=def#foo[]=ghi#bar[]=#foo[]&fubar[]==" 15); 16function test($query) { 17 $foo = ''; 18 $bar = ''; 19 $fubar = ''; 20 mb_parse_str($query, $array); 21 var_dump($array); 22 var_dump($foo); 23 var_dump($bar); 24 var_dump($fubar); 25 mb_parse_str($query); 26 var_dump($foo); 27 var_dump($bar); 28 var_dump($fubar); 29} 30foreach ($queries as $query) { 31 test($query); 32} 33?> 34--EXPECT-- 35array(3) { 36 ["foo"]=> 37 string(3) "abc" 38 ["bar"]=> 39 string(3) "def" 40 ["fubar"]=> 41 string(3) "ghi" 42} 43string(0) "" 44string(0) "" 45string(0) "" 46string(3) "abc" 47string(3) "def" 48string(3) "ghi" 49array(3) { 50 ["+foo"]=> 51 string(3) "def" 52 ["-bar"]=> 53 string(3) "jkl" 54 ["fubar"]=> 55 string(0) "" 56} 57string(0) "" 58string(0) "" 59string(0) "" 60string(0) "" 61string(0) "" 62string(0) "" 63array(3) { 64 ["foo"]=> 65 array(4) { 66 [0]=> 67 string(3) "abc" 68 [1]=> 69 string(3) "def" 70 [2]=> 71 string(3) "ghi" 72 [3]=> 73 string(0) "" 74 } 75 ["bar"]=> 76 array(1) { 77 [0]=> 78 string(0) "" 79 } 80 ["fubar"]=> 81 array(1) { 82 [0]=> 83 string(1) "=" 84 } 85} 86string(0) "" 87string(0) "" 88string(0) "" 89array(4) { 90 [0]=> 91 string(3) "abc" 92 [1]=> 93 string(3) "def" 94 [2]=> 95 string(3) "ghi" 96 [3]=> 97 string(0) "" 98} 99array(1) { 100 [0]=> 101 string(0) "" 102} 103array(1) { 104 [0]=> 105 string(1) "=" 106} 107