PATH:
opt
/
alt
/
tests
/
alt-php81-pecl-http_4.2.6-4.el8
/
tests
--TEST-- query string --SKIPIF-- <?php include("skipif.inc"); version_compare(PHP_VERSION, "7.2.0-dev", ">=") or die("skip only for PHP >= 7.2.0"); ?> --GET-- str=abc&num=-123&dec=123.123&bool=1&arr[]=1&arr[]=2&ma[l1][l2]=2&ma[l2][l3][l4]=3 --FILE-- <?php echo "Test\n"; printf("\nGlobal instance:\n"); $q = http\QueryString::getGlobalInstance(); printf("%s\n", $q); $q = http\QueryString::getGlobalInstance(); printf("\nStandard getters:\n"); var_dump($q->getString("str")); var_dump($q->getInt("num")); var_dump($q->getFloat("dec")); var_dump($q->getInt("dec")); var_dump($q->getFloat("dec")); var_dump($q->getBool("bool")); var_dump($q->getInt("bool")); var_dump($q->getBool("num")); var_dump($q->getInt("num")); var_dump($q->getArray("arr")); var_dump($q->getArray("ma")); var_dump($q->getObject("arr")); var_dump($q->getObject("ma")); $s = $q->toString(); printf("\nClone modifications do not alter global instance:\n"); $q->mod(array("arr" => array(3 => 3))); printf("%s\n", $q); printf("\nClone modifications do not alter standard instance:\n"); $q2 = new http\QueryString($s); $q3 = $q2->mod(array("arr" => array(3 => 3))); printf("%s\n%s\n", $q2, $q3); #var_dump($q2, $q3); printf("\nIterator:\n"); $it = new RecursiveIteratorIterator($q2, RecursiveIteratorIterator::SELF_FIRST); foreach ($it as $k => $v) { $i = $it->getDepth()*8; @printf("%{$i}s: %s\n", $k, $v); } printf("\nReplace a multi dimensional key:\n"); printf("%s\n", $q2->mod(array("ma" => null))->set(array("ma" => array("l1" => false)))); printf("\nXlate:\n"); $qu = new http\QueryString("ü=ö"); printf("utf8: %s\n", $qu); printf("latin1: %s\n", method_exists($qu, "xlate") ? $qu->xlate("utf-8", "latin1") : "%FC=%F6"); printf("\nOffsets:\n"); var_dump($q2["ma"]); $q2["ma"] = array("bye"); var_dump($q2["ma"]); var_dump(isset($q2["ma"])); unset($q2["ma"]); var_dump(isset($q2["ma"])); echo "Done\n"; ?> --EXPECTF-- Test Global instance: str=abc&num=-123&dec=123.123&bool=1&arr%5B0%5D=1&arr%5B1%5D=2&ma%5Bl1%5D%5Bl2%5D=2&ma%5Bl2%5D%5Bl3%5D%5Bl4%5D=3 Standard getters: string(3) "abc" int(-123) float(123.123) int(123) float(123.123) bool(true) int(1) bool(true) int(-123) array(2) { [0]=> string(1) "1" [1]=> string(1) "2" } array(2) { ["l1"]=> array(1) { ["l2"]=> string(1) "2" } ["l2"]=> array(1) { ["l3"]=> array(1) { ["l4"]=> string(1) "3" } } } object(stdClass)#%d (2) { ["0"]=> string(1) "1" ["1"]=> string(1) "2" } object(stdClass)#%d (2) { ["l1"]=> array(1) { ["l2"]=> string(1) "2" } ["l2"]=> array(1) { ["l3"]=> array(1) { ["l4"]=> string(1) "3" } } } Clone modifications do not alter global instance: str=abc&num=-123&dec=123.123&bool=1&arr%5B0%5D=1&arr%5B1%5D=2&ma%5Bl1%5D%5Bl2%5D=2&ma%5Bl2%5D%5Bl3%5D%5Bl4%5D=3 Clone modifications do not alter standard instance: str=abc&num=-123&dec=123.123&bool=1&arr%5B0%5D=1&arr%5B1%5D=2&ma%5Bl1%5D%5Bl2%5D=2&ma%5Bl2%5D%5Bl3%5D%5Bl4%5D=3 str=abc&num=-123&dec=123.123&bool=1&arr%5B0%5D=1&arr%5B1%5D=2&arr%5B3%5D=3&ma%5Bl1%5D%5Bl2%5D=2&ma%5Bl2%5D%5Bl3%5D%5Bl4%5D=3 Iterator: str: abc num: -123 dec: 123.123 bool: 1 arr: Array 0: 1 1: 2 ma: Array l1: Array l2: 2 l2: Array l3: Array l4: 3 Replace a multi dimensional key: str=abc&num=-123&dec=123.123&bool=1&arr%5B0%5D=1&arr%5B1%5D=2&ma%5Bl1%5D= Xlate: utf8: %C3%BC=%C3%B6 latin1: %FC=%F6 Offsets: array(2) { ["l1"]=> array(1) { ["l2"]=> string(1) "2" } ["l2"]=> array(1) { ["l3"]=> array(1) { ["l4"]=> string(1) "3" } } } array(1) { [0]=> string(3) "bye" } bool(true) bool(false) Done
[+]
..
[-] message004.phpt
[edit]
[-] url002.phpt
[edit]
[-] messagebody007.phpt
[edit]
[-] header007.phpt
[edit]
[-] clientrequest002.phpt
[edit]
[-] params010.phpt
[edit]
[-] client010.phpt
[edit]
[-] params004.phpt
[edit]
[-] client005.phpt
[edit]
[-] bug61444.phpt
[edit]
[-] urlparser002.phpt
[edit]
[-] params009.phpt
[edit]
[-] bug69313.phpt
[edit]
[-] cookie007.phpt
[edit]
[-] urlparser010.phpt
[edit]
[-] params006.phpt
[edit]
[-] bug69076.phpt
[edit]
[-] params002.phpt
[edit]
[-] urlparser011.phpt
[edit]
[-] gh-issue11.phpt
[edit]
[-] header005.phpt
[edit]
[-] message005.phpt
[edit]
[-] client026.phpt
[edit]
[-] gh-issue92.phpt
[edit]
[-] filterchunked.phpt
[edit]
[-] params017.phpt
[edit]
[-] message009.phpt
[edit]
[-] headerparser003.phpt
[edit]
[-] params015.phpt
[edit]
[-] header002.phpt
[edit]
[-] etag001.phpt
[edit]
[-] client023.phpt
[edit]
[-] client025.phpt
[edit]
[-] urlparser013.phpt
[edit]
[-] messagebody009.phpt
[edit]
[-] serialize001.phpt
[edit]
[-] messagebody002.phpt
[edit]
[-] filterbrotli.phpt
[edit]
[-] bug67932.phpt
[edit]
[-] client002.phpt
[edit]
[-] messagebody003.phpt
[edit]
[-] message012.phpt
[edit]
[-] header008.phpt
[edit]
[-] urlparser005.phpt
[edit]
[-] params016.phpt
[edit]
[-] cookie006.phpt
[edit]
[-] cookie010.phpt
[edit]
[-] cookie009.phpt
[edit]
[-] urlparser009.phpt
[edit]
[-] client007.phpt
[edit]
[-] gh-issue42.phpt
[edit]
[-] message015.phpt
[edit]
[-] headerparser002.phpt
[edit]
[-] querystring001_a.phpt
[edit]
[-] querystring003.phpt
[edit]
[-] url004.phpt
[edit]
[-] cookie003.phpt
[edit]
[-] client001.phpt
[edit]
[-] client014.phpt
[edit]
[-] urlparser003.phpt
[edit]
[-] urlparser007.phpt
[edit]
[-] urlparser006.phpt
[edit]
[-] urlparser004.phpt
[edit]
[-] params003.phpt
[edit]
[-] client017.phpt
[edit]
[-] version001.phpt
[edit]
[-] message003.phpt
[edit]
[-] clientrequest001.phpt
[edit]
[-] cookie004.phpt
[edit]
[-] params007.phpt
[edit]
[-] header001.phpt
[edit]
[-] client020.phpt
[edit]
[-] skipif.inc
[edit]
[-] urlparser001.phpt
[edit]
[-] header003.phpt
[edit]
[-] client009.phpt
[edit]
[-] client022.phpt
[edit]
[-] messagebody010.phpt
[edit]
[-] client032.phpt
[edit]
[-] params008.phpt
[edit]
[-] headerparser001.phpt
[edit]
[-] bug73055.phpt
[edit]
[-] client004.phpt
[edit]
[-] info002.phpt
[edit]
[-] info001.phpt
[edit]
[-] params001.phpt
[edit]
[-] params013.phpt
[edit]
[+]
data
[-] messagebody006.phpt
[edit]
[-] message016.phpt
[edit]
[-] url003.phpt
[edit]
[-] messageparser001.phpt
[edit]
[-] bug69000.phpt
[edit]
[-] clientrequest003.phpt
[edit]
[-] header009.phpt
[edit]
[-] message011.phpt
[edit]
[-] messageparser002.phpt
[edit]
[-] urlparser008.phpt
[edit]
[-] client012.phpt
[edit]
[-] cookie002.phpt
[edit]
[-] client013.phpt
[edit]
[-] urlparser012.phpt
[edit]
[-] client019.phpt
[edit]
[-] message010.phpt
[edit]
[+]
helper
[-] client003.phpt
[edit]
[-] params005.phpt
[edit]
[-] messagebody008.phpt
[edit]
[-] client011.phpt
[edit]
[-] client006.phpt
[edit]
[-] cookie011.phpt
[edit]
[-] cookie005.phpt
[edit]
[-] clientresponse002.phpt
[edit]
[-] querystring002.phpt
[edit]
[-] bug66388.phpt
[edit]
[-] messagebody004.phpt
[edit]
[-] phpinfo.phpt
[edit]
[-] params012.phpt
[edit]
[-] gh-issue63.phpt
[edit]
[-] message007.phpt
[edit]
[-] gh-issue50.phpt
[edit]
[-] clientrequest004.phpt
[edit]
[-] clientresponse001.phpt
[edit]
[-] url001.phpt
[edit]
[-] message013.phpt
[edit]
[-] cookie008.phpt
[edit]
[-] header004.phpt
[edit]
[-] message014.phpt
[edit]
[-] params011.phpt
[edit]
[-] client031.phpt
[edit]
[-] cookie012.phpt
[edit]
[-] client029.phpt
[edit]
[-] client024.phpt
[edit]
[-] url005.phpt
[edit]
[-] clientresponse003.phpt
[edit]
[-] messagebody005.phpt
[edit]
[-] messagebody001.phpt
[edit]
[-] cookie001.phpt
[edit]
[-] params014.phpt
[edit]
[-] bug69357.phpt
[edit]
[-] message001.phpt
[edit]
[-] header006.phpt
[edit]