summaryrefslogtreecommitdiff
path: root/ext/standard/tests/url
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/tests/url')
-rw-r--r--ext/standard/tests/url/base64_decode_basic_002.phpt2
-rw-r--r--ext/standard/tests/url/base64_decode_basic_003.phpt42
-rw-r--r--ext/standard/tests/url/base64_encode_basic_001.phpt6
-rw-r--r--ext/standard/tests/url/base64_encode_basic_002.phpt30
-rw-r--r--ext/standard/tests/url/bug47174.phpt2
-rw-r--r--ext/standard/tests/url/bug52327.phpt4
-rw-r--r--ext/standard/tests/url/bug55273.phpt6
-rw-r--r--ext/standard/tests/url/parse_url_basic_001.phpt42
-rw-r--r--ext/standard/tests/url/parse_url_basic_002.phpt4
-rw-r--r--ext/standard/tests/url/parse_url_basic_003.phpt4
-rw-r--r--ext/standard/tests/url/parse_url_basic_004.phpt4
-rw-r--r--ext/standard/tests/url/parse_url_basic_005.phpt4
-rw-r--r--ext/standard/tests/url/parse_url_basic_006.phpt4
-rw-r--r--ext/standard/tests/url/parse_url_basic_007.phpt4
-rw-r--r--ext/standard/tests/url/parse_url_basic_008.phpt20
-rw-r--r--ext/standard/tests/url/parse_url_basic_009.phpt8
-rw-r--r--ext/standard/tests/url/parse_url_basic_010.phpt6
-rw-r--r--ext/standard/tests/url/parse_url_error_002.phpt13
-rw-r--r--ext/standard/tests/url/parse_url_unterminated.phpt44
19 files changed, 145 insertions, 104 deletions
diff --git a/ext/standard/tests/url/base64_decode_basic_002.phpt b/ext/standard/tests/url/base64_decode_basic_002.phpt
index c538d15997..647fbd3b5c 100644
--- a/ext/standard/tests/url/base64_decode_basic_002.phpt
+++ b/ext/standard/tests/url/base64_decode_basic_002.phpt
@@ -16,7 +16,7 @@ var_dump(base64_decode($noWhiteSpace, true));
echo "\nWhitespace does not affect base64_decode, even with \$strict===true:\n";
$withWhiteSpace = "a GVs bG8gd2
- 9ybGQh";
+ 9ybGQh";
var_dump(base64_decode($withWhiteSpace));
var_dump(base64_decode($withWhiteSpace, false));
var_dump(base64_decode($withWhiteSpace, true));
diff --git a/ext/standard/tests/url/base64_decode_basic_003.phpt b/ext/standard/tests/url/base64_decode_basic_003.phpt
index 3bcd51e192..13c0f449d8 100644
--- a/ext/standard/tests/url/base64_decode_basic_003.phpt
+++ b/ext/standard/tests/url/base64_decode_basic_003.phpt
@@ -12,29 +12,29 @@ Test base64_decode() function : basic functionality - padding and whitespace
echo "Test base64_decode (output as JSON):\n";
$data = [
- "", "=", "==", "===", "====",
- "V", "V=", "V==", "V===", "V====",
- "VV", "VV=", "VV==", "VV===", "VV====",
- "VVV", "VVV=", "VVV==", "VVV===", "VVV====",
- "VVVV", "VVVV=", "VVVV==", "VVVV===", "VVVV====",
- "=V", "=VV", "=VVV",
- "==V", "==VV", "==VVV",
- "===V", "===VV", "===VVV",
- "====V", "====VV", "====VVV",
- "=VVV", "V=VV", "VV=V", "VVV=",
- "=VVVV", "V=VVV", "VV=VV", "VVV=V", "VVVV=",
- "=VVV=", "V=VV=", "VV=V=", "VVV==",
- "\nVV", "V\nV", "VV\n",
- "\nVV==", "V\nV==", "VV\n==", "VV=\n=", "VV==\n",
- "*VV", "V*V", "VV*",
- "*VV==", "V*V==", "VV*==", "VV=*=", "VV==*",
- "\0VV==", "V\0V==", "VV\0==", "VV=\0=", "VV==\0",
- "\0VVV==", "V\0VV==", "VV\0V==", "VVV\0==", "VVV=\0=", "VVV==\0",
+ "", "=", "==", "===", "====",
+ "V", "V=", "V==", "V===", "V====",
+ "VV", "VV=", "VV==", "VV===", "VV====",
+ "VVV", "VVV=", "VVV==", "VVV===", "VVV====",
+ "VVVV", "VVVV=", "VVVV==", "VVVV===", "VVVV====",
+ "=V", "=VV", "=VVV",
+ "==V", "==VV", "==VVV",
+ "===V", "===VV", "===VVV",
+ "====V", "====VV", "====VVV",
+ "=VVV", "V=VV", "VV=V", "VVV=",
+ "=VVVV", "V=VVV", "VV=VV", "VVV=V", "VVVV=",
+ "=VVV=", "V=VV=", "VV=V=", "VVV==",
+ "\nVV", "V\nV", "VV\n",
+ "\nVV==", "V\nV==", "VV\n==", "VV=\n=", "VV==\n",
+ "*VV", "V*V", "VV*",
+ "*VV==", "V*V==", "VV*==", "VV=*=", "VV==*",
+ "\0VV==", "V\0V==", "VV\0==", "VV=\0=", "VV==\0",
+ "\0VVV==", "V\0VV==", "VV\0V==", "VVV\0==", "VVV=\0=", "VVV==\0",
];
foreach ($data as $a) {
- $b = base64_decode($a, false);
- $c = base64_decode($a, true);
- printf("base64 %-16s non-strict %-8s strict %s\n", json_encode($a), json_encode($b), json_encode($c));
+ $b = base64_decode($a, false);
+ $c = base64_decode($a, true);
+ printf("base64 %-16s non-strict %-8s strict %s\n", json_encode($a), json_encode($b), json_encode($c));
}
echo "Done\n";
?>
diff --git a/ext/standard/tests/url/base64_encode_basic_001.phpt b/ext/standard/tests/url/base64_encode_basic_001.phpt
index 764e15f377..ff8c20e1b5 100644
--- a/ext/standard/tests/url/base64_encode_basic_001.phpt
+++ b/ext/standard/tests/url/base64_encode_basic_001.phpt
@@ -15,9 +15,9 @@ Test base64_encode() function : basic functionality
echo "*** Testing base64_encode() : basic functionality ***\n";
for ($i=0; $i<256; $i++) {
- $str = pack("c", $i);
- $enc = base64_encode($str);
- printf("0x%X: %s\n", $i, $enc);
+ $str = pack("c", $i);
+ $enc = base64_encode($str);
+ printf("0x%X: %s\n", $i, $enc);
}
echo "Done";
diff --git a/ext/standard/tests/url/base64_encode_basic_002.phpt b/ext/standard/tests/url/base64_encode_basic_002.phpt
index 2bcb7519ab..94af3c93bd 100644
--- a/ext/standard/tests/url/base64_encode_basic_002.phpt
+++ b/ext/standard/tests/url/base64_encode_basic_002.phpt
@@ -15,33 +15,32 @@ Test base64_encode() function : basic functionality - check algorithm round trip
echo "*** Testing base64_encode() : basic functionality ***\n";
$values = array(
- "Hello World",
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!%^&*(){}[]",
- "\n\t Line with control characters\r\n",
- "\xC1\xC2\xC3\xC4\xC5\xC6",
- "\75\76\77\78\79\80"
+ "Hello World",
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!%^&*(){}[]",
+ "\n\t Line with control characters\r\n",
+ "\xC1\xC2\xC3\xC4\xC5\xC6",
+ "\75\76\77\78\79\80"
);
echo "\n--- Testing base64_encode() with binary string input ---\n";
$counter = 1;
foreach($values as $str) {
- echo "-- Iteration $counter --\n";
+ echo "-- Iteration $counter --\n";
- $enc = base64_encode($str);
- $dec = base64_decode($enc);
+ $enc = base64_encode($str);
+ $dec = base64_decode($enc);
- if ($dec != $str) {
- echo "TEST FAILED\n";
- } else {
- echo "TEST PASSED\n";
- }
+ if ($dec != $str) {
+ echo "TEST FAILED\n";
+ } else {
+ echo "TEST PASSED\n";
+ }
- $counter ++;
+ $counter ++;
}
?>
-===Done===
--EXPECT--
*** Testing base64_encode() : basic functionality ***
@@ -56,4 +55,3 @@ TEST PASSED
TEST PASSED
-- Iteration 5 --
TEST PASSED
-===Done===
diff --git a/ext/standard/tests/url/bug47174.phpt b/ext/standard/tests/url/bug47174.phpt
index 6d08063253..a47b0e9666 100644
--- a/ext/standard/tests/url/bug47174.phpt
+++ b/ext/standard/tests/url/bug47174.phpt
@@ -3,7 +3,7 @@ Bug #47174 (base64_decode() interprets pad char in mid string as terminator)
--FILE--
<?php
if (base64_decode("dGVzdA==") == base64_decode("dGVzdA==CRAP")) {
- echo "Same octect data - Signature Valid\n";
+ echo "Same octet data - Signature Valid\n";
} else {
echo "Invalid Signature\n";
}
diff --git a/ext/standard/tests/url/bug52327.phpt b/ext/standard/tests/url/bug52327.phpt
index fb2e0fa25b..3450abcc4b 100644
--- a/ext/standard/tests/url/bug52327.phpt
+++ b/ext/standard/tests/url/bug52327.phpt
@@ -3,8 +3,8 @@ Bug #52327 (base64_decode() improper handling of leading padding)
--FILE--
<?php
var_dump(
- base64_decode('=VGhl=ICc9=JyBz=eW1i=b2xz=IGFy=ZW4n=dCBh=bGxv=d2Vk=IHdo=ZXJl=IGkg=cHV0=IHRo=ZW0g=by5P'),
- base64_decode('=VGhl=ICc9=JyBz=eW1i=b2xz=IGFy=ZW4n=dCBh=bGxv=d2Vk=IHdo=ZXJl=IGkg=cHV0=IHRo=ZW0g=by5P', true)
+ base64_decode('=VGhl=ICc9=JyBz=eW1i=b2xz=IGFy=ZW4n=dCBh=bGxv=d2Vk=IHdo=ZXJl=IGkg=cHV0=IHRo=ZW0g=by5P'),
+ base64_decode('=VGhl=ICc9=JyBz=eW1i=b2xz=IGFy=ZW4n=dCBh=bGxv=d2Vk=IHdo=ZXJl=IGkg=cHV0=IHRo=ZW0g=by5P', true)
);
?>
--EXPECT--
diff --git a/ext/standard/tests/url/bug55273.phpt b/ext/standard/tests/url/bug55273.phpt
index 1408506b42..e5c8fca70c 100644
--- a/ext/standard/tests/url/bug55273.phpt
+++ b/ext/standard/tests/url/bug55273.phpt
@@ -3,9 +3,9 @@ Bug #55273 (base64_decode() with strict rejects whitespace after pad)
--FILE--
<?php
function test($s) {
- $v = chunk_split(base64_encode($s));
- $r = base64_decode($v, True);
- var_dump($v, $r);
+ $v = chunk_split(base64_encode($s));
+ $r = base64_decode($v, True);
+ var_dump($v, $r);
}
test('PHP');
diff --git a/ext/standard/tests/url/parse_url_basic_001.phpt b/ext/standard/tests/url/parse_url_basic_001.phpt
index d59f080fbf..89a63010b9 100644
--- a/ext/standard/tests/url/parse_url_basic_001.phpt
+++ b/ext/standard/tests/url/parse_url_basic_001.phpt
@@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying the component
include_once(__DIR__ . '/urls.inc');
foreach ($urls as $url) {
- echo "\n--> $url: ";
- var_dump(parse_url($url));
+ echo "\n--> $url: ";
+ var_dump(parse_url($url));
}
echo "Done";
@@ -144,30 +144,36 @@ echo "Done";
string(10) "/index.php"
}
---> www.php.net/?: array(1) {
+--> www.php.net/?: array(2) {
["path"]=>
string(12) "www.php.net/"
+ ["query"]=>
+ string(0) ""
}
---> www.php.net:80/?: array(3) {
+--> www.php.net:80/?: array(4) {
["host"]=>
string(11) "www.php.net"
["port"]=>
int(80)
["path"]=>
string(1) "/"
+ ["query"]=>
+ string(0) ""
}
---> http://www.php.net/?: array(3) {
+--> http://www.php.net/?: array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
string(11) "www.php.net"
["path"]=>
string(1) "/"
+ ["query"]=>
+ string(0) ""
}
---> http://www.php.net:80/?: array(4) {
+--> http://www.php.net:80/?: array(5) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -176,6 +182,8 @@ echo "Done";
int(80)
["path"]=>
string(1) "/"
+ ["query"]=>
+ string(0) ""
}
--> http://www.php.net:80/index.php: array(4) {
@@ -290,7 +298,7 @@ echo "Done";
string(10) "/index.php"
}
---> http://www.php.net:80/index.php?: array(4) {
+--> http://www.php.net:80/index.php?: array(5) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -299,6 +307,8 @@ echo "Done";
int(80)
["path"]=>
string(10) "/index.php"
+ ["query"]=>
+ string(0) ""
}
--> http://www.php.net:80/#foo: array(5) {
@@ -314,7 +324,7 @@ echo "Done";
string(3) "foo"
}
---> http://www.php.net:80/?#: array(4) {
+--> http://www.php.net:80/?#: array(6) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -323,6 +333,10 @@ echo "Done";
int(80)
["path"]=>
string(1) "/"
+ ["query"]=>
+ string(0) ""
+ ["fragment"]=>
+ string(0) ""
}
--> http://www.php.net:80/?test=1: array(5) {
@@ -731,11 +745,13 @@ echo "Done";
string(4) "/:80"
}
---> http://x:?: array(2) {
+--> http://x:?: array(3) {
["scheme"]=>
string(4) "http"
["host"]=>
string(1) "x"
+ ["query"]=>
+ string(0) ""
}
--> x:blah.com: array(2) {
@@ -754,18 +770,22 @@ echo "Done";
--> x://::abc/?: bool(false)
---> http://::?: array(2) {
+--> http://::?: array(3) {
["scheme"]=>
string(4) "http"
["host"]=>
string(1) ":"
+ ["query"]=>
+ string(0) ""
}
---> http://::#: array(2) {
+--> http://::#: array(3) {
["scheme"]=>
string(4) "http"
["host"]=>
string(1) ":"
+ ["fragment"]=>
+ string(0) ""
}
--> x://::6.5: array(3) {
diff --git a/ext/standard/tests/url/parse_url_basic_002.phpt b/ext/standard/tests/url/parse_url_basic_002.phpt
index c8b94dec1c..9616278fc6 100644
--- a/ext/standard/tests/url/parse_url_basic_002.phpt
+++ b/ext/standard/tests/url/parse_url_basic_002.phpt
@@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying PHP_URL_SCHEM
include_once(__DIR__ . '/urls.inc');
foreach ($urls as $url) {
- echo "--> $url : ";
- var_dump(parse_url($url, PHP_URL_SCHEME));
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_SCHEME));
}
diff --git a/ext/standard/tests/url/parse_url_basic_003.phpt b/ext/standard/tests/url/parse_url_basic_003.phpt
index f917b77b97..668ee5aab2 100644
--- a/ext/standard/tests/url/parse_url_basic_003.phpt
+++ b/ext/standard/tests/url/parse_url_basic_003.phpt
@@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying PHP_URL_HOST
include_once(__DIR__ . '/urls.inc');
foreach ($urls as $url) {
- echo "--> $url : ";
- var_dump(parse_url($url, PHP_URL_HOST));
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_HOST));
}
echo "Done";
diff --git a/ext/standard/tests/url/parse_url_basic_004.phpt b/ext/standard/tests/url/parse_url_basic_004.phpt
index 29d4655243..464ed20d42 100644
--- a/ext/standard/tests/url/parse_url_basic_004.phpt
+++ b/ext/standard/tests/url/parse_url_basic_004.phpt
@@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying PHP_URL_PORT
include_once(__DIR__ . '/urls.inc');
foreach ($urls as $url) {
- echo "--> $url : ";
- var_dump(parse_url($url, PHP_URL_PORT));
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_PORT));
}
echo "Done";
diff --git a/ext/standard/tests/url/parse_url_basic_005.phpt b/ext/standard/tests/url/parse_url_basic_005.phpt
index 716d8d1dfa..f776181987 100644
--- a/ext/standard/tests/url/parse_url_basic_005.phpt
+++ b/ext/standard/tests/url/parse_url_basic_005.phpt
@@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying PHP_URL_USER
include_once(__DIR__ . '/urls.inc');
foreach ($urls as $url) {
- echo "--> $url : ";
- var_dump(parse_url($url, PHP_URL_USER));
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_USER));
}
echo "Done";
diff --git a/ext/standard/tests/url/parse_url_basic_006.phpt b/ext/standard/tests/url/parse_url_basic_006.phpt
index 3ae94ca626..fc6378106b 100644
--- a/ext/standard/tests/url/parse_url_basic_006.phpt
+++ b/ext/standard/tests/url/parse_url_basic_006.phpt
@@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying PHP_URL_PASS
include_once(__DIR__ . '/urls.inc');
foreach ($urls as $url) {
- echo "--> $url : ";
- var_dump(parse_url($url, PHP_URL_PASS));
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_PASS));
}
echo "Done";
diff --git a/ext/standard/tests/url/parse_url_basic_007.phpt b/ext/standard/tests/url/parse_url_basic_007.phpt
index 8cad27e958..ebcd968879 100644
--- a/ext/standard/tests/url/parse_url_basic_007.phpt
+++ b/ext/standard/tests/url/parse_url_basic_007.phpt
@@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying PHP_URL_PATH
include_once(__DIR__ . '/urls.inc');
foreach ($urls as $url) {
- echo "--> $url : ";
- var_dump(parse_url($url, PHP_URL_PATH));
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_PATH));
}
echo "Done";
diff --git a/ext/standard/tests/url/parse_url_basic_008.phpt b/ext/standard/tests/url/parse_url_basic_008.phpt
index 761eb61179..033a4489d0 100644
--- a/ext/standard/tests/url/parse_url_basic_008.phpt
+++ b/ext/standard/tests/url/parse_url_basic_008.phpt
@@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying PHP_URL_QUERY
include_once(__DIR__ . '/urls.inc');
foreach ($urls as $url) {
- echo "--> $url : ";
- var_dump(parse_url($url, PHP_URL_QUERY));
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_QUERY));
}
echo "Done";
@@ -38,10 +38,10 @@ echo "Done";
--> http://www.php.net:80 : NULL
--> http://www.php.net:80/ : NULL
--> http://www.php.net/index.php : NULL
---> www.php.net/? : NULL
---> www.php.net:80/? : NULL
---> http://www.php.net/? : NULL
---> http://www.php.net:80/? : NULL
+--> www.php.net/? : string(0) ""
+--> www.php.net:80/? : string(0) ""
+--> http://www.php.net/? : string(0) ""
+--> http://www.php.net:80/? : string(0) ""
--> http://www.php.net:80/index.php : NULL
--> http://www.php.net:80/foo/bar/index.php : NULL
--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL
@@ -52,9 +52,9 @@ echo "Done";
--> http://www.php.net:80/this/../a/../deep/directory/ : NULL
--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : NULL
--> http://www.php.net:80/index.php : NULL
---> http://www.php.net:80/index.php? : NULL
+--> http://www.php.net:80/index.php? : string(0) ""
--> http://www.php.net:80/#foo : NULL
---> http://www.php.net:80/?# : NULL
+--> http://www.php.net:80/?# : string(0) ""
--> http://www.php.net:80/?test=1 : string(6) "test=1"
--> http://www.php.net/?test=1& : string(7) "test=1&"
--> http://www.php.net:80/?& : string(1) "&"
@@ -91,11 +91,11 @@ echo "Done";
--> gg:9130731 : NULL
--> http://user:@pass@host/path?argument?value#etc : string(14) "argument?value"
--> http://10.10.10.10/:80 : NULL
---> http://x:? : NULL
+--> http://x:? : string(0) ""
--> x:blah.com : NULL
--> x:/blah.com : NULL
--> x://::abc/? : bool(false)
---> http://::? : NULL
+--> http://::? : string(0) ""
--> http://::# : NULL
--> x://::6.5 : NULL
--> http://?:/ : bool(false)
diff --git a/ext/standard/tests/url/parse_url_basic_009.phpt b/ext/standard/tests/url/parse_url_basic_009.phpt
index f08787761d..539d05bbd7 100644
--- a/ext/standard/tests/url/parse_url_basic_009.phpt
+++ b/ext/standard/tests/url/parse_url_basic_009.phpt
@@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying PHP_URL_FRAGM
include_once(__DIR__ . '/urls.inc');
foreach ($urls as $url) {
- echo "--> $url : ";
- var_dump(parse_url($url, PHP_URL_FRAGMENT));
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_FRAGMENT));
}
echo "Done";
@@ -54,7 +54,7 @@ echo "Done";
--> http://www.php.net:80/index.php : NULL
--> http://www.php.net:80/index.php? : NULL
--> http://www.php.net:80/#foo : string(3) "foo"
---> http://www.php.net:80/?# : NULL
+--> http://www.php.net:80/?# : string(0) ""
--> http://www.php.net:80/?test=1 : NULL
--> http://www.php.net/?test=1& : NULL
--> http://www.php.net:80/?& : NULL
@@ -96,7 +96,7 @@ echo "Done";
--> x:/blah.com : NULL
--> x://::abc/? : bool(false)
--> http://::? : NULL
---> http://::# : NULL
+--> http://::# : string(0) ""
--> x://::6.5 : NULL
--> http://?:/ : bool(false)
--> http://@?:/ : bool(false)
diff --git a/ext/standard/tests/url/parse_url_basic_010.phpt b/ext/standard/tests/url/parse_url_basic_010.phpt
index 8fecb9d8eb..bf1835fbf8 100644
--- a/ext/standard/tests/url/parse_url_basic_010.phpt
+++ b/ext/standard/tests/url/parse_url_basic_010.phpt
@@ -12,9 +12,9 @@ Test parse_url() function : check values of URL related constants
* check values of URL related constants
*/
foreach(get_defined_constants() as $constantName => $constantValue) {
- if (strpos($constantName, 'PHP_URL')===0) {
- echo "$constantName: $constantValue \n";
- }
+ if (strpos($constantName, 'PHP_URL')===0) {
+ echo "$constantName: $constantValue \n";
+ }
}
echo "Done";
diff --git a/ext/standard/tests/url/parse_url_error_002.phpt b/ext/standard/tests/url/parse_url_error_002.phpt
index 5af4232e0c..f1581632d0 100644
--- a/ext/standard/tests/url/parse_url_error_002.phpt
+++ b/ext/standard/tests/url/parse_url_error_002.phpt
@@ -14,12 +14,16 @@ $url = 'http://secret:hideout@www.php.net:80/index.php?test=1&test2=char&test3=m
echo "--> Below range:";
var_dump(parse_url($url, -1));
-echo "\n\n--> Above range:";
-var_dump(parse_url($url, 99));
+echo "\n\n--> Above range:\n";
+try {
+ parse_url($url, 99);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
echo "Done"
?>
---EXPECTF--
+--EXPECT--
*** Testing parse_url() : error conditions: url component specifier out of range ***
--> Below range:array(8) {
["scheme"]=>
@@ -42,6 +46,5 @@ echo "Done"
--> Above range:
-Warning: parse_url(): Invalid URL component identifier 99 in %s on line 15
-bool(false)
+parse_url(): Argument #2 ($component) must be a valid URL component identifier, 99 given
Done
diff --git a/ext/standard/tests/url/parse_url_unterminated.phpt b/ext/standard/tests/url/parse_url_unterminated.phpt
index 94975ee889..f7d5cca896 100644
--- a/ext/standard/tests/url/parse_url_unterminated.phpt
+++ b/ext/standard/tests/url/parse_url_unterminated.phpt
@@ -14,9 +14,9 @@ if (!function_exists('zend_create_unterminated_string')) die('skip ext/test requ
include_once(__DIR__ . '/urls.inc');
foreach ($urls as $url) {
- echo "\n--> $url: ";
- $str = zend_create_unterminated_string($url);
- var_dump(parse_url($str));
+ echo "\n--> $url: ";
+ $str = zend_create_unterminated_string($url);
+ var_dump(parse_url($str));
zend_terminate_string($str);
}
@@ -146,30 +146,36 @@ echo "Done";
string(10) "/index.php"
}
---> www.php.net/?: array(1) {
+--> www.php.net/?: array(2) {
["path"]=>
string(12) "www.php.net/"
+ ["query"]=>
+ string(0) ""
}
---> www.php.net:80/?: array(3) {
+--> www.php.net:80/?: array(4) {
["host"]=>
string(11) "www.php.net"
["port"]=>
int(80)
["path"]=>
string(1) "/"
+ ["query"]=>
+ string(0) ""
}
---> http://www.php.net/?: array(3) {
+--> http://www.php.net/?: array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
string(11) "www.php.net"
["path"]=>
string(1) "/"
+ ["query"]=>
+ string(0) ""
}
---> http://www.php.net:80/?: array(4) {
+--> http://www.php.net:80/?: array(5) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -178,6 +184,8 @@ echo "Done";
int(80)
["path"]=>
string(1) "/"
+ ["query"]=>
+ string(0) ""
}
--> http://www.php.net:80/index.php: array(4) {
@@ -292,7 +300,7 @@ echo "Done";
string(10) "/index.php"
}
---> http://www.php.net:80/index.php?: array(4) {
+--> http://www.php.net:80/index.php?: array(5) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -301,6 +309,8 @@ echo "Done";
int(80)
["path"]=>
string(10) "/index.php"
+ ["query"]=>
+ string(0) ""
}
--> http://www.php.net:80/#foo: array(5) {
@@ -316,7 +326,7 @@ echo "Done";
string(3) "foo"
}
---> http://www.php.net:80/?#: array(4) {
+--> http://www.php.net:80/?#: array(6) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -325,6 +335,10 @@ echo "Done";
int(80)
["path"]=>
string(1) "/"
+ ["query"]=>
+ string(0) ""
+ ["fragment"]=>
+ string(0) ""
}
--> http://www.php.net:80/?test=1: array(5) {
@@ -733,11 +747,13 @@ echo "Done";
string(4) "/:80"
}
---> http://x:?: array(2) {
+--> http://x:?: array(3) {
["scheme"]=>
string(4) "http"
["host"]=>
string(1) "x"
+ ["query"]=>
+ string(0) ""
}
--> x:blah.com: array(2) {
@@ -756,18 +772,22 @@ echo "Done";
--> x://::abc/?: bool(false)
---> http://::?: array(2) {
+--> http://::?: array(3) {
["scheme"]=>
string(4) "http"
["host"]=>
string(1) ":"
+ ["query"]=>
+ string(0) ""
}
---> http://::#: array(2) {
+--> http://::#: array(3) {
["scheme"]=>
string(4) "http"
["host"]=>
string(1) ":"
+ ["fragment"]=>
+ string(0) ""
}
--> x://::6.5: array(3) {