From 91df70bdaad85f484815c0fdfea3695da6cec0e8 Mon Sep 17 00:00:00 2001 From: Robin Fernandes Date: Fri, 11 Apr 2008 08:57:06 +0000 Subject: [PATCH] Adding some tests for ereg and url functions. --- ext/ereg/tests/ereg_basic_001.phpt | 127 ++ ext/ereg/tests/ereg_basic_002.phpt | 56 + ext/ereg/tests/ereg_basic_003.phpt | 25 + ext/ereg/tests/ereg_basic_004.phpt | 33 + ext/ereg/tests/ereg_error_001.phpt | 45 + ext/ereg/tests/ereg_error_002.phpt | 88 + ext/ereg/tests/ereg_replace_basic_001.phpt | 60 + ext/ereg/tests/ereg_replace_basic_002.phpt | 30 + ext/ereg/tests/ereg_replace_error_001.phpt | 42 + ext/ereg/tests/ereg_replace_error_002.phpt | 76 + .../tests/ereg_replace_variation_001.phpt | 180 ++ .../tests/ereg_replace_variation_002.phpt | 168 ++ .../tests/ereg_replace_variation_003.phpt | 267 +++ ext/ereg/tests/ereg_variation_001.phpt | 284 +++ ext/ereg/tests/ereg_variation_002.phpt | 267 +++ ext/ereg/tests/ereg_variation_003.phpt | 283 +++ ext/ereg/tests/ereg_variation_004.phpt | 18 + ext/ereg/tests/eregi_basic.phpt | 41 + ext/ereg/tests/eregi_basic_001.phpt | 127 ++ ext/ereg/tests/eregi_basic_002.phpt | 56 + ext/ereg/tests/eregi_basic_003.phpt | 25 + ext/ereg/tests/eregi_basic_004.phpt | 31 + ext/ereg/tests/eregi_error_001.phpt | 45 + ext/ereg/tests/eregi_error_002.phpt | 88 + ext/ereg/tests/eregi_replace_basic.phpt | 36 + ext/ereg/tests/eregi_replace_basic_001.phpt | 60 + ext/ereg/tests/eregi_replace_basic_002.phpt | 28 + ext/ereg/tests/eregi_replace_error_001.phpt | 42 + ext/ereg/tests/eregi_replace_error_002.phpt | 76 + .../tests/eregi_replace_variation_001.phpt | 180 ++ .../tests/eregi_replace_variation_002.phpt | 168 ++ .../tests/eregi_replace_variation_003.phpt | 267 +++ ext/ereg/tests/eregi_variation_001.phpt | 284 +++ ext/ereg/tests/eregi_variation_002.phpt | 267 +++ ext/ereg/tests/eregi_variation_003.phpt | 283 +++ ext/ereg/tests/eregi_variation_004.phpt | 18 + ext/ereg/tests/regular_expressions.inc | 24 + ext/ereg/tests/split_basic_001.phpt | 129 ++ ext/ereg/tests/split_basic_002.phpt | 227 +++ ext/ereg/tests/split_basic_003.phpt | 48 + ext/ereg/tests/split_error_001.phpt | 41 + ext/ereg/tests/split_error_002.phpt | 88 + ext/ereg/tests/split_variation_001.phpt | 441 ++++ ext/ereg/tests/split_variation_002.phpt | 465 +++++ ext/ereg/tests/split_variation_003.phpt | 244 +++ ext/ereg/tests/split_variation_004.phpt | 48 + ext/ereg/tests/spliti_basic_001.phpt | 129 ++ ext/ereg/tests/spliti_basic_002.phpt | 227 +++ ext/ereg/tests/spliti_basic_003.phpt | 43 + ext/ereg/tests/spliti_basic_004.phpt | 45 + ext/ereg/tests/spliti_error_001.phpt | 41 + ext/ereg/tests/spliti_error_002.phpt | 88 + ext/ereg/tests/spliti_variation_001.phpt | 441 ++++ ext/ereg/tests/spliti_variation_002.phpt | 469 +++++ ext/ereg/tests/spliti_variation_003.phpt | 244 +++ ext/ereg/tests/spliti_variation_004.phpt | 48 + ext/ereg/tests/sql_regcase_basic_001.phpt | 25 + ext/ereg/tests/sql_regcase_error_001.phpt | 37 + ext/ereg/tests/sql_regcase_variation_001.phpt | 265 +++ .../tests/url/base64_decode_basic_001.phpt | 30 + .../tests/url/base64_decode_basic_002.phpt | 47 + .../tests/url/base64_decode_error_001.phpt | 38 + .../url/base64_decode_variation_001.phpt | 264 +++ .../url/base64_decode_variation_002.phpt | 280 +++ .../tests/url/base64_encode_basic_001.phpt | 283 +++ .../tests/url/base64_encode_error_001.phpt | 37 + .../url/base64_encode_variation_001.phpt | 266 +++ .../tests/url/parse_url_basic_001.phpt | 1776 +++++++++++++++++ .../tests/url/parse_url_basic_002.phpt | 279 +++ .../tests/url/parse_url_basic_003.phpt | 278 +++ .../tests/url/parse_url_basic_004.phpt | 150 ++ .../tests/url/parse_url_basic_005.phpt | 278 +++ .../tests/url/parse_url_basic_006.phpt | 278 +++ .../tests/url/parse_url_basic_007.phpt | 278 +++ .../tests/url/parse_url_basic_008.phpt | 278 +++ .../tests/url/parse_url_basic_009.phpt | 278 +++ .../tests/url/parse_url_basic_010.phpt | 31 + .../tests/url/parse_url_error_001.phpt | 38 + .../tests/url/parse_url_error_002.phpt | 73 + .../tests/url/parse_url_variation_001.phpt | 375 ++++ .../tests/url/parse_url_variation_002.phpt | 296 +++ .../tests/url/rawurldecode_error_001.phpt | 39 + .../tests/url/rawurldecode_variation_001.phpt | 267 +++ .../tests/url/rawurlencode_error_001.phpt | 39 + .../tests/url/rawurlencode_variation_001.phpt | 267 +++ .../tests/url/urldecode_error_001.phpt | 39 + .../tests/url/urldecode_variation_001.phpt | 267 +++ .../tests/url/urlencode_error_001.phpt | 39 + .../tests/url/urlencode_variation_001.phpt | 267 +++ ext/standard/tests/url/urls.inc | 109 + 90 files changed, 15292 insertions(+) create mode 100644 ext/ereg/tests/ereg_basic_001.phpt create mode 100644 ext/ereg/tests/ereg_basic_002.phpt create mode 100644 ext/ereg/tests/ereg_basic_003.phpt create mode 100644 ext/ereg/tests/ereg_basic_004.phpt create mode 100644 ext/ereg/tests/ereg_error_001.phpt create mode 100644 ext/ereg/tests/ereg_error_002.phpt create mode 100644 ext/ereg/tests/ereg_replace_basic_001.phpt create mode 100644 ext/ereg/tests/ereg_replace_basic_002.phpt create mode 100644 ext/ereg/tests/ereg_replace_error_001.phpt create mode 100644 ext/ereg/tests/ereg_replace_error_002.phpt create mode 100644 ext/ereg/tests/ereg_replace_variation_001.phpt create mode 100644 ext/ereg/tests/ereg_replace_variation_002.phpt create mode 100644 ext/ereg/tests/ereg_replace_variation_003.phpt create mode 100644 ext/ereg/tests/ereg_variation_001.phpt create mode 100644 ext/ereg/tests/ereg_variation_002.phpt create mode 100644 ext/ereg/tests/ereg_variation_003.phpt create mode 100644 ext/ereg/tests/ereg_variation_004.phpt create mode 100644 ext/ereg/tests/eregi_basic.phpt create mode 100644 ext/ereg/tests/eregi_basic_001.phpt create mode 100644 ext/ereg/tests/eregi_basic_002.phpt create mode 100644 ext/ereg/tests/eregi_basic_003.phpt create mode 100644 ext/ereg/tests/eregi_basic_004.phpt create mode 100644 ext/ereg/tests/eregi_error_001.phpt create mode 100644 ext/ereg/tests/eregi_error_002.phpt create mode 100644 ext/ereg/tests/eregi_replace_basic.phpt create mode 100644 ext/ereg/tests/eregi_replace_basic_001.phpt create mode 100644 ext/ereg/tests/eregi_replace_basic_002.phpt create mode 100644 ext/ereg/tests/eregi_replace_error_001.phpt create mode 100644 ext/ereg/tests/eregi_replace_error_002.phpt create mode 100644 ext/ereg/tests/eregi_replace_variation_001.phpt create mode 100644 ext/ereg/tests/eregi_replace_variation_002.phpt create mode 100644 ext/ereg/tests/eregi_replace_variation_003.phpt create mode 100644 ext/ereg/tests/eregi_variation_001.phpt create mode 100644 ext/ereg/tests/eregi_variation_002.phpt create mode 100644 ext/ereg/tests/eregi_variation_003.phpt create mode 100644 ext/ereg/tests/eregi_variation_004.phpt create mode 100644 ext/ereg/tests/regular_expressions.inc create mode 100644 ext/ereg/tests/split_basic_001.phpt create mode 100644 ext/ereg/tests/split_basic_002.phpt create mode 100644 ext/ereg/tests/split_basic_003.phpt create mode 100644 ext/ereg/tests/split_error_001.phpt create mode 100644 ext/ereg/tests/split_error_002.phpt create mode 100644 ext/ereg/tests/split_variation_001.phpt create mode 100644 ext/ereg/tests/split_variation_002.phpt create mode 100644 ext/ereg/tests/split_variation_003.phpt create mode 100644 ext/ereg/tests/split_variation_004.phpt create mode 100644 ext/ereg/tests/spliti_basic_001.phpt create mode 100644 ext/ereg/tests/spliti_basic_002.phpt create mode 100644 ext/ereg/tests/spliti_basic_003.phpt create mode 100644 ext/ereg/tests/spliti_basic_004.phpt create mode 100644 ext/ereg/tests/spliti_error_001.phpt create mode 100644 ext/ereg/tests/spliti_error_002.phpt create mode 100644 ext/ereg/tests/spliti_variation_001.phpt create mode 100644 ext/ereg/tests/spliti_variation_002.phpt create mode 100644 ext/ereg/tests/spliti_variation_003.phpt create mode 100644 ext/ereg/tests/spliti_variation_004.phpt create mode 100644 ext/ereg/tests/sql_regcase_basic_001.phpt create mode 100644 ext/ereg/tests/sql_regcase_error_001.phpt create mode 100644 ext/ereg/tests/sql_regcase_variation_001.phpt create mode 100644 ext/standard/tests/url/base64_decode_basic_001.phpt create mode 100644 ext/standard/tests/url/base64_decode_basic_002.phpt create mode 100644 ext/standard/tests/url/base64_decode_error_001.phpt create mode 100644 ext/standard/tests/url/base64_decode_variation_001.phpt create mode 100644 ext/standard/tests/url/base64_decode_variation_002.phpt create mode 100644 ext/standard/tests/url/base64_encode_basic_001.phpt create mode 100644 ext/standard/tests/url/base64_encode_error_001.phpt create mode 100644 ext/standard/tests/url/base64_encode_variation_001.phpt create mode 100644 ext/standard/tests/url/parse_url_basic_001.phpt create mode 100644 ext/standard/tests/url/parse_url_basic_002.phpt create mode 100644 ext/standard/tests/url/parse_url_basic_003.phpt create mode 100644 ext/standard/tests/url/parse_url_basic_004.phpt create mode 100644 ext/standard/tests/url/parse_url_basic_005.phpt create mode 100644 ext/standard/tests/url/parse_url_basic_006.phpt create mode 100644 ext/standard/tests/url/parse_url_basic_007.phpt create mode 100644 ext/standard/tests/url/parse_url_basic_008.phpt create mode 100644 ext/standard/tests/url/parse_url_basic_009.phpt create mode 100644 ext/standard/tests/url/parse_url_basic_010.phpt create mode 100644 ext/standard/tests/url/parse_url_error_001.phpt create mode 100644 ext/standard/tests/url/parse_url_error_002.phpt create mode 100644 ext/standard/tests/url/parse_url_variation_001.phpt create mode 100644 ext/standard/tests/url/parse_url_variation_002.phpt create mode 100644 ext/standard/tests/url/rawurldecode_error_001.phpt create mode 100644 ext/standard/tests/url/rawurldecode_variation_001.phpt create mode 100644 ext/standard/tests/url/rawurlencode_error_001.phpt create mode 100644 ext/standard/tests/url/rawurlencode_variation_001.phpt create mode 100644 ext/standard/tests/url/urldecode_error_001.phpt create mode 100644 ext/standard/tests/url/urldecode_variation_001.phpt create mode 100644 ext/standard/tests/url/urlencode_error_001.phpt create mode 100644 ext/standard/tests/url/urlencode_variation_001.phpt create mode 100644 ext/standard/tests/url/urls.inc diff --git a/ext/ereg/tests/ereg_basic_001.phpt b/ext/ereg/tests/ereg_basic_001.phpt new file mode 100644 index 0000000000..485b2d26e8 --- /dev/null +++ b/ext/ereg/tests/ereg_basic_001.phpt @@ -0,0 +1,127 @@ +--TEST-- +Test ereg() function : basic functionality (with $regs) +--FILE-- + Pattern: '$pattern'; string: '$string'\n"; + var_dump(ereg($pattern, $string, $regs)); + var_dump($regs); +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing ereg() : basic functionality *** +--> Pattern: '..(a|b|c)(a|b|c)..'; string: '--- ab ---' +int(6) +array(3) { + [0]=> + string(6) "- ab -" + [1]=> + string(1) "a" + [2]=> + string(1) "b" +} +--> Pattern: '()'; string: '' +int(1) +array(2) { + [0]=> + bool(false) + [1]=> + bool(false) +} +--> Pattern: '()'; string: 'abcdef' +int(1) +array(2) { + [0]=> + bool(false) + [1]=> + bool(false) +} +--> Pattern: '[x]|[^x]'; string: 'abcdef' +int(1) +array(1) { + [0]=> + string(1) "a" +} +--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; string: '--- aaa bbb ccc ddd ---' +int(15) +array(6) { + [0]=> + string(15) "aaa bbb ccc ddd" + [1]=> + string(1) "a" + [2]=> + string(2) "aa" + [3]=> + string(3) "bbb" + [4]=> + string(3) "ccc" + [5]=> + string(3) "ddd" +} +--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; string: '\`^.[$()|*+?{'' +int(14) +array(1) { + [0]=> + string(14) "\`^.[$()|*+?{'" +} +--> Pattern: '\a'; string: 'a' +int(1) +array(1) { + [0]=> + string(1) "a" +} +--> Pattern: '[0-9][^0-9]'; string: '2a' +int(2) +array(1) { + [0]=> + string(2) "2a" +} +--> Pattern: '^[[:alnum:]]{62,62}$'; string: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' +int(62) +array(1) { + [0]=> + string(62) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" +} +--> Pattern: '^[[:digit:]]{5}'; string: '0123456789' +int(5) +array(1) { + [0]=> + string(5) "01234" +} +--> Pattern: '[[:digit:]]{5}$'; string: '0123456789' +int(5) +array(1) { + [0]=> + string(5) "56789" +} +--> Pattern: '[[:blank:]]{1,10}'; string: ' + ' +int(2) +array(1) { + [0]=> + string(2) " " +} +--> Pattern: '[[:print:]]{3}'; string: ' a ' +int(3) +array(1) { + [0]=> + string(3) " a " +} +Done \ No newline at end of file diff --git a/ext/ereg/tests/ereg_basic_002.phpt b/ext/ereg/tests/ereg_basic_002.phpt new file mode 100644 index 0000000000..672632fc7d --- /dev/null +++ b/ext/ereg/tests/ereg_basic_002.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test ereg() function : basic functionality (without $regs) +--FILE-- + Pattern: '$pattern'; string: '$string'\n"; + var_dump(ereg($pattern, $string)); +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing ereg() : basic functionality *** +--> Pattern: '..(a|b|c)(a|b|c)..'; string: '--- ab ---' +int(1) +--> Pattern: '()'; string: '' +int(1) +--> Pattern: '()'; string: 'abcdef' +int(1) +--> Pattern: '[x]|[^x]'; string: 'abcdef' +int(1) +--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; string: '--- aaa bbb ccc ddd ---' +int(1) +--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; string: '\`^.[$()|*+?{'' +int(1) +--> Pattern: '\a'; string: 'a' +int(1) +--> Pattern: '[0-9][^0-9]'; string: '2a' +int(1) +--> Pattern: '^[[:alnum:]]{62,62}$'; string: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' +int(1) +--> Pattern: '^[[:digit:]]{5}'; string: '0123456789' +int(1) +--> Pattern: '[[:digit:]]{5}$'; string: '0123456789' +int(1) +--> Pattern: '[[:blank:]]{1,10}'; string: ' + ' +int(1) +--> Pattern: '[[:print:]]{3}'; string: ' a ' +int(1) +Done \ No newline at end of file diff --git a/ext/ereg/tests/ereg_basic_003.phpt b/ext/ereg/tests/ereg_basic_003.phpt new file mode 100644 index 0000000000..00b8d936af --- /dev/null +++ b/ext/ereg/tests/ereg_basic_003.phpt @@ -0,0 +1,25 @@ +--TEST-- +Test ereg() function : basic functionality - long RE +--FILE-- + +--EXPECTF-- +int(1) +int(2048) +int(2049) +Done \ No newline at end of file diff --git a/ext/ereg/tests/ereg_basic_004.phpt b/ext/ereg/tests/ereg_basic_004.phpt new file mode 100644 index 0000000000..02f45bc7cd --- /dev/null +++ b/ext/ereg/tests/ereg_basic_004.phpt @@ -0,0 +1,33 @@ +--TEST-- +Test ereg() function : basic functionality - a few non-matches +--FILE-- + +--EXPECTF-- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +string(8) "original" +Done \ No newline at end of file diff --git a/ext/ereg/tests/ereg_error_001.phpt b/ext/ereg/tests/ereg_error_001.phpt new file mode 100644 index 0000000000..44bb1f9653 --- /dev/null +++ b/ext/ereg/tests/ereg_error_001.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test ereg() function : error conditions - wrong number of args +--FILE-- + +--EXPECTF-- +*** Testing ereg() : error conditions *** + +-- Testing ereg() function with more than expected no. of arguments -- + +Warning: Wrong parameter count for ereg() in %s on line 21 +NULL + +-- Testing ereg() function with less than expected no. of arguments -- + +Warning: Wrong parameter count for ereg() in %s on line 26 +NULL +Done diff --git a/ext/ereg/tests/ereg_error_002.phpt b/ext/ereg/tests/ereg_error_002.phpt new file mode 100644 index 0000000000..5c8c8bba98 --- /dev/null +++ b/ext/ereg/tests/ereg_error_002.phpt @@ -0,0 +1,88 @@ +--TEST-- +Test ereg() function : error conditions - test bad regular expressions +--FILE-- + +--EXPECTF-- +*** Testing ereg() : error conditions *** + +Warning: ereg(): REG_EMPTY in %s on line 16 +bool(false) + +Warning: ereg(): REG_EPAREN in %s on line 17 +bool(false) + +Warning: ereg(): REG_EBRACK in %s on line 18 +bool(false) + +Warning: ereg(): REG_EPAREN in %s on line 19 +bool(false) + +Warning: ereg(): REG_BADRPT in %s on line 20 +bool(false) + +Warning: ereg(): REG_BADRPT in %s on line 21 +bool(false) + +Warning: ereg(): REG_BADRPT in %s on line 22 +bool(false) + +Warning: ereg(): REG_BADRPT in %s on line 23 +bool(false) + +Warning: ereg(): REG_BADBR in %s on line 24 +bool(false) + +Warning: ereg(): REG_EMPTY in %s on line 25 +bool(false) + +Warning: ereg(): REG_EMPTY in %s on line 26 +bool(false) + +Warning: ereg(): REG_BADBR in %s on line 27 +bool(false) + +Warning: ereg(): REG_ERANGE in %s on line 28 +bool(false) + +Warning: ereg(): REG_EESCAPE in %s on line 29 +bool(false) + +Warning: ereg(): REG_ERANGE in %s on line 30 +bool(false) +string(8) "original" +Done \ No newline at end of file diff --git a/ext/ereg/tests/ereg_replace_basic_001.phpt b/ext/ereg/tests/ereg_replace_basic_001.phpt new file mode 100644 index 0000000000..b63587e25c --- /dev/null +++ b/ext/ereg/tests/ereg_replace_basic_001.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test ereg_replace() function : basic functionality +--FILE-- + Pattern: '$pattern'; match: '$match'\n"; + var_dump(ereg_replace($pattern, $replacement, $match . ' this contains some matches ' . $match)); +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing ereg() : basic functionality *** +--> Pattern: '..(a|b|c)(a|b|c)..'; match: '--- ab ---' +string(82) "--[this is a replacement]-- this contains some matches --[this is a replacement]--" +--> Pattern: '()'; match: '' +string(695) "[this is a replacement] [this is a replacement]t[this is a replacement]h[this is a replacement]i[this is a replacement]s[this is a replacement] [this is a replacement]c[this is a replacement]o[this is a replacement]n[this is a replacement]t[this is a replacement]a[this is a replacement]i[this is a replacement]n[this is a replacement]s[this is a replacement] [this is a replacement]s[this is a replacement]o[this is a replacement]m[this is a replacement]e[this is a replacement] [this is a replacement]m[this is a replacement]a[this is a replacement]t[this is a replacement]c[this is a replacement]h[this is a replacement]e[this is a replacement]s[this is a replacement] [this is a replacement]" +--> Pattern: '()'; match: 'abcdef' +string(983) "[this is a replacement]a[this is a replacement]b[this is a replacement]c[this is a replacement]d[this is a replacement]e[this is a replacement]f[this is a replacement] [this is a replacement]t[this is a replacement]h[this is a replacement]i[this is a replacement]s[this is a replacement] [this is a replacement]c[this is a replacement]o[this is a replacement]n[this is a replacement]t[this is a replacement]a[this is a replacement]i[this is a replacement]n[this is a replacement]s[this is a replacement] [this is a replacement]s[this is a replacement]o[this is a replacement]m[this is a replacement]e[this is a replacement] [this is a replacement]m[this is a replacement]a[this is a replacement]t[this is a replacement]c[this is a replacement]h[this is a replacement]e[this is a replacement]s[this is a replacement] [this is a replacement]a[this is a replacement]b[this is a replacement]c[this is a replacement]d[this is a replacement]e[this is a replacement]f[this is a replacement]" +--> Pattern: '[x]|[^x]'; match: 'abcdef' +string(920) "[this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement]" +--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; match: '--- aaa bbb ccc ddd ---' +string(90) "--- [this is a replacement] --- this contains some matches --- [this is a replacement] ---" +--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; match: '\`^.[$()|*+?{'' +string(74) "[this is a replacement] this contains some matches [this is a replacement]" +--> Pattern: '\a'; match: 'a' +string(118) "[this is a replacement] this cont[this is a replacement]ins some m[this is a replacement]tches [this is a replacement]" +--> Pattern: '[0-9][^0-9]'; match: '2a' +string(74) "[this is a replacement] this contains some matches [this is a replacement]" +--> Pattern: '^[[:alnum:]]{62,62}$'; match: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' +string(152) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ this contains some matches 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" +--> Pattern: '^[[:digit:]]{5}'; match: '0123456789' +string(66) "[this is a replacement]56789 this contains some matches 0123456789" +--> Pattern: '[[:digit:]]{5}$'; match: '0123456789' +string(66) "0123456789 this contains some matches 01234[this is a replacement]" +--> Pattern: '[[:blank:]]{1,10}'; match: ' + ' +string(163) " +[this is a replacement]this[this is a replacement]contains[this is a replacement]some[this is a replacement]matches[this is a replacement] +[this is a replacement]" +--> Pattern: '[[:print:]]{3}'; match: ' a ' +string(254) "[this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement] " +Done \ No newline at end of file diff --git a/ext/ereg/tests/ereg_replace_basic_002.phpt b/ext/ereg/tests/ereg_replace_basic_002.phpt new file mode 100644 index 0000000000..9b01964588 --- /dev/null +++ b/ext/ereg/tests/ereg_replace_basic_002.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test ereg_replace() function : basic functionality - a few non-matches +--FILE-- + +--EXPECTF-- +string(1) "a" +string(1) "0" +string(3) "aaa" +string(2) "ba" +string(2) "ba" +string(1) "x" +Done \ No newline at end of file diff --git a/ext/ereg/tests/ereg_replace_error_001.phpt b/ext/ereg/tests/ereg_replace_error_001.phpt new file mode 100644 index 0000000000..e6aedf47e2 --- /dev/null +++ b/ext/ereg/tests/ereg_replace_error_001.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test ereg_replace() function : error conditions - wrong number of args +--FILE-- + +--EXPECTF-- +*** Testing ereg_replace() : error conditions *** + +-- Testing ereg_replace() function with more than expected no. of arguments -- + +Warning: Wrong parameter count for ereg_replace() in %s on line 17 +NULL + +-- Testing ereg_replace() function with less than expected no. of arguments -- + +Warning: Wrong parameter count for ereg_replace() in %s on line 23 +NULL +Done \ No newline at end of file diff --git a/ext/ereg/tests/ereg_replace_error_002.phpt b/ext/ereg/tests/ereg_replace_error_002.phpt new file mode 100644 index 0000000000..0fa4fd1d22 --- /dev/null +++ b/ext/ereg/tests/ereg_replace_error_002.phpt @@ -0,0 +1,76 @@ +--TEST-- +Test ereg_replace() function : error conditions - bad regular expressions +--FILE-- + +--EXPECTF-- +*** Testing ereg_replace() : bad REs *** + +Warning: ereg_replace(): REG_EMPTY in %s on line 9 +bool(false) + +Warning: ereg_replace(): REG_EPAREN in %s on line 10 +bool(false) + +Warning: ereg_replace(): REG_EBRACK in %s on line 11 +bool(false) + +Warning: ereg_replace(): REG_EPAREN in %s on line 12 +bool(false) + +Warning: ereg_replace(): REG_BADRPT in %s on line 13 +bool(false) + +Warning: ereg_replace(): REG_BADRPT in %s on line 14 +bool(false) + +Warning: ereg_replace(): REG_BADRPT in %s on line 15 +bool(false) + +Warning: ereg_replace(): REG_BADRPT in %s on line 16 +bool(false) + +Warning: ereg_replace(): REG_BADBR in %s on line 17 +bool(false) + +Warning: ereg_replace(): REG_EMPTY in %s on line 18 +bool(false) + +Warning: ereg_replace(): REG_EMPTY in %s on line 19 +bool(false) + +Warning: ereg_replace(): REG_BADBR in %s on line 20 +bool(false) + +Warning: ereg_replace(): REG_ERANGE in %s on line 21 +bool(false) + +Warning: ereg_replace(): REG_EESCAPE in %s on line 22 +bool(false) + +Warning: ereg_replace(): REG_ERANGE in %s on line 23 +bool(false) +Done \ No newline at end of file diff --git a/ext/ereg/tests/ereg_replace_variation_001.phpt b/ext/ereg/tests/ereg_replace_variation_001.phpt new file mode 100644 index 0000000000..d8a44364f0 --- /dev/null +++ b/ext/ereg/tests/ereg_replace_variation_001.phpt @@ -0,0 +1,180 @@ +--TEST-- +Test ereg_replace() function : usage variations - unexpected type arg 1 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for pattern + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( ereg_replace($value, $replacement, $string) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing ereg_replace() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +Error: 2 - ereg_replace(): REG_EMPTY, %s(74) +bool(false) + +Arg value 1 +string(8) "original" + +Arg value 12345 +string(8) "original" + +Arg value -2345 +string(8) "original" + +Arg value 10.5 +string(8) "original" + +Arg value -10.5 +string(8) "original" + +Arg value 101234567000 +string(8) "original" + +Arg value 1.07654321E-9 +Error: 2 - ereg_replace(): REG_EMPTY, %s(74) +bool(false) + +Arg value 0.5 +Error: 2 - ereg_replace(): REG_EMPTY, %s(74) +bool(false) +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - ereg_replace(): REG_EMPTY, %s(74) +bool(false) +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +string(8) "original" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +string(8) "original" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +string(8) "original" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +string(8) "original" + +Arg value +Error: 2 - ereg_replace(): REG_EMPTY, %s(74) +bool(false) + +Arg value +Error: 2 - ereg_replace(): REG_EMPTY, %s(74) +bool(false) + +Arg value 1 +string(8) "original" + +Arg value +Error: 2 - ereg_replace(): REG_EMPTY, %s(74) +bool(false) + +Arg value 1 +string(8) "original" + +Arg value +Error: 2 - ereg_replace(): REG_EMPTY, %s(74) +bool(false) + +Arg value +Error: 2 - ereg_replace(): REG_EMPTY, %s(74) +bool(false) + +Arg value +Error: 2 - ereg_replace(): REG_EMPTY, %s(74) +bool(false) +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 8 - Object of class stdClass could not be converted to int, %s(74) +string(8) "original" + +Arg value +Error: 2 - ereg_replace(): REG_EMPTY, %s(74) +bool(false) + +Arg value +Error: 2 - ereg_replace(): REG_EMPTY, %s(74) +bool(false) +Done \ No newline at end of file diff --git a/ext/ereg/tests/ereg_replace_variation_002.phpt b/ext/ereg/tests/ereg_replace_variation_002.phpt new file mode 100644 index 0000000000..c18493e299 --- /dev/null +++ b/ext/ereg/tests/ereg_replace_variation_002.phpt @@ -0,0 +1,168 @@ +--TEST-- +Test ereg_replace() function : usage variations - unexpected type arg 2 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for replacement + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump(urlencode(ereg_replace($pattern, $value, $string))); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing ereg_replace() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +string(5) "ho%21" + +Arg value 1 +string(8) "h%01o%21" + +Arg value 12345 +string(6) "h9o%21" + +Arg value -2345 +string(8) "h%D7o%21" + +Arg value 10.5 +string(8) "h%0Ao%21" + +Arg value -10.5 +string(8) "h%F6o%21" + +Arg value 101234567000 +string(8) "h%FFo%21" + +Arg value 1.07654321E-9 +string(5) "ho%21" + +Arg value 0.5 +string(5) "ho%21" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +string(5) "ho%21" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +string(8) "h%01o%21" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +string(8) "h%01o%21" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +string(8) "h%01o%21" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +string(8) "h%01o%21" + +Arg value +string(5) "ho%21" + +Arg value +string(5) "ho%21" + +Arg value 1 +string(8) "h%01o%21" + +Arg value +string(5) "ho%21" + +Arg value 1 +string(8) "h%01o%21" + +Arg value +string(5) "ho%21" + +Arg value +string(5) "ho%21" + +Arg value +string(5) "ho%21" +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 8 - Object of class stdClass could not be converted to int, %s(74) +string(8) "h%01o%21" + +Arg value +string(5) "ho%21" + +Arg value +string(5) "ho%21" +Done \ No newline at end of file diff --git a/ext/ereg/tests/ereg_replace_variation_003.phpt b/ext/ereg/tests/ereg_replace_variation_003.phpt new file mode 100644 index 0000000000..b15e3d0cd1 --- /dev/null +++ b/ext/ereg/tests/ereg_replace_variation_003.phpt @@ -0,0 +1,267 @@ +--TEST-- +Test ereg_replace() function : usage variations - unexpected type arg 3 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for string + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( ereg_replace($pattern, $replacement, $value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing ereg_replace() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +string(1) "0" + +Arg value 1 +string(9) "new value" + +Arg value 12345 +string(13) "new value2345" + +Arg value -2345 +string(5) "-2345" + +Arg value 10.5 +string(12) "new value0.5" + +Arg value -10.5 +string(13) "-new value0.5" + +Arg value 101234567000 +string(28) "new value0new value234567000" + +Arg value 1.07654321E-9 +string(29) "new value.0765432new valueE-9" + +Arg value 0.5 +string(3) "0.5" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +string(5) "Array" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +string(5) "Array" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +string(5) "Array" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +string(5) "Array" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +string(5) "Array" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(9) "new value" + +Arg value +string(0) "" + +Arg value 1 +string(9) "new value" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value +string(0) "" +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 4096 - Object of class stdClass could not be converted to string, %s(74) +Error: 8 - Object of class stdClass to string conversion, %s(74) +string(6) "Object" + +Arg value +string(0) "" + +Arg value +string(0) "" +Done +--UEXPECTF-- +*** Testing ereg_replace() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +string(1) "0" + +Arg value 1 +string(9) "new value" + +Arg value 12345 +string(13) "new value2345" + +Arg value -2345 +string(5) "-2345" + +Arg value 10.5 +string(12) "new value0.5" + +Arg value -10.5 +string(13) "-new value0.5" + +Arg value 101234567000 +string(28) "new value0new value234567000" + +Arg value 1.07654321E-9 +string(29) "new value.0765432new valueE-9" + +Arg value 0.5 +string(3) "0.5" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +string(5) "Array" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +string(5) "Array" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +string(5) "Array" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +string(5) "Array" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +string(5) "Array" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(9) "new value" + +Arg value +string(0) "" + +Arg value 1 +string(9) "new value" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value +string(0) "" +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 4096 - Object of class stdClass could not be converted to binary string, %s(74) +Error: 8 - Object of class stdClass to string conversion, %s(74) +string(6) "Object" + +Arg value +string(0) "" + +Arg value +string(0) "" +Done \ No newline at end of file diff --git a/ext/ereg/tests/ereg_variation_001.phpt b/ext/ereg/tests/ereg_variation_001.phpt new file mode 100644 index 0000000000..ee8bbb706b --- /dev/null +++ b/ext/ereg/tests/ereg_variation_001.phpt @@ -0,0 +1,284 @@ +--TEST-- +Test ereg() function : usage variations - unexpected type arg 1 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for pattern + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( ereg($value, $string, $registers) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing ereg() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(65) +Error: 8 - Undefined variable: unset_var, %s(68) + +Arg value 0 +bool(false) + +Arg value 1 +int(1) + +Arg value 12345 +bool(false) + +Arg value -2345 +bool(false) + +Arg value 10.5 +bool(false) + +Arg value -10.5 +bool(false) + +Arg value 101234567000 +bool(false) + +Arg value 1.07654321E-9 +bool(false) + +Arg value 0.5 +bool(false) +Error: 8 - Array to string conversion, %s(74) + +Arg value Array +Error: 8 - Array to string conversion, %s(75) +bool(false) +Error: 8 - Array to string conversion, %s(74) + +Arg value Array +Error: 8 - Array to string conversion, %s(75) +bool(false) +Error: 8 - Array to string conversion, %s(74) + +Arg value Array +Error: 8 - Array to string conversion, %s(75) +bool(false) +Error: 8 - Array to string conversion, %s(74) + +Arg value Array +Error: 8 - Array to string conversion, %s(75) +bool(false) +Error: 8 - Array to string conversion, %s(74) + +Arg value Array +Error: 8 - Array to string conversion, %s(75) +bool(false) + +Arg value +Error: 2 - ereg(): REG_EMPTY, %s(75) +bool(false) + +Arg value +Error: 2 - ereg(): REG_EMPTY, %s(75) +bool(false) + +Arg value 1 +int(1) + +Arg value +Error: 2 - ereg(): REG_EMPTY, %s(75) +bool(false) + +Arg value 1 +int(1) + +Arg value +Error: 2 - ereg(): REG_EMPTY, %s(75) +bool(false) + +Arg value +Error: 2 - ereg(): REG_EMPTY, %s(75) +bool(false) + +Arg value +Error: 2 - ereg(): REG_EMPTY, %s(75) +bool(false) +Error: 4096 - Object of class stdClass could not be converted to string, %s(74) + +Arg value +Error: 4096 - Object of class stdClass could not be converted to string, %s(75) +Error: 8 - Object of class stdClass to string conversion, %s(75) +bool(false) + +Arg value +Error: 2 - ereg(): REG_EMPTY, %s(75) +bool(false) + +Arg value +Error: 2 - ereg(): REG_EMPTY, %s(75) +bool(false) +Done +--UEXPECTF-- +*** Testing ereg() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(65) +Error: 8 - Undefined variable: unset_var, %s(68) + +Arg value 0 +bool(false) + +Arg value 1 +int(1) + +Arg value 12345 +bool(false) + +Arg value -2345 +bool(false) + +Arg value 10.5 +bool(false) + +Arg value -10.5 +bool(false) + +Arg value 101234567000 +bool(false) + +Arg value 1.07654321E-9 +bool(false) + +Arg value 0.5 +bool(false) +Error: 8 - Array to string conversion, %s(74) + +Arg value Array +Error: 8 - Array to string conversion, %s(75) +bool(false) +Error: 8 - Array to string conversion, %s(74) + +Arg value Array +Error: 8 - Array to string conversion, %s(75) +bool(false) +Error: 8 - Array to string conversion, %s(74) + +Arg value Array +Error: 8 - Array to string conversion, %s(75) +bool(false) +Error: 8 - Array to string conversion, %s(74) + +Arg value Array +Error: 8 - Array to string conversion, %s(75) +bool(false) +Error: 8 - Array to string conversion, %s(74) + +Arg value Array +Error: 8 - Array to string conversion, %s(75) +bool(false) + +Arg value +Error: 2 - ereg(): REG_EMPTY, %s(75) +bool(false) + +Arg value +Error: 2 - ereg(): REG_EMPTY, %s(75) +bool(false) + +Arg value 1 +int(1) + +Arg value +Error: 2 - ereg(): REG_EMPTY, %s(75) +bool(false) + +Arg value 1 +int(1) + +Arg value +Error: 2 - ereg(): REG_EMPTY, %s(75) +bool(false) + +Arg value +Error: 2 - ereg(): REG_EMPTY, %s(75) +bool(false) + +Arg value +Error: 2 - ereg(): REG_EMPTY, %s(75) +bool(false) +Error: 4096 - Object of class stdClass could not be converted to string, %s(74) + +Arg value +Error: 4096 - Object of class stdClass could not be converted to binary string, %s(75) +Error: 8 - Object of class stdClass to string conversion, %s(75) +bool(false) + +Arg value +Error: 2 - ereg(): REG_EMPTY, %s(75) +bool(false) + +Arg value +Error: 2 - ereg(): REG_EMPTY, %s(75) +bool(false) +Done \ No newline at end of file diff --git a/ext/ereg/tests/ereg_variation_002.phpt b/ext/ereg/tests/ereg_variation_002.phpt new file mode 100644 index 0000000000..737df62ef0 --- /dev/null +++ b/ext/ereg/tests/ereg_variation_002.phpt @@ -0,0 +1,267 @@ +--TEST-- +Test ereg() function : usage variations - unexpected type arg 2 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for string + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( ereg($pattern, $value, $registers) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing ereg() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +bool(false) + +Arg value 1 +int(1) + +Arg value 12345 +int(1) + +Arg value -2345 +bool(false) + +Arg value 10.5 +int(1) + +Arg value -10.5 +int(1) + +Arg value 101234567000 +int(1) + +Arg value 1.07654321E-9 +int(1) + +Arg value 0.5 +bool(false) +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +bool(false) +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +bool(false) +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +bool(false) +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +bool(false) +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value 1 +int(1) + +Arg value +bool(false) + +Arg value 1 +int(1) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 4096 - Object of class stdClass could not be converted to string, %s(74) +Error: 8 - Object of class stdClass to string conversion, %s(74) +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) +Done +--UEXPECTF-- +*** Testing ereg() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +bool(false) + +Arg value 1 +int(1) + +Arg value 12345 +int(1) + +Arg value -2345 +bool(false) + +Arg value 10.5 +int(1) + +Arg value -10.5 +int(1) + +Arg value 101234567000 +int(1) + +Arg value 1.07654321E-9 +int(1) + +Arg value 0.5 +bool(false) +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +bool(false) +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +bool(false) +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +bool(false) +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +bool(false) +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value 1 +int(1) + +Arg value +bool(false) + +Arg value 1 +int(1) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 4096 - Object of class stdClass could not be converted to binary string, %s(74) +Error: 8 - Object of class stdClass to string conversion, %s(74) +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) +Done \ No newline at end of file diff --git a/ext/ereg/tests/ereg_variation_003.phpt b/ext/ereg/tests/ereg_variation_003.phpt new file mode 100644 index 0000000000..cbce7b7220 --- /dev/null +++ b/ext/ereg/tests/ereg_variation_003.phpt @@ -0,0 +1,283 @@ +--TEST-- +Test ereg() function : usage variations - unexpected type for arg 3 +--FILE-- + +--EXPECTF-- +*** Testing ereg() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(61) +Error: 8 - Undefined variable: unset_var, %s(64) + +Arg value 0 +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value 1 +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value 12345 +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value -2345 +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value 10.5 +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value -10.5 +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value 101234567000 +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value 1.07654321E-9 +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value 0.5 +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value 1 +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value 1 +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value string +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value string +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} +Error: 4096 - Object of class stdClass could not be converted to string, %s(70) + +Arg value +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} +Done \ No newline at end of file diff --git a/ext/ereg/tests/ereg_variation_004.phpt b/ext/ereg/tests/ereg_variation_004.phpt new file mode 100644 index 0000000000..120772f933 --- /dev/null +++ b/ext/ereg/tests/ereg_variation_004.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test ereg() function : usage variations - pass non-variable as arg 3, which is pass-by-ref. +--FILE-- + +--EXPECTF-- + +Strict Standards: Only variables should be passed by reference in %s on line 8 +int(2) +Done \ No newline at end of file diff --git a/ext/ereg/tests/eregi_basic.phpt b/ext/ereg/tests/eregi_basic.phpt new file mode 100644 index 0000000000..fff3e087a1 --- /dev/null +++ b/ext/ereg/tests/eregi_basic.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test eregi() function : basic functionality - confirm case insensitivity +--FILE-- + +--EXPECTF-- +*** Testing eregi() : basic functionality *** +int(5) +array(1) { + [0]=> + string(5) "WORDS" +} +int(10) +array(1) { + [0]=> + string(10) "MIxED CaSe" +} +Done \ No newline at end of file diff --git a/ext/ereg/tests/eregi_basic_001.phpt b/ext/ereg/tests/eregi_basic_001.phpt new file mode 100644 index 0000000000..8557b8111d --- /dev/null +++ b/ext/ereg/tests/eregi_basic_001.phpt @@ -0,0 +1,127 @@ +--TEST-- +Test eregi() function : basic functionality (with $regs) +--FILE-- + Pattern: '$pattern'; string: '$string'\n"; + var_dump(eregi($pattern, $string, $regs)); + var_dump($regs); +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing eregi() : basic functionality *** +--> Pattern: '..(a|b|c)(a|b|c)..'; string: '--- ab ---' +int(6) +array(3) { + [0]=> + string(6) "- ab -" + [1]=> + string(1) "a" + [2]=> + string(1) "b" +} +--> Pattern: '()'; string: '' +int(1) +array(2) { + [0]=> + bool(false) + [1]=> + bool(false) +} +--> Pattern: '()'; string: 'abcdef' +int(1) +array(2) { + [0]=> + bool(false) + [1]=> + bool(false) +} +--> Pattern: '[x]|[^x]'; string: 'abcdef' +int(1) +array(1) { + [0]=> + string(1) "a" +} +--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; string: '--- aaa bbb ccc ddd ---' +int(15) +array(6) { + [0]=> + string(15) "aaa bbb ccc ddd" + [1]=> + string(1) "a" + [2]=> + string(2) "aa" + [3]=> + string(3) "bbb" + [4]=> + string(3) "ccc" + [5]=> + string(3) "ddd" +} +--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; string: '\`^.[$()|*+?{'' +int(14) +array(1) { + [0]=> + string(14) "\`^.[$()|*+?{'" +} +--> Pattern: '\a'; string: 'a' +int(1) +array(1) { + [0]=> + string(1) "a" +} +--> Pattern: '[0-9][^0-9]'; string: '2a' +int(2) +array(1) { + [0]=> + string(2) "2a" +} +--> Pattern: '^[[:alnum:]]{62,62}$'; string: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' +int(62) +array(1) { + [0]=> + string(62) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" +} +--> Pattern: '^[[:digit:]]{5}'; string: '0123456789' +int(5) +array(1) { + [0]=> + string(5) "01234" +} +--> Pattern: '[[:digit:]]{5}$'; string: '0123456789' +int(5) +array(1) { + [0]=> + string(5) "56789" +} +--> Pattern: '[[:blank:]]{1,10}'; string: ' + ' +int(2) +array(1) { + [0]=> + string(2) " " +} +--> Pattern: '[[:print:]]{3}'; string: ' a ' +int(3) +array(1) { + [0]=> + string(3) " a " +} +Done \ No newline at end of file diff --git a/ext/ereg/tests/eregi_basic_002.phpt b/ext/ereg/tests/eregi_basic_002.phpt new file mode 100644 index 0000000000..8c5d0e471e --- /dev/null +++ b/ext/ereg/tests/eregi_basic_002.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test eregi() function : basic functionality (without $regs) +--FILE-- + Pattern: '$pattern'; string: '$string'\n"; + var_dump(eregi($pattern, $string)); +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing eregi() : basic functionality *** +--> Pattern: '..(a|b|c)(a|b|c)..'; string: '--- ab ---' +int(1) +--> Pattern: '()'; string: '' +int(1) +--> Pattern: '()'; string: 'abcdef' +int(1) +--> Pattern: '[x]|[^x]'; string: 'abcdef' +int(1) +--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; string: '--- aaa bbb ccc ddd ---' +int(1) +--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; string: '\`^.[$()|*+?{'' +int(1) +--> Pattern: '\a'; string: 'a' +int(1) +--> Pattern: '[0-9][^0-9]'; string: '2a' +int(1) +--> Pattern: '^[[:alnum:]]{62,62}$'; string: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' +int(1) +--> Pattern: '^[[:digit:]]{5}'; string: '0123456789' +int(1) +--> Pattern: '[[:digit:]]{5}$'; string: '0123456789' +int(1) +--> Pattern: '[[:blank:]]{1,10}'; string: ' + ' +int(1) +--> Pattern: '[[:print:]]{3}'; string: ' a ' +int(1) +Done \ No newline at end of file diff --git a/ext/ereg/tests/eregi_basic_003.phpt b/ext/ereg/tests/eregi_basic_003.phpt new file mode 100644 index 0000000000..f73d87f65e --- /dev/null +++ b/ext/ereg/tests/eregi_basic_003.phpt @@ -0,0 +1,25 @@ +--TEST-- +Test eregi() function : basic functionality - long RE +--FILE-- + +--EXPECTF-- +int(1) +int(2048) +int(2049) +Done \ No newline at end of file diff --git a/ext/ereg/tests/eregi_basic_004.phpt b/ext/ereg/tests/eregi_basic_004.phpt new file mode 100644 index 0000000000..d0fce9cf2d --- /dev/null +++ b/ext/ereg/tests/eregi_basic_004.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test eregi() function : basic functionality - a few non-matches +--FILE-- + +--EXPECTF-- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +string(8) "original" +Done \ No newline at end of file diff --git a/ext/ereg/tests/eregi_error_001.phpt b/ext/ereg/tests/eregi_error_001.phpt new file mode 100644 index 0000000000..a767e24b59 --- /dev/null +++ b/ext/ereg/tests/eregi_error_001.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test eregi() function : error conditions - wrong number of args +--FILE-- + +--EXPECTF-- +*** Testing eregi() : error conditions *** + +-- Testing eregi() function with more than expected no. of arguments -- + +Warning: Wrong parameter count for eregi() in %s on line 21 +NULL + +-- Testing eregi() function with less than expected no. of arguments -- + +Warning: Wrong parameter count for eregi() in %s on line 26 +NULL +Done diff --git a/ext/ereg/tests/eregi_error_002.phpt b/ext/ereg/tests/eregi_error_002.phpt new file mode 100644 index 0000000000..9854acd6a0 --- /dev/null +++ b/ext/ereg/tests/eregi_error_002.phpt @@ -0,0 +1,88 @@ +--TEST-- +Test eregi() function : error conditions - test bad regular expressions +--FILE-- + +--EXPECTF-- +*** Testing eregi() : error conditions *** + +Warning: eregi(): REG_EMPTY in %s on line 16 +bool(false) + +Warning: eregi(): REG_EPAREN in %s on line 17 +bool(false) + +Warning: eregi(): REG_EBRACK in %s on line 18 +bool(false) + +Warning: eregi(): REG_EPAREN in %s on line 19 +bool(false) + +Warning: eregi(): REG_BADRPT in %s on line 20 +bool(false) + +Warning: eregi(): REG_BADRPT in %s on line 21 +bool(false) + +Warning: eregi(): REG_BADRPT in %s on line 22 +bool(false) + +Warning: eregi(): REG_BADRPT in %s on line 23 +bool(false) + +Warning: eregi(): REG_BADBR in %s on line 24 +bool(false) + +Warning: eregi(): REG_EMPTY in %s on line 25 +bool(false) + +Warning: eregi(): REG_EMPTY in %s on line 26 +bool(false) + +Warning: eregi(): REG_BADBR in %s on line 27 +bool(false) + +Warning: eregi(): REG_ERANGE in %s on line 28 +bool(false) + +Warning: eregi(): REG_EESCAPE in %s on line 29 +bool(false) + +Warning: eregi(): REG_ERANGE in %s on line 30 +bool(false) +string(8) "original" +Done \ No newline at end of file diff --git a/ext/ereg/tests/eregi_replace_basic.phpt b/ext/ereg/tests/eregi_replace_basic.phpt new file mode 100644 index 0000000000..211831f951 --- /dev/null +++ b/ext/ereg/tests/eregi_replace_basic.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test eregi_replace() function : basic functionality - confirm case insensitivity +--FILE-- + + + +--EXPECTF-- +*** Testing eregi_replace() : basic functionality *** +String Before... +string(50) "UPPERCASE WORDS, lowercase words, MIxED CaSe woRdS" + +String after... +string(65) "UPPERCASE_characterS, lowercase_characters, MIxED CaSe_characterS" +Done \ No newline at end of file diff --git a/ext/ereg/tests/eregi_replace_basic_001.phpt b/ext/ereg/tests/eregi_replace_basic_001.phpt new file mode 100644 index 0000000000..291a3f1e39 --- /dev/null +++ b/ext/ereg/tests/eregi_replace_basic_001.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test ereg() function : basic functionality +--FILE-- + Pattern: '$pattern'; match: '$match'\n"; + var_dump(eregi_replace($pattern, $replacement, $match . ' this contains some matches ' . $match)); +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing ereg() : basic functionality *** +--> Pattern: '..(a|b|c)(a|b|c)..'; match: '--- ab ---' +string(82) "--[this is a replacement]-- this contains some matches --[this is a replacement]--" +--> Pattern: '()'; match: '' +string(695) "[this is a replacement] [this is a replacement]t[this is a replacement]h[this is a replacement]i[this is a replacement]s[this is a replacement] [this is a replacement]c[this is a replacement]o[this is a replacement]n[this is a replacement]t[this is a replacement]a[this is a replacement]i[this is a replacement]n[this is a replacement]s[this is a replacement] [this is a replacement]s[this is a replacement]o[this is a replacement]m[this is a replacement]e[this is a replacement] [this is a replacement]m[this is a replacement]a[this is a replacement]t[this is a replacement]c[this is a replacement]h[this is a replacement]e[this is a replacement]s[this is a replacement] [this is a replacement]" +--> Pattern: '()'; match: 'abcdef' +string(983) "[this is a replacement]a[this is a replacement]b[this is a replacement]c[this is a replacement]d[this is a replacement]e[this is a replacement]f[this is a replacement] [this is a replacement]t[this is a replacement]h[this is a replacement]i[this is a replacement]s[this is a replacement] [this is a replacement]c[this is a replacement]o[this is a replacement]n[this is a replacement]t[this is a replacement]a[this is a replacement]i[this is a replacement]n[this is a replacement]s[this is a replacement] [this is a replacement]s[this is a replacement]o[this is a replacement]m[this is a replacement]e[this is a replacement] [this is a replacement]m[this is a replacement]a[this is a replacement]t[this is a replacement]c[this is a replacement]h[this is a replacement]e[this is a replacement]s[this is a replacement] [this is a replacement]a[this is a replacement]b[this is a replacement]c[this is a replacement]d[this is a replacement]e[this is a replacement]f[this is a replacement]" +--> Pattern: '[x]|[^x]'; match: 'abcdef' +string(920) "[this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement]" +--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; match: '--- aaa bbb ccc ddd ---' +string(90) "--- [this is a replacement] --- this contains some matches --- [this is a replacement] ---" +--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; match: '\`^.[$()|*+?{'' +string(74) "[this is a replacement] this contains some matches [this is a replacement]" +--> Pattern: '\a'; match: 'a' +string(118) "[this is a replacement] this cont[this is a replacement]ins some m[this is a replacement]tches [this is a replacement]" +--> Pattern: '[0-9][^0-9]'; match: '2a' +string(74) "[this is a replacement] this contains some matches [this is a replacement]" +--> Pattern: '^[[:alnum:]]{62,62}$'; match: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' +string(152) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ this contains some matches 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" +--> Pattern: '^[[:digit:]]{5}'; match: '0123456789' +string(66) "[this is a replacement]56789 this contains some matches 0123456789" +--> Pattern: '[[:digit:]]{5}$'; match: '0123456789' +string(66) "0123456789 this contains some matches 01234[this is a replacement]" +--> Pattern: '[[:blank:]]{1,10}'; match: ' + ' +string(163) " +[this is a replacement]this[this is a replacement]contains[this is a replacement]some[this is a replacement]matches[this is a replacement] +[this is a replacement]" +--> Pattern: '[[:print:]]{3}'; match: ' a ' +string(254) "[this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement][this is a replacement] " +Done \ No newline at end of file diff --git a/ext/ereg/tests/eregi_replace_basic_002.phpt b/ext/ereg/tests/eregi_replace_basic_002.phpt new file mode 100644 index 0000000000..0802a9d7b6 --- /dev/null +++ b/ext/ereg/tests/eregi_replace_basic_002.phpt @@ -0,0 +1,28 @@ +--TEST-- +Test eregi_replace() function : basic functionality - a few non-matches +--FILE-- + +--EXPECTF-- +string(1) "0" +string(3) "aaa" +string(2) "ba" +string(2) "ba" +string(1) "x" +Done \ No newline at end of file diff --git a/ext/ereg/tests/eregi_replace_error_001.phpt b/ext/ereg/tests/eregi_replace_error_001.phpt new file mode 100644 index 0000000000..8b7f90d9ad --- /dev/null +++ b/ext/ereg/tests/eregi_replace_error_001.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test eregi_replace() function : error conditions - wrong number of args +--FILE-- + +--EXPECTF-- +*** Testing eregi_replace() : error conditions *** + +-- Testing eregi_replace() function with more than expected no. of arguments -- + +Warning: Wrong parameter count for eregi_replace() in %s on line 17 +NULL + +-- Testing eregi_replace() function with less than expected no. of arguments -- + +Warning: Wrong parameter count for eregi_replace() in %s on line 23 +NULL +Done \ No newline at end of file diff --git a/ext/ereg/tests/eregi_replace_error_002.phpt b/ext/ereg/tests/eregi_replace_error_002.phpt new file mode 100644 index 0000000000..d03232b1b9 --- /dev/null +++ b/ext/ereg/tests/eregi_replace_error_002.phpt @@ -0,0 +1,76 @@ +--TEST-- +Test eregi_replace() function : error conditions - bad regular expressions +--FILE-- + +--EXPECTF-- +*** Testing eregi_replace() : bad REs *** + +Warning: eregi_replace(): REG_EMPTY in %s on line 9 +bool(false) + +Warning: eregi_replace(): REG_EPAREN in %s on line 10 +bool(false) + +Warning: eregi_replace(): REG_EBRACK in %s on line 11 +bool(false) + +Warning: eregi_replace(): REG_EPAREN in %s on line 12 +bool(false) + +Warning: eregi_replace(): REG_BADRPT in %s on line 13 +bool(false) + +Warning: eregi_replace(): REG_BADRPT in %s on line 14 +bool(false) + +Warning: eregi_replace(): REG_BADRPT in %s on line 15 +bool(false) + +Warning: eregi_replace(): REG_BADRPT in %s on line 16 +bool(false) + +Warning: eregi_replace(): REG_BADBR in %s on line 17 +bool(false) + +Warning: eregi_replace(): REG_EMPTY in %s on line 18 +bool(false) + +Warning: eregi_replace(): REG_EMPTY in %s on line 19 +bool(false) + +Warning: eregi_replace(): REG_BADBR in %s on line 20 +bool(false) + +Warning: eregi_replace(): REG_ERANGE in %s on line 21 +bool(false) + +Warning: eregi_replace(): REG_EESCAPE in %s on line 22 +bool(false) + +Warning: eregi_replace(): REG_ERANGE in %s on line 23 +bool(false) +Done \ No newline at end of file diff --git a/ext/ereg/tests/eregi_replace_variation_001.phpt b/ext/ereg/tests/eregi_replace_variation_001.phpt new file mode 100644 index 0000000000..e55cc4e23c --- /dev/null +++ b/ext/ereg/tests/eregi_replace_variation_001.phpt @@ -0,0 +1,180 @@ +--TEST-- +Test eregi_replace() function : usage variations - unexpected type arg 1 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for pattern + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( eregi_replace($value, $replacement, $string) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing eregi_replace() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +Error: 2 - eregi_replace(): REG_EMPTY, %s(74) +bool(false) + +Arg value 1 +string(8) "original" + +Arg value 12345 +string(8) "original" + +Arg value -2345 +string(8) "original" + +Arg value 10.5 +string(8) "original" + +Arg value -10.5 +string(8) "original" + +Arg value 101234567000 +string(8) "original" + +Arg value 1.07654321E-9 +Error: 2 - eregi_replace(): REG_EMPTY, %s(74) +bool(false) + +Arg value 0.5 +Error: 2 - eregi_replace(): REG_EMPTY, %s(74) +bool(false) +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - eregi_replace(): REG_EMPTY, %s(74) +bool(false) +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +string(8) "original" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +string(8) "original" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +string(8) "original" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +string(8) "original" + +Arg value +Error: 2 - eregi_replace(): REG_EMPTY, %s(74) +bool(false) + +Arg value +Error: 2 - eregi_replace(): REG_EMPTY, %s(74) +bool(false) + +Arg value 1 +string(8) "original" + +Arg value +Error: 2 - eregi_replace(): REG_EMPTY, %s(74) +bool(false) + +Arg value 1 +string(8) "original" + +Arg value +Error: 2 - eregi_replace(): REG_EMPTY, %s(74) +bool(false) + +Arg value +Error: 2 - eregi_replace(): REG_EMPTY, %s(74) +bool(false) + +Arg value +Error: 2 - eregi_replace(): REG_EMPTY, %s(74) +bool(false) +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 8 - Object of class stdClass could not be converted to int, %s(74) +string(8) "original" + +Arg value +Error: 2 - eregi_replace(): REG_EMPTY, %s(74) +bool(false) + +Arg value +Error: 2 - eregi_replace(): REG_EMPTY, %s(74) +bool(false) +Done \ No newline at end of file diff --git a/ext/ereg/tests/eregi_replace_variation_002.phpt b/ext/ereg/tests/eregi_replace_variation_002.phpt new file mode 100644 index 0000000000..ef86545498 --- /dev/null +++ b/ext/ereg/tests/eregi_replace_variation_002.phpt @@ -0,0 +1,168 @@ +--TEST-- +Test eregi_replace() function : usage variations - unexpected type arg 2 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for replacement + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump(urlencode(eregi_replace($pattern, $value, $string))); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing eregi_replace() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +string(5) "ho%21" + +Arg value 1 +string(8) "h%01o%21" + +Arg value 12345 +string(6) "h9o%21" + +Arg value -2345 +string(8) "h%D7o%21" + +Arg value 10.5 +string(8) "h%0Ao%21" + +Arg value -10.5 +string(8) "h%F6o%21" + +Arg value 101234567000 +string(8) "h%FFo%21" + +Arg value 1.07654321E-9 +string(5) "ho%21" + +Arg value 0.5 +string(5) "ho%21" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +string(5) "ho%21" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +string(8) "h%01o%21" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +string(8) "h%01o%21" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +string(8) "h%01o%21" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +string(8) "h%01o%21" + +Arg value +string(5) "ho%21" + +Arg value +string(5) "ho%21" + +Arg value 1 +string(8) "h%01o%21" + +Arg value +string(5) "ho%21" + +Arg value 1 +string(8) "h%01o%21" + +Arg value +string(5) "ho%21" + +Arg value +string(5) "ho%21" + +Arg value +string(5) "ho%21" +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 8 - Object of class stdClass could not be converted to int, %s(74) +string(8) "h%01o%21" + +Arg value +string(5) "ho%21" + +Arg value +string(5) "ho%21" +Done \ No newline at end of file diff --git a/ext/ereg/tests/eregi_replace_variation_003.phpt b/ext/ereg/tests/eregi_replace_variation_003.phpt new file mode 100644 index 0000000000..8272804c96 --- /dev/null +++ b/ext/ereg/tests/eregi_replace_variation_003.phpt @@ -0,0 +1,267 @@ +--TEST-- +Test eregi_replace() function : usage variations - unexpected type arg 3 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for string + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( eregi_replace($pattern, $replacement, $value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing eregi_replace() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +string(1) "0" + +Arg value 1 +string(9) "new value" + +Arg value 12345 +string(13) "new value2345" + +Arg value -2345 +string(5) "-2345" + +Arg value 10.5 +string(12) "new value0.5" + +Arg value -10.5 +string(13) "-new value0.5" + +Arg value 101234567000 +string(28) "new value0new value234567000" + +Arg value 1.07654321E-9 +string(29) "new value.0765432new valueE-9" + +Arg value 0.5 +string(3) "0.5" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +string(5) "Array" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +string(5) "Array" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +string(5) "Array" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +string(5) "Array" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +string(5) "Array" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(9) "new value" + +Arg value +string(0) "" + +Arg value 1 +string(9) "new value" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value +string(0) "" +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 4096 - Object of class stdClass could not be converted to string, %s(74) +Error: 8 - Object of class stdClass to string conversion, %s(74) +string(6) "Object" + +Arg value +string(0) "" + +Arg value +string(0) "" +Done +--UEXPECTF-- +*** Testing eregi_replace() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +string(1) "0" + +Arg value 1 +string(9) "new value" + +Arg value 12345 +string(13) "new value2345" + +Arg value -2345 +string(5) "-2345" + +Arg value 10.5 +string(12) "new value0.5" + +Arg value -10.5 +string(13) "-new value0.5" + +Arg value 101234567000 +string(28) "new value0new value234567000" + +Arg value 1.07654321E-9 +string(29) "new value.0765432new valueE-9" + +Arg value 0.5 +string(3) "0.5" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +string(5) "Array" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +string(5) "Array" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +string(5) "Array" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +string(5) "Array" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +string(5) "Array" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(9) "new value" + +Arg value +string(0) "" + +Arg value 1 +string(9) "new value" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value +string(0) "" +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 4096 - Object of class stdClass could not be converted to binary string, %s(74) +Error: 8 - Object of class stdClass to string conversion, %s(74) +string(6) "Object" + +Arg value +string(0) "" + +Arg value +string(0) "" +Done \ No newline at end of file diff --git a/ext/ereg/tests/eregi_variation_001.phpt b/ext/ereg/tests/eregi_variation_001.phpt new file mode 100644 index 0000000000..e201667520 --- /dev/null +++ b/ext/ereg/tests/eregi_variation_001.phpt @@ -0,0 +1,284 @@ +--TEST-- +Test eregi() function : usage variations - unexpected type arg 1 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for pattern + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( eregi($value, $string, $registers) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing eregi() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(65) +Error: 8 - Undefined variable: unset_var, %s(68) + +Arg value 0 +bool(false) + +Arg value 1 +int(1) + +Arg value 12345 +bool(false) + +Arg value -2345 +bool(false) + +Arg value 10.5 +bool(false) + +Arg value -10.5 +bool(false) + +Arg value 101234567000 +bool(false) + +Arg value 1.07654321E-9 +bool(false) + +Arg value 0.5 +bool(false) +Error: 8 - Array to string conversion, %s(74) + +Arg value Array +Error: 8 - Array to string conversion, %s(75) +bool(false) +Error: 8 - Array to string conversion, %s(74) + +Arg value Array +Error: 8 - Array to string conversion, %s(75) +bool(false) +Error: 8 - Array to string conversion, %s(74) + +Arg value Array +Error: 8 - Array to string conversion, %s(75) +bool(false) +Error: 8 - Array to string conversion, %s(74) + +Arg value Array +Error: 8 - Array to string conversion, %s(75) +bool(false) +Error: 8 - Array to string conversion, %s(74) + +Arg value Array +Error: 8 - Array to string conversion, %s(75) +bool(false) + +Arg value +Error: 2 - eregi(): REG_EMPTY, %s(75) +bool(false) + +Arg value +Error: 2 - eregi(): REG_EMPTY, %s(75) +bool(false) + +Arg value 1 +int(1) + +Arg value +Error: 2 - eregi(): REG_EMPTY, %s(75) +bool(false) + +Arg value 1 +int(1) + +Arg value +Error: 2 - eregi(): REG_EMPTY, %s(75) +bool(false) + +Arg value +Error: 2 - eregi(): REG_EMPTY, %s(75) +bool(false) + +Arg value +Error: 2 - eregi(): REG_EMPTY, %s(75) +bool(false) +Error: 4096 - Object of class stdClass could not be converted to string, %s(74) + +Arg value +Error: 4096 - Object of class stdClass could not be converted to string, %s(75) +Error: 8 - Object of class stdClass to string conversion, %s(75) +bool(false) + +Arg value +Error: 2 - eregi(): REG_EMPTY, %s(75) +bool(false) + +Arg value +Error: 2 - eregi(): REG_EMPTY, %s(75) +bool(false) +Done +--UEXPECTF-- +*** Testing eregi() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(65) +Error: 8 - Undefined variable: unset_var, %s(68) + +Arg value 0 +bool(false) + +Arg value 1 +int(1) + +Arg value 12345 +bool(false) + +Arg value -2345 +bool(false) + +Arg value 10.5 +bool(false) + +Arg value -10.5 +bool(false) + +Arg value 101234567000 +bool(false) + +Arg value 1.07654321E-9 +bool(false) + +Arg value 0.5 +bool(false) +Error: 8 - Array to string conversion, %s(74) + +Arg value Array +Error: 8 - Array to string conversion, %s(75) +bool(false) +Error: 8 - Array to string conversion, %s(74) + +Arg value Array +Error: 8 - Array to string conversion, %s(75) +bool(false) +Error: 8 - Array to string conversion, %s(74) + +Arg value Array +Error: 8 - Array to string conversion, %s(75) +bool(false) +Error: 8 - Array to string conversion, %s(74) + +Arg value Array +Error: 8 - Array to string conversion, %s(75) +bool(false) +Error: 8 - Array to string conversion, %s(74) + +Arg value Array +Error: 8 - Array to string conversion, %s(75) +bool(false) + +Arg value +Error: 2 - eregi(): REG_EMPTY, %s(75) +bool(false) + +Arg value +Error: 2 - eregi(): REG_EMPTY, %s(75) +bool(false) + +Arg value 1 +int(1) + +Arg value +Error: 2 - eregi(): REG_EMPTY, %s(75) +bool(false) + +Arg value 1 +int(1) + +Arg value +Error: 2 - eregi(): REG_EMPTY, %s(75) +bool(false) + +Arg value +Error: 2 - eregi(): REG_EMPTY, %s(75) +bool(false) + +Arg value +Error: 2 - eregi(): REG_EMPTY, %s(75) +bool(false) +Error: 4096 - Object of class stdClass could not be converted to string, %s(74) + +Arg value +Error: 4096 - Object of class stdClass could not be converted to binary string, %s(75) +Error: 8 - Object of class stdClass to string conversion, %s(75) +bool(false) + +Arg value +Error: 2 - eregi(): REG_EMPTY, %s(75) +bool(false) + +Arg value +Error: 2 - eregi(): REG_EMPTY, %s(75) +bool(false) +Done diff --git a/ext/ereg/tests/eregi_variation_002.phpt b/ext/ereg/tests/eregi_variation_002.phpt new file mode 100644 index 0000000000..88f9c7dfed --- /dev/null +++ b/ext/ereg/tests/eregi_variation_002.phpt @@ -0,0 +1,267 @@ +--TEST-- +Test eregi() function : usage variations - unexpected type arg 2 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for string + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( eregi($pattern, $value, $registers) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing eregi() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +bool(false) + +Arg value 1 +int(1) + +Arg value 12345 +int(1) + +Arg value -2345 +bool(false) + +Arg value 10.5 +int(1) + +Arg value -10.5 +int(1) + +Arg value 101234567000 +int(1) + +Arg value 1.07654321E-9 +int(1) + +Arg value 0.5 +bool(false) +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +bool(false) +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +bool(false) +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +bool(false) +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +bool(false) +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value 1 +int(1) + +Arg value +bool(false) + +Arg value 1 +int(1) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 4096 - Object of class stdClass could not be converted to string, %s(74) +Error: 8 - Object of class stdClass to string conversion, %s(74) +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) +Done +--UEXPECTF-- +*** Testing eregi() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +bool(false) + +Arg value 1 +int(1) + +Arg value 12345 +int(1) + +Arg value -2345 +bool(false) + +Arg value 10.5 +int(1) + +Arg value -10.5 +int(1) + +Arg value 101234567000 +int(1) + +Arg value 1.07654321E-9 +int(1) + +Arg value 0.5 +bool(false) +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +bool(false) +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +bool(false) +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +bool(false) +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +bool(false) +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value 1 +int(1) + +Arg value +bool(false) + +Arg value 1 +int(1) + +Arg value +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 4096 - Object of class stdClass could not be converted to binary string, %s(74) +Error: 8 - Object of class stdClass to string conversion, %s(74) +bool(false) + +Arg value +bool(false) + +Arg value +bool(false) +Done diff --git a/ext/ereg/tests/eregi_variation_003.phpt b/ext/ereg/tests/eregi_variation_003.phpt new file mode 100644 index 0000000000..98fd97f6e3 --- /dev/null +++ b/ext/ereg/tests/eregi_variation_003.phpt @@ -0,0 +1,283 @@ +--TEST-- +Test eregi() function : usage variations - unexpected type for arg 3 +--FILE-- + +--EXPECTF-- +*** Testing eregi() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(61) +Error: 8 - Undefined variable: unset_var, %s(64) + +Arg value 0 +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value 1 +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value 12345 +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value -2345 +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value 10.5 +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value -10.5 +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value 101234567000 +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value 1.07654321E-9 +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value 0.5 +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value 1 +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value 1 +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value string +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value string +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} +Error: 4096 - Object of class stdClass could not be converted to string, %s(70) + +Arg value +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} + +Arg value +int(6) +array(2) { + [0]=> + string(6) "hello!" + [1]=> + string(2) "el" +} +Done \ No newline at end of file diff --git a/ext/ereg/tests/eregi_variation_004.phpt b/ext/ereg/tests/eregi_variation_004.phpt new file mode 100644 index 0000000000..307c3f6566 --- /dev/null +++ b/ext/ereg/tests/eregi_variation_004.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test eregi() function : usage variations - pass non-variable as arg 3, which is pass-by-ref. +--FILE-- + +--EXPECTF-- + +Strict Standards: Only variables should be passed by reference in %s on line 8 +int(2) +Done \ No newline at end of file diff --git a/ext/ereg/tests/regular_expressions.inc b/ext/ereg/tests/regular_expressions.inc new file mode 100644 index 0000000000..3cfc10095b --- /dev/null +++ b/ext/ereg/tests/regular_expressions.inc @@ -0,0 +1,24 @@ + \ No newline at end of file diff --git a/ext/ereg/tests/split_basic_001.phpt b/ext/ereg/tests/split_basic_001.phpt new file mode 100644 index 0000000000..4be40c0860 --- /dev/null +++ b/ext/ereg/tests/split_basic_001.phpt @@ -0,0 +1,129 @@ +--TEST-- +Test split() function : basic functionality - test a number of simple split, specifying a limit +--FILE-- + Pattern: '$pattern'; match: '$string'\n"; + var_dump(split($pattern, $string . ' |1| ' . $string . ' |2| ' . $string, 2)); +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing ereg() : basic functionality *** + +--> Pattern: '..(a|b|c)(a|b|c)..'; match: '--- ab ---' +array(2) { + [0]=> + string(2) "--" + [1]=> + string(32) "-- |1| --- ab --- |2| --- ab ---" +} + +--> Pattern: '()'; match: '' + +Warning: split(): Invalid Regular Expression to split() in %s on line 19 +bool(false) + +--> Pattern: '()'; match: 'abcdef' + +Warning: split(): Invalid Regular Expression to split() in %s on line 19 +bool(false) + +--> Pattern: '[x]|[^x]'; match: 'abcdef' +array(2) { + [0]=> + string(0) "" + [1]=> + string(27) "bcdef |1| abcdef |2| abcdef" +} + +--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; match: '--- aaa bbb ccc ddd ---' +array(2) { + [0]=> + string(4) "--- " + [1]=> + string(60) " --- |1| --- aaa bbb ccc ddd --- |2| --- aaa bbb ccc ddd ---" +} + +--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; match: '\`^.[$()|*+?{'' +array(2) { + [0]=> + string(0) "" + [1]=> + string(38) " |1| \`^.[$()|*+?{' |2| \`^.[$()|*+?{'" +} + +--> Pattern: '\a'; match: 'a' +array(2) { + [0]=> + string(0) "" + [1]=> + string(12) " |1| a |2| a" +} + +--> Pattern: '[0-9][^0-9]'; match: '2a' +array(2) { + [0]=> + string(0) "" + [1]=> + string(14) " |1| 2a |2| 2a" +} + +--> Pattern: '^[[:alnum:]]{62,62}$'; match: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' +array(1) { + [0]=> + string(196) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |1| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |2| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" +} + +--> Pattern: '^[[:digit:]]{5}'; match: '0123456789' +array(2) { + [0]=> + string(0) "" + [1]=> + string(35) "56789 |1| 0123456789 |2| 0123456789" +} + +--> Pattern: '[[:digit:]]{5}$'; match: '0123456789' +array(2) { + [0]=> + string(35) "0123456789 |1| 0123456789 |2| 01234" + [1]=> + string(0) "" +} + +--> Pattern: '[[:blank:]]{1,10}'; match: ' + ' +array(2) { + [0]=> + string(1) " +" + [1]=> + string(15) "|1| + |2| + " +} + +--> Pattern: '[[:print:]]{3}'; match: ' a ' +array(2) { + [0]=> + string(0) "" + [1]=> + string(16) " |1| a |2| a " +} +Done \ No newline at end of file diff --git a/ext/ereg/tests/split_basic_002.phpt b/ext/ereg/tests/split_basic_002.phpt new file mode 100644 index 0000000000..f0d17ef1d6 --- /dev/null +++ b/ext/ereg/tests/split_basic_002.phpt @@ -0,0 +1,227 @@ +--TEST-- +Test split() function : basic functionality - test a number of simple split, without specifying a limit +--FILE-- + Pattern: '$pattern'; match: '$string'\n"; + var_dump(split($pattern, $string . ' |1| ' . $string . ' |2| ' . $string)); +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing ereg() : basic functionality *** + +--> Pattern: '..(a|b|c)(a|b|c)..'; match: '--- ab ---' +array(4) { + [0]=> + string(2) "--" + [1]=> + string(9) "-- |1| --" + [2]=> + string(9) "-- |2| --" + [3]=> + string(2) "--" +} + +--> Pattern: '()'; match: '' + +Warning: split(): Invalid Regular Expression to split() in %s on line 19 +bool(false) + +--> Pattern: '()'; match: 'abcdef' + +Warning: split(): Invalid Regular Expression to split() in %s on line 19 +bool(false) + +--> Pattern: '[x]|[^x]'; match: 'abcdef' +array(29) { + [0]=> + string(0) "" + [1]=> + string(0) "" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(0) "" + [5]=> + string(0) "" + [6]=> + string(0) "" + [7]=> + string(0) "" + [8]=> + string(0) "" + [9]=> + string(0) "" + [10]=> + string(0) "" + [11]=> + string(0) "" + [12]=> + string(0) "" + [13]=> + string(0) "" + [14]=> + string(0) "" + [15]=> + string(0) "" + [16]=> + string(0) "" + [17]=> + string(0) "" + [18]=> + string(0) "" + [19]=> + string(0) "" + [20]=> + string(0) "" + [21]=> + string(0) "" + [22]=> + string(0) "" + [23]=> + string(0) "" + [24]=> + string(0) "" + [25]=> + string(0) "" + [26]=> + string(0) "" + [27]=> + string(0) "" + [28]=> + string(0) "" +} + +--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; match: '--- aaa bbb ccc ddd ---' +array(4) { + [0]=> + string(4) "--- " + [1]=> + string(13) " --- |1| --- " + [2]=> + string(13) " --- |2| --- " + [3]=> + string(4) " ---" +} + +--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; match: '\`^.[$()|*+?{'' +array(4) { + [0]=> + string(0) "" + [1]=> + string(5) " |1| " + [2]=> + string(5) " |2| " + [3]=> + string(0) "" +} + +--> Pattern: '\a'; match: 'a' +array(4) { + [0]=> + string(0) "" + [1]=> + string(5) " |1| " + [2]=> + string(5) " |2| " + [3]=> + string(0) "" +} + +--> Pattern: '[0-9][^0-9]'; match: '2a' +array(6) { + [0]=> + string(0) "" + [1]=> + string(2) " |" + [2]=> + string(1) " " + [3]=> + string(2) " |" + [4]=> + string(1) " " + [5]=> + string(0) "" +} + +--> Pattern: '^[[:alnum:]]{62,62}$'; match: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' +array(1) { + [0]=> + string(196) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |1| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |2| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" +} + +--> Pattern: '^[[:digit:]]{5}'; match: '0123456789' +array(3) { + [0]=> + string(0) "" + [1]=> + string(0) "" + [2]=> + string(30) " |1| 0123456789 |2| 0123456789" +} + +--> Pattern: '[[:digit:]]{5}$'; match: '0123456789' +array(2) { + [0]=> + string(35) "0123456789 |1| 0123456789 |2| 01234" + [1]=> + string(0) "" +} + +--> Pattern: '[[:blank:]]{1,10}'; match: ' + ' +array(6) { + [0]=> + string(1) " +" + [1]=> + string(3) "|1|" + [2]=> + string(1) " +" + [3]=> + string(3) "|2|" + [4]=> + string(1) " +" + [5]=> + string(0) "" +} + +--> Pattern: '[[:print:]]{3}'; match: ' a ' +array(7) { + [0]=> + string(0) "" + [1]=> + string(0) "" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(0) "" + [5]=> + string(0) "" + [6]=> + string(1) " " +} +Done \ No newline at end of file diff --git a/ext/ereg/tests/split_basic_003.phpt b/ext/ereg/tests/split_basic_003.phpt new file mode 100644 index 0000000000..4d36fcddb3 --- /dev/null +++ b/ext/ereg/tests/split_basic_003.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test split() function : basic functionality - a few non-matches +--FILE-- + +--EXPECTF-- +array(1) { + [0]=> + string(7) "-- a --" +} +array(1) { + [0]=> + string(7) "-- 0 --" +} +array(1) { + [0]=> + string(11) "--- aaa ---" +} +array(1) { + [0]=> + string(10) "--- ba ---" +} +array(1) { + [0]=> + string(10) "--- ba ---" +} +array(1) { + [0]=> + string(9) "--- x ---" +} +Done \ No newline at end of file diff --git a/ext/ereg/tests/split_error_001.phpt b/ext/ereg/tests/split_error_001.phpt new file mode 100644 index 0000000000..ff8e6cbdd1 --- /dev/null +++ b/ext/ereg/tests/split_error_001.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test split() function : error conditions - wrong number of args +--FILE-- + +--EXPECTF-- +*** Testing split() : error conditions - wrong number of args *** + +-- Testing split() function with more than expected no. of arguments -- + +Warning: Wrong parameter count for split() in %s on line 17 +NULL + +-- Testing split() function with less than expected no. of arguments -- + +Warning: Wrong parameter count for split() in %s on line 22 +NULL +Done \ No newline at end of file diff --git a/ext/ereg/tests/split_error_002.phpt b/ext/ereg/tests/split_error_002.phpt new file mode 100644 index 0000000000..fed988cc3c --- /dev/null +++ b/ext/ereg/tests/split_error_002.phpt @@ -0,0 +1,88 @@ +--TEST-- +Test split() function : error conditions - test bad regular expressions +--FILE-- + +--EXPECTF-- +*** Testing split() : error conditions *** + +Warning: split(): REG_EMPTY in %s on line 16 +bool(false) + +Warning: split(): REG_EPAREN in %s on line 17 +bool(false) + +Warning: split(): REG_EBRACK in %s on line 18 +bool(false) + +Warning: split(): REG_EPAREN in %s on line 19 +bool(false) + +Warning: split(): REG_BADRPT in %s on line 20 +bool(false) + +Warning: split(): REG_BADRPT in %s on line 21 +bool(false) + +Warning: split(): REG_BADRPT in %s on line 22 +bool(false) + +Warning: split(): REG_BADRPT in %s on line 23 +bool(false) + +Warning: split(): REG_BADBR in %s on line 24 +bool(false) + +Warning: split(): REG_EMPTY in %s on line 25 +bool(false) + +Warning: split(): REG_EMPTY in %s on line 26 +bool(false) + +Warning: split(): REG_BADBR in %s on line 27 +bool(false) + +Warning: split(): REG_ERANGE in %s on line 28 +bool(false) + +Warning: split(): REG_EESCAPE in %s on line 29 +bool(false) + +Warning: split(): REG_ERANGE in %s on line 30 +bool(false) +string(8) "original" +Done \ No newline at end of file diff --git a/ext/ereg/tests/split_variation_001.phpt b/ext/ereg/tests/split_variation_001.phpt new file mode 100644 index 0000000000..39c54fe680 --- /dev/null +++ b/ext/ereg/tests/split_variation_001.phpt @@ -0,0 +1,441 @@ +--TEST-- +Test split() function : usage variations - unexpected type for arg 1 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for pattern + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( split($value, $string, $limit) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing split() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value 1 +array(4) { + [0]=> + string(0) "" + [1]=> + string(3) " a " + [2]=> + string(7) " Array " + [3]=> + string(3) " c " +} + +Arg value 12345 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value -2345 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value 10.5 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value -10.5 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value 101234567000 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value 1.07654321E-9 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value 0.5 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(2) { + [0]=> + string(6) "1 a 1 " + [1]=> + string(5) " 1 c " +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(2) { + [0]=> + string(6) "1 a 1 " + [1]=> + string(5) " 1 c " +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(2) { + [0]=> + string(6) "1 a 1 " + [1]=> + string(5) " 1 c " +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(2) { + [0]=> + string(6) "1 a 1 " + [1]=> + string(5) " 1 c " +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(2) { + [0]=> + string(6) "1 a 1 " + [1]=> + string(5) " 1 c " +} + +Arg value +Error: 2 - split(): REG_EMPTY, %s(74) +bool(false) + +Arg value +Error: 2 - split(): REG_EMPTY, %s(74) +bool(false) + +Arg value 1 +array(4) { + [0]=> + string(0) "" + [1]=> + string(3) " a " + [2]=> + string(7) " Array " + [3]=> + string(3) " c " +} + +Arg value +Error: 2 - split(): REG_EMPTY, %s(74) +bool(false) + +Arg value 1 +array(4) { + [0]=> + string(0) "" + [1]=> + string(3) " a " + [2]=> + string(7) " Array " + [3]=> + string(3) " c " +} + +Arg value +Error: 2 - split(): REG_EMPTY, %s(74) +bool(false) + +Arg value +Error: 2 - split(): REG_EMPTY, %s(74) +bool(false) + +Arg value +Error: 2 - split(): REG_EMPTY, %s(74) +bool(false) +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 4096 - Object of class stdClass could not be converted to string, %s(74) +Error: 8 - Object of class stdClass to string conversion, %s(74) +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value +Error: 2 - split(): REG_EMPTY, %s(74) +bool(false) + +Arg value +Error: 2 - split(): REG_EMPTY, %s(74) +bool(false) +Done +--UEXPECTF-- +*** Testing split() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value 1 +array(4) { + [0]=> + string(0) "" + [1]=> + string(3) " a " + [2]=> + string(7) " Array " + [3]=> + string(3) " c " +} + +Arg value 12345 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value -2345 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value 10.5 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value -10.5 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value 101234567000 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value 1.07654321E-9 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value 0.5 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(2) { + [0]=> + string(6) "1 a 1 " + [1]=> + string(5) " 1 c " +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(2) { + [0]=> + string(6) "1 a 1 " + [1]=> + string(5) " 1 c " +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(2) { + [0]=> + string(6) "1 a 1 " + [1]=> + string(5) " 1 c " +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(2) { + [0]=> + string(6) "1 a 1 " + [1]=> + string(5) " 1 c " +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(2) { + [0]=> + string(6) "1 a 1 " + [1]=> + string(5) " 1 c " +} + +Arg value +Error: 2 - split(): REG_EMPTY, %s(74) +bool(false) + +Arg value +Error: 2 - split(): REG_EMPTY, %s(74) +bool(false) + +Arg value 1 +array(4) { + [0]=> + string(0) "" + [1]=> + string(3) " a " + [2]=> + string(7) " Array " + [3]=> + string(3) " c " +} + +Arg value +Error: 2 - split(): REG_EMPTY, %s(74) +bool(false) + +Arg value 1 +array(4) { + [0]=> + string(0) "" + [1]=> + string(3) " a " + [2]=> + string(7) " Array " + [3]=> + string(3) " c " +} + +Arg value +Error: 2 - split(): REG_EMPTY, %s(74) +bool(false) + +Arg value +Error: 2 - split(): REG_EMPTY, %s(74) +bool(false) + +Arg value +Error: 2 - split(): REG_EMPTY, %s(74) +bool(false) +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 4096 - Object of class stdClass could not be converted to binary string, %s(74) +Error: 8 - Object of class stdClass to string conversion, %s(74) +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value +Error: 2 - split(): REG_EMPTY, %s(74) +bool(false) + +Arg value +Error: 2 - split(): REG_EMPTY, %s(74) +bool(false) +Done \ No newline at end of file diff --git a/ext/ereg/tests/split_variation_002.phpt b/ext/ereg/tests/split_variation_002.phpt new file mode 100644 index 0000000000..7a4e8e71de --- /dev/null +++ b/ext/ereg/tests/split_variation_002.phpt @@ -0,0 +1,465 @@ +--TEST-- +Test split() function : usage variations - unexpected type for arg 2 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for string + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( split($pattern, $value, $limit) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing split() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +array(1) { + [0]=> + string(1) "0" +} + +Arg value 1 +array(1) { + [0]=> + string(1) "1" +} + +Arg value 12345 +array(1) { + [0]=> + string(5) "12345" +} + +Arg value -2345 +array(1) { + [0]=> + string(5) "-2345" +} + +Arg value 10.5 +array(1) { + [0]=> + string(4) "10.5" +} + +Arg value -10.5 +array(1) { + [0]=> + string(5) "-10.5" +} + +Arg value 101234567000 +array(1) { + [0]=> + string(12) "101234567000" +} + +Arg value 1.07654321E-9 +array(2) { + [0]=> + string(10) "1.07654321" + [1]=> + string(2) "-9" +} + +Arg value 0.5 +array(1) { + [0]=> + string(3) "0.5" +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(3) { + [0]=> + string(1) "A" + [1]=> + string(0) "" + [2]=> + string(2) "ay" +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(3) { + [0]=> + string(1) "A" + [1]=> + string(0) "" + [2]=> + string(2) "ay" +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(3) { + [0]=> + string(1) "A" + [1]=> + string(0) "" + [2]=> + string(2) "ay" +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(3) { + [0]=> + string(1) "A" + [1]=> + string(0) "" + [2]=> + string(2) "ay" +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(3) { + [0]=> + string(1) "A" + [1]=> + string(0) "" + [2]=> + string(2) "ay" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} + +Arg value 1 +array(1) { + [0]=> + string(1) "1" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} + +Arg value 1 +array(1) { + [0]=> + string(1) "1" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 4096 - Object of class stdClass could not be converted to string, %s(74) +Error: 8 - Object of class stdClass to string conversion, %s(74) +array(2) { + [0]=> + string(2) "Ob" + [1]=> + string(3) "ect" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} +Done +--UEXPECTF-- +*** Testing split() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +array(1) { + [0]=> + string(1) "0" +} + +Arg value 1 +array(1) { + [0]=> + string(1) "1" +} + +Arg value 12345 +array(1) { + [0]=> + string(5) "12345" +} + +Arg value -2345 +array(1) { + [0]=> + string(5) "-2345" +} + +Arg value 10.5 +array(1) { + [0]=> + string(4) "10.5" +} + +Arg value -10.5 +array(1) { + [0]=> + string(5) "-10.5" +} + +Arg value 101234567000 +array(1) { + [0]=> + string(12) "101234567000" +} + +Arg value 1.07654321E-9 +array(2) { + [0]=> + string(10) "1.07654321" + [1]=> + string(2) "-9" +} + +Arg value 0.5 +array(1) { + [0]=> + string(3) "0.5" +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(3) { + [0]=> + string(1) "A" + [1]=> + string(0) "" + [2]=> + string(2) "ay" +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(3) { + [0]=> + string(1) "A" + [1]=> + string(0) "" + [2]=> + string(2) "ay" +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(3) { + [0]=> + string(1) "A" + [1]=> + string(0) "" + [2]=> + string(2) "ay" +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(3) { + [0]=> + string(1) "A" + [1]=> + string(0) "" + [2]=> + string(2) "ay" +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(3) { + [0]=> + string(1) "A" + [1]=> + string(0) "" + [2]=> + string(2) "ay" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} + +Arg value 1 +array(1) { + [0]=> + string(1) "1" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} + +Arg value 1 +array(1) { + [0]=> + string(1) "1" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 4096 - Object of class stdClass could not be converted to binary string, %s(74) +Error: 8 - Object of class stdClass to string conversion, %s(74) +array(2) { + [0]=> + string(2) "Ob" + [1]=> + string(3) "ect" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} +Done diff --git a/ext/ereg/tests/split_variation_003.phpt b/ext/ereg/tests/split_variation_003.phpt new file mode 100644 index 0000000000..2968012962 --- /dev/null +++ b/ext/ereg/tests/split_variation_003.phpt @@ -0,0 +1,244 @@ +--TEST-- +Test split() function : usage variations - unexpected type for arg 3 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for limit + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( split($pattern, $string, $value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing split() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(61) +Error: 8 - Undefined variable: unset_var, %s(64) + +Arg value 10.5 +array(5) { + [0]=> + string(1) "1" + [1]=> + string(1) "2" + [2]=> + string(1) "3" + [3]=> + string(1) "4" + [4]=> + string(1) "5" +} + +Arg value -10.5 +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value 101234567000 +array(5) { + [0]=> + string(1) "1" + [1]=> + string(1) "2" + [2]=> + string(1) "3" + [3]=> + string(1) "4" + [4]=> + string(1) "5" +} + +Arg value 1.07654321E-9 +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value 0.5 +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} +Error: 8 - Array to string conversion, %s(70) + +Arg value Array +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} +Error: 8 - Array to string conversion, %s(70) + +Arg value Array +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} +Error: 8 - Array to string conversion, %s(70) + +Arg value Array +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} +Error: 8 - Array to string conversion, %s(70) + +Arg value Array +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} +Error: 8 - Array to string conversion, %s(70) + +Arg value Array +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value 1 +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value 1 +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value string +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value string +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} +Error: 4096 - Object of class stdClass could not be converted to string, %s(70) + +Arg value +Error: 8 - Object of class stdClass could not be converted to int, %s(71) +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} +Done \ No newline at end of file diff --git a/ext/ereg/tests/split_variation_004.phpt b/ext/ereg/tests/split_variation_004.phpt new file mode 100644 index 0000000000..fbd76277ae --- /dev/null +++ b/ext/ereg/tests/split_variation_004.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test split() function : usage variations - out-of-range values for limit +--FILE-- + +--EXPECTF-- +*** Testing split() : usage variations *** +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} +array(5) { + [0]=> + string(1) "1" + [1]=> + string(1) "2" + [2]=> + string(1) "3" + [3]=> + string(1) "4" + [4]=> + string(1) "5" +} +Done \ No newline at end of file diff --git a/ext/ereg/tests/spliti_basic_001.phpt b/ext/ereg/tests/spliti_basic_001.phpt new file mode 100644 index 0000000000..c178aef49d --- /dev/null +++ b/ext/ereg/tests/spliti_basic_001.phpt @@ -0,0 +1,129 @@ +--TEST-- +Test spliti() function : basic functionality - test a number of simple spliti, specifying a limit +--FILE-- + Pattern: '$pattern'; match: '$string'\n"; + var_dump(spliti($pattern, $string . ' |1| ' . $string . ' |2| ' . $string, 2)); +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing ereg() : basic functionality *** + +--> Pattern: '..(a|b|c)(a|b|c)..'; match: '--- ab ---' +array(2) { + [0]=> + string(2) "--" + [1]=> + string(32) "-- |1| --- ab --- |2| --- ab ---" +} + +--> Pattern: '()'; match: '' + +Warning: spliti(): Invalid Regular Expression to spliti() in %s on line 19 +bool(false) + +--> Pattern: '()'; match: 'abcdef' + +Warning: spliti(): Invalid Regular Expression to spliti() in %s on line 19 +bool(false) + +--> Pattern: '[x]|[^x]'; match: 'abcdef' +array(2) { + [0]=> + string(0) "" + [1]=> + string(27) "bcdef |1| abcdef |2| abcdef" +} + +--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; match: '--- aaa bbb ccc ddd ---' +array(2) { + [0]=> + string(4) "--- " + [1]=> + string(60) " --- |1| --- aaa bbb ccc ddd --- |2| --- aaa bbb ccc ddd ---" +} + +--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; match: '\`^.[$()|*+?{'' +array(2) { + [0]=> + string(0) "" + [1]=> + string(38) " |1| \`^.[$()|*+?{' |2| \`^.[$()|*+?{'" +} + +--> Pattern: '\a'; match: 'a' +array(2) { + [0]=> + string(0) "" + [1]=> + string(12) " |1| a |2| a" +} + +--> Pattern: '[0-9][^0-9]'; match: '2a' +array(2) { + [0]=> + string(0) "" + [1]=> + string(14) " |1| 2a |2| 2a" +} + +--> Pattern: '^[[:alnum:]]{62,62}$'; match: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' +array(1) { + [0]=> + string(196) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |1| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |2| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" +} + +--> Pattern: '^[[:digit:]]{5}'; match: '0123456789' +array(2) { + [0]=> + string(0) "" + [1]=> + string(35) "56789 |1| 0123456789 |2| 0123456789" +} + +--> Pattern: '[[:digit:]]{5}$'; match: '0123456789' +array(2) { + [0]=> + string(35) "0123456789 |1| 0123456789 |2| 01234" + [1]=> + string(0) "" +} + +--> Pattern: '[[:blank:]]{1,10}'; match: ' + ' +array(2) { + [0]=> + string(1) " +" + [1]=> + string(15) "|1| + |2| + " +} + +--> Pattern: '[[:print:]]{3}'; match: ' a ' +array(2) { + [0]=> + string(0) "" + [1]=> + string(16) " |1| a |2| a " +} +Done \ No newline at end of file diff --git a/ext/ereg/tests/spliti_basic_002.phpt b/ext/ereg/tests/spliti_basic_002.phpt new file mode 100644 index 0000000000..606cbadd7a --- /dev/null +++ b/ext/ereg/tests/spliti_basic_002.phpt @@ -0,0 +1,227 @@ +--TEST-- +Test spliti() function : basic functionality - test a number of simple spliti, without specifying a limit +--FILE-- + Pattern: '$pattern'; match: '$string'\n"; + var_dump(spliti($pattern, $string . ' |1| ' . $string . ' |2| ' . $string)); +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing ereg() : basic functionality *** + +--> Pattern: '..(a|b|c)(a|b|c)..'; match: '--- ab ---' +array(4) { + [0]=> + string(2) "--" + [1]=> + string(9) "-- |1| --" + [2]=> + string(9) "-- |2| --" + [3]=> + string(2) "--" +} + +--> Pattern: '()'; match: '' + +Warning: spliti(): Invalid Regular Expression to spliti() in %s on line 19 +bool(false) + +--> Pattern: '()'; match: 'abcdef' + +Warning: spliti(): Invalid Regular Expression to spliti() in %s on line 19 +bool(false) + +--> Pattern: '[x]|[^x]'; match: 'abcdef' +array(29) { + [0]=> + string(0) "" + [1]=> + string(0) "" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(0) "" + [5]=> + string(0) "" + [6]=> + string(0) "" + [7]=> + string(0) "" + [8]=> + string(0) "" + [9]=> + string(0) "" + [10]=> + string(0) "" + [11]=> + string(0) "" + [12]=> + string(0) "" + [13]=> + string(0) "" + [14]=> + string(0) "" + [15]=> + string(0) "" + [16]=> + string(0) "" + [17]=> + string(0) "" + [18]=> + string(0) "" + [19]=> + string(0) "" + [20]=> + string(0) "" + [21]=> + string(0) "" + [22]=> + string(0) "" + [23]=> + string(0) "" + [24]=> + string(0) "" + [25]=> + string(0) "" + [26]=> + string(0) "" + [27]=> + string(0) "" + [28]=> + string(0) "" +} + +--> Pattern: '(a{1})(a{1,}) (b{1,3}) (c+) (d?ddd|e)'; match: '--- aaa bbb ccc ddd ---' +array(4) { + [0]=> + string(4) "--- " + [1]=> + string(13) " --- |1| --- " + [2]=> + string(13) " --- |2| --- " + [3]=> + string(4) " ---" +} + +--> Pattern: '\\\`\^\.\[\$\(\)\|\*\+\?\{\''; match: '\`^.[$()|*+?{'' +array(4) { + [0]=> + string(0) "" + [1]=> + string(5) " |1| " + [2]=> + string(5) " |2| " + [3]=> + string(0) "" +} + +--> Pattern: '\a'; match: 'a' +array(4) { + [0]=> + string(0) "" + [1]=> + string(5) " |1| " + [2]=> + string(5) " |2| " + [3]=> + string(0) "" +} + +--> Pattern: '[0-9][^0-9]'; match: '2a' +array(6) { + [0]=> + string(0) "" + [1]=> + string(2) " |" + [2]=> + string(1) " " + [3]=> + string(2) " |" + [4]=> + string(1) " " + [5]=> + string(0) "" +} + +--> Pattern: '^[[:alnum:]]{62,62}$'; match: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' +array(1) { + [0]=> + string(196) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |1| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |2| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" +} + +--> Pattern: '^[[:digit:]]{5}'; match: '0123456789' +array(3) { + [0]=> + string(0) "" + [1]=> + string(0) "" + [2]=> + string(30) " |1| 0123456789 |2| 0123456789" +} + +--> Pattern: '[[:digit:]]{5}$'; match: '0123456789' +array(2) { + [0]=> + string(35) "0123456789 |1| 0123456789 |2| 01234" + [1]=> + string(0) "" +} + +--> Pattern: '[[:blank:]]{1,10}'; match: ' + ' +array(6) { + [0]=> + string(1) " +" + [1]=> + string(3) "|1|" + [2]=> + string(1) " +" + [3]=> + string(3) "|2|" + [4]=> + string(1) " +" + [5]=> + string(0) "" +} + +--> Pattern: '[[:print:]]{3}'; match: ' a ' +array(7) { + [0]=> + string(0) "" + [1]=> + string(0) "" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(0) "" + [5]=> + string(0) "" + [6]=> + string(1) " " +} +Done \ No newline at end of file diff --git a/ext/ereg/tests/spliti_basic_003.phpt b/ext/ereg/tests/spliti_basic_003.phpt new file mode 100644 index 0000000000..143f1a1961 --- /dev/null +++ b/ext/ereg/tests/spliti_basic_003.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test spliti() function : basic functionality - a few non-matches +--FILE-- + +--EXPECTF-- +array(1) { + [0]=> + string(7) "-- 0 --" +} +array(1) { + [0]=> + string(11) "--- aaa ---" +} +array(1) { + [0]=> + string(10) "--- ba ---" +} +array(1) { + [0]=> + string(10) "--- ba ---" +} +array(1) { + [0]=> + string(9) "--- x ---" +} +Done \ No newline at end of file diff --git a/ext/ereg/tests/spliti_basic_004.phpt b/ext/ereg/tests/spliti_basic_004.phpt new file mode 100644 index 0000000000..95edc158d9 --- /dev/null +++ b/ext/ereg/tests/spliti_basic_004.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test spliti() function : basic functionality - confirm case insensitivity +--FILE-- + +--EXPECTF-- +array(2) { + [0]=> + string(4) "--- " + [1]=> + string(4) " ---" +} +array(2) { + [0]=> + string(4) "--- " + [1]=> + string(4) " ---" +} +array(2) { + [0]=> + string(4) "--- " + [1]=> + string(4) " ---" +} +array(2) { + [0]=> + string(4) "--- " + [1]=> + string(4) " ---" +} +Done \ No newline at end of file diff --git a/ext/ereg/tests/spliti_error_001.phpt b/ext/ereg/tests/spliti_error_001.phpt new file mode 100644 index 0000000000..44d2be6185 --- /dev/null +++ b/ext/ereg/tests/spliti_error_001.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test spliti() function : error conditions - wrong number of args +--FILE-- + +--EXPECTF-- +*** Testing spliti() : error conditions - wrong number of args *** + +-- Testing spliti() function with more than expected no. of arguments -- + +Warning: Wrong parameter count for spliti() in %s on line 17 +NULL + +-- Testing spliti() function with less than expected no. of arguments -- + +Warning: Wrong parameter count for spliti() in %s on line 22 +NULL +Done \ No newline at end of file diff --git a/ext/ereg/tests/spliti_error_002.phpt b/ext/ereg/tests/spliti_error_002.phpt new file mode 100644 index 0000000000..3dc3b2edcd --- /dev/null +++ b/ext/ereg/tests/spliti_error_002.phpt @@ -0,0 +1,88 @@ +--TEST-- +Test spliti() function : error conditions - test bad regular expressions +--FILE-- + +--EXPECTF-- +*** Testing spliti() : error conditions *** + +Warning: spliti(): REG_EMPTY in %s on line 16 +bool(false) + +Warning: spliti(): REG_EPAREN in %s on line 17 +bool(false) + +Warning: spliti(): REG_EBRACK in %s on line 18 +bool(false) + +Warning: spliti(): REG_EPAREN in %s on line 19 +bool(false) + +Warning: spliti(): REG_BADRPT in %s on line 20 +bool(false) + +Warning: spliti(): REG_BADRPT in %s on line 21 +bool(false) + +Warning: spliti(): REG_BADRPT in %s on line 22 +bool(false) + +Warning: spliti(): REG_BADRPT in %s on line 23 +bool(false) + +Warning: spliti(): REG_BADBR in %s on line 24 +bool(false) + +Warning: spliti(): REG_EMPTY in %s on line 25 +bool(false) + +Warning: spliti(): REG_EMPTY in %s on line 26 +bool(false) + +Warning: spliti(): REG_BADBR in %s on line 27 +bool(false) + +Warning: spliti(): REG_ERANGE in %s on line 28 +bool(false) + +Warning: spliti(): REG_EESCAPE in %s on line 29 +bool(false) + +Warning: spliti(): REG_ERANGE in %s on line 30 +bool(false) +string(8) "original" +Done \ No newline at end of file diff --git a/ext/ereg/tests/spliti_variation_001.phpt b/ext/ereg/tests/spliti_variation_001.phpt new file mode 100644 index 0000000000..a811e144bd --- /dev/null +++ b/ext/ereg/tests/spliti_variation_001.phpt @@ -0,0 +1,441 @@ +--TEST-- +Test spliti() function : usage variations - unexpected type for arg 1 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for pattern + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( spliti($value, $string, $limit) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing spliti() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value 1 +array(4) { + [0]=> + string(0) "" + [1]=> + string(3) " a " + [2]=> + string(7) " Array " + [3]=> + string(3) " c " +} + +Arg value 12345 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value -2345 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value 10.5 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value -10.5 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value 101234567000 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value 1.07654321E-9 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value 0.5 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(2) { + [0]=> + string(6) "1 a 1 " + [1]=> + string(5) " 1 c " +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(2) { + [0]=> + string(6) "1 a 1 " + [1]=> + string(5) " 1 c " +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(2) { + [0]=> + string(6) "1 a 1 " + [1]=> + string(5) " 1 c " +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(2) { + [0]=> + string(6) "1 a 1 " + [1]=> + string(5) " 1 c " +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(2) { + [0]=> + string(6) "1 a 1 " + [1]=> + string(5) " 1 c " +} + +Arg value +Error: 2 - spliti(): REG_EMPTY, %s(74) +bool(false) + +Arg value +Error: 2 - spliti(): REG_EMPTY, %s(74) +bool(false) + +Arg value 1 +array(4) { + [0]=> + string(0) "" + [1]=> + string(3) " a " + [2]=> + string(7) " Array " + [3]=> + string(3) " c " +} + +Arg value +Error: 2 - spliti(): REG_EMPTY, %s(74) +bool(false) + +Arg value 1 +array(4) { + [0]=> + string(0) "" + [1]=> + string(3) " a " + [2]=> + string(7) " Array " + [3]=> + string(3) " c " +} + +Arg value +Error: 2 - spliti(): REG_EMPTY, %s(74) +bool(false) + +Arg value +Error: 2 - spliti(): REG_EMPTY, %s(74) +bool(false) + +Arg value +Error: 2 - spliti(): REG_EMPTY, %s(74) +bool(false) +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 4096 - Object of class stdClass could not be converted to string, %s(74) +Error: 8 - Object of class stdClass to string conversion, %s(74) +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value +Error: 2 - spliti(): REG_EMPTY, %s(74) +bool(false) + +Arg value +Error: 2 - spliti(): REG_EMPTY, %s(74) +bool(false) +Done +--UEXPECTF-- +*** Testing spliti() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value 1 +array(4) { + [0]=> + string(0) "" + [1]=> + string(3) " a " + [2]=> + string(7) " Array " + [3]=> + string(3) " c " +} + +Arg value 12345 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value -2345 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value 10.5 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value -10.5 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value 101234567000 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value 1.07654321E-9 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value 0.5 +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(2) { + [0]=> + string(6) "1 a 1 " + [1]=> + string(5) " 1 c " +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(2) { + [0]=> + string(6) "1 a 1 " + [1]=> + string(5) " 1 c " +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(2) { + [0]=> + string(6) "1 a 1 " + [1]=> + string(5) " 1 c " +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(2) { + [0]=> + string(6) "1 a 1 " + [1]=> + string(5) " 1 c " +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(2) { + [0]=> + string(6) "1 a 1 " + [1]=> + string(5) " 1 c " +} + +Arg value +Error: 2 - spliti(): REG_EMPTY, %s(74) +bool(false) + +Arg value +Error: 2 - spliti(): REG_EMPTY, %s(74) +bool(false) + +Arg value 1 +array(4) { + [0]=> + string(0) "" + [1]=> + string(3) " a " + [2]=> + string(7) " Array " + [3]=> + string(3) " c " +} + +Arg value +Error: 2 - spliti(): REG_EMPTY, %s(74) +bool(false) + +Arg value 1 +array(4) { + [0]=> + string(0) "" + [1]=> + string(3) " a " + [2]=> + string(7) " Array " + [3]=> + string(3) " c " +} + +Arg value +Error: 2 - spliti(): REG_EMPTY, %s(74) +bool(false) + +Arg value +Error: 2 - spliti(): REG_EMPTY, %s(74) +bool(false) + +Arg value +Error: 2 - spliti(): REG_EMPTY, %s(74) +bool(false) +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 4096 - Object of class stdClass could not be converted to binary string, %s(74) +Error: 8 - Object of class stdClass to string conversion, %s(74) +array(1) { + [0]=> + string(16) "1 a 1 Array 1 c " +} + +Arg value +Error: 2 - spliti(): REG_EMPTY, %s(74) +bool(false) + +Arg value +Error: 2 - spliti(): REG_EMPTY, %s(74) +bool(false) +Done diff --git a/ext/ereg/tests/spliti_variation_002.phpt b/ext/ereg/tests/spliti_variation_002.phpt new file mode 100644 index 0000000000..6b311dfc70 --- /dev/null +++ b/ext/ereg/tests/spliti_variation_002.phpt @@ -0,0 +1,469 @@ +--TEST-- +Test spliti() function : usage variations - unexpected type for arg 2 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for string + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( spliti($pattern, $value, $limit) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing spliti() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +array(1) { + [0]=> + string(1) "0" +} + +Arg value 1 +array(1) { + [0]=> + string(1) "1" +} + +Arg value 12345 +array(1) { + [0]=> + string(5) "12345" +} + +Arg value -2345 +array(1) { + [0]=> + string(5) "-2345" +} + +Arg value 10.5 +array(1) { + [0]=> + string(4) "10.5" +} + +Arg value -10.5 +array(1) { + [0]=> + string(5) "-10.5" +} + +Arg value 101234567000 +array(1) { + [0]=> + string(12) "101234567000" +} + +Arg value 1.07654321E-9 +array(2) { + [0]=> + string(10) "1.07654321" + [1]=> + string(2) "-9" +} + +Arg value 0.5 +array(1) { + [0]=> + string(3) "0.5" +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(3) { + [0]=> + string(1) "A" + [1]=> + string(0) "" + [2]=> + string(2) "ay" +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(3) { + [0]=> + string(1) "A" + [1]=> + string(0) "" + [2]=> + string(2) "ay" +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(3) { + [0]=> + string(1) "A" + [1]=> + string(0) "" + [2]=> + string(2) "ay" +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(3) { + [0]=> + string(1) "A" + [1]=> + string(0) "" + [2]=> + string(2) "ay" +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(3) { + [0]=> + string(1) "A" + [1]=> + string(0) "" + [2]=> + string(2) "ay" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} + +Arg value 1 +array(1) { + [0]=> + string(1) "1" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} + +Arg value 1 +array(1) { + [0]=> + string(1) "1" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 4096 - Object of class stdClass could not be converted to string, %s(74) +Error: 8 - Object of class stdClass to string conversion, %s(74) +array(3) { + [0]=> + string(2) "Ob" + [1]=> + string(0) "" + [2]=> + string(2) "ct" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} +Done +--UEXPECTF-- +*** Testing spliti() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +array(1) { + [0]=> + string(1) "0" +} + +Arg value 1 +array(1) { + [0]=> + string(1) "1" +} + +Arg value 12345 +array(1) { + [0]=> + string(5) "12345" +} + +Arg value -2345 +array(1) { + [0]=> + string(5) "-2345" +} + +Arg value 10.5 +array(1) { + [0]=> + string(4) "10.5" +} + +Arg value -10.5 +array(1) { + [0]=> + string(5) "-10.5" +} + +Arg value 101234567000 +array(1) { + [0]=> + string(12) "101234567000" +} + +Arg value 1.07654321E-9 +array(2) { + [0]=> + string(10) "1.07654321" + [1]=> + string(2) "-9" +} + +Arg value 0.5 +array(1) { + [0]=> + string(3) "0.5" +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(3) { + [0]=> + string(1) "A" + [1]=> + string(0) "" + [2]=> + string(2) "ay" +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(3) { + [0]=> + string(1) "A" + [1]=> + string(0) "" + [2]=> + string(2) "ay" +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(3) { + [0]=> + string(1) "A" + [1]=> + string(0) "" + [2]=> + string(2) "ay" +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(3) { + [0]=> + string(1) "A" + [1]=> + string(0) "" + [2]=> + string(2) "ay" +} +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 8 - Array to string conversion, %s(74) +array(3) { + [0]=> + string(1) "A" + [1]=> + string(0) "" + [2]=> + string(2) "ay" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} + +Arg value 1 +array(1) { + [0]=> + string(1) "1" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} + +Arg value 1 +array(1) { + [0]=> + string(1) "1" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 4096 - Object of class stdClass could not be converted to binary string, %s(74) +Error: 8 - Object of class stdClass to string conversion, %s(74) +array(3) { + [0]=> + string(2) "Ob" + [1]=> + string(0) "" + [2]=> + string(2) "ct" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} + +Arg value +array(1) { + [0]=> + string(0) "" +} +Done diff --git a/ext/ereg/tests/spliti_variation_003.phpt b/ext/ereg/tests/spliti_variation_003.phpt new file mode 100644 index 0000000000..7084ba33f0 --- /dev/null +++ b/ext/ereg/tests/spliti_variation_003.phpt @@ -0,0 +1,244 @@ +--TEST-- +Test spliti() function : usage variations - unexpected type for arg 3 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for limit + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( spliti($pattern, $string, $value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing spliti() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(61) +Error: 8 - Undefined variable: unset_var, %s(64) + +Arg value 10.5 +array(5) { + [0]=> + string(1) "1" + [1]=> + string(1) "2" + [2]=> + string(1) "3" + [3]=> + string(1) "4" + [4]=> + string(1) "5" +} + +Arg value -10.5 +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value 101234567000 +array(5) { + [0]=> + string(1) "1" + [1]=> + string(1) "2" + [2]=> + string(1) "3" + [3]=> + string(1) "4" + [4]=> + string(1) "5" +} + +Arg value 1.07654321E-9 +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value 0.5 +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} +Error: 8 - Array to string conversion, %s(70) + +Arg value Array +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} +Error: 8 - Array to string conversion, %s(70) + +Arg value Array +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} +Error: 8 - Array to string conversion, %s(70) + +Arg value Array +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} +Error: 8 - Array to string conversion, %s(70) + +Arg value Array +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} +Error: 8 - Array to string conversion, %s(70) + +Arg value Array +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value 1 +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value 1 +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value string +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value string +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} +Error: 4096 - Object of class stdClass could not be converted to string, %s(70) + +Arg value +Error: 8 - Object of class stdClass could not be converted to int, %s(71) +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} + +Arg value +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} +Done \ No newline at end of file diff --git a/ext/ereg/tests/spliti_variation_004.phpt b/ext/ereg/tests/spliti_variation_004.phpt new file mode 100644 index 0000000000..7a331be367 --- /dev/null +++ b/ext/ereg/tests/spliti_variation_004.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test spliti() function : usage variations - out-of-range values for limit +--FILE-- + +--EXPECTF-- +*** Testing spliti() : usage variations *** +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} +array(1) { + [0]=> + string(9) "1 2 3 4 5" +} +array(5) { + [0]=> + string(1) "1" + [1]=> + string(1) "2" + [2]=> + string(1) "3" + [3]=> + string(1) "4" + [4]=> + string(1) "5" +} +Done \ No newline at end of file diff --git a/ext/ereg/tests/sql_regcase_basic_001.phpt b/ext/ereg/tests/sql_regcase_basic_001.phpt new file mode 100644 index 0000000000..7657fa28c7 --- /dev/null +++ b/ext/ereg/tests/sql_regcase_basic_001.phpt @@ -0,0 +1,25 @@ +--TEST-- +Test sql_regcase() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing sql_regcase() : basic functionality *** +string(39) "[Ss][Tt][Rr][Ii][Nn][Gg]_[Vv][Aa][Ll]-0" +Done \ No newline at end of file diff --git a/ext/ereg/tests/sql_regcase_error_001.phpt b/ext/ereg/tests/sql_regcase_error_001.phpt new file mode 100644 index 0000000000..3ab9fd8db8 --- /dev/null +++ b/ext/ereg/tests/sql_regcase_error_001.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test sql_regcase() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing sql_regcase() : error conditions *** + +-- Testing sql_regcase() function with Zero arguments -- + +Warning: Wrong parameter count for sql_regcase() in %s on line 12 +NULL + +-- Testing sql_regcase() function with more than expected no. of arguments -- + +Warning: Wrong parameter count for sql_regcase() in %s on line 18 +NULL +Done \ No newline at end of file diff --git a/ext/ereg/tests/sql_regcase_variation_001.phpt b/ext/ereg/tests/sql_regcase_variation_001.phpt new file mode 100644 index 0000000000..7746098b1f --- /dev/null +++ b/ext/ereg/tests/sql_regcase_variation_001.phpt @@ -0,0 +1,265 @@ +--TEST-- +Test sql_regcase() function : usage variations - unexpected arg type +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for string + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( sql_regcase($value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing sql_regcase() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(62) +Error: 8 - Undefined variable: unset_var, %s(65) + +Arg value 0 +string(1) "0" + +Arg value 1 +string(1) "1" + +Arg value 12345 +string(5) "12345" + +Arg value -2345 +string(5) "-2345" + +Arg value 10.5 +string(4) "10.5" + +Arg value -10.5 +string(5) "-10.5" + +Arg value 101234567000 +string(12) "101234567000" + +Arg value 1.07654321E-9 +string(16) "1.07654321[Ee]-9" + +Arg value 0.5 +string(3) "0.5" +Error: 8 - Array to string conversion, %s(71) + +Arg value Array +Error: 8 - Array to string conversion, %s(72) +string(20) "[Aa][Rr][Rr][Aa][Yy]" +Error: 8 - Array to string conversion, %s(71) + +Arg value Array +Error: 8 - Array to string conversion, %s(72) +string(20) "[Aa][Rr][Rr][Aa][Yy]" +Error: 8 - Array to string conversion, %s(71) + +Arg value Array +Error: 8 - Array to string conversion, %s(72) +string(20) "[Aa][Rr][Rr][Aa][Yy]" +Error: 8 - Array to string conversion, %s(71) + +Arg value Array +Error: 8 - Array to string conversion, %s(72) +string(20) "[Aa][Rr][Rr][Aa][Yy]" +Error: 8 - Array to string conversion, %s(71) + +Arg value Array +Error: 8 - Array to string conversion, %s(72) +string(20) "[Aa][Rr][Rr][Aa][Yy]" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value +string(0) "" +Error: 4096 - Object of class stdClass could not be converted to string, %s(71) + +Arg value +Error: 4096 - Object of class stdClass could not be converted to string, %s(72) +Error: 8 - Object of class stdClass to string conversion, %s(72) +string(24) "[Oo][Bb][Jj][Ee][Cc][Tt]" + +Arg value +string(0) "" + +Arg value +string(0) "" +Done +--UEXPECTF-- +*** Testing sql_regcase() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(62) +Error: 8 - Undefined variable: unset_var, %s(65) + +Arg value 0 +string(1) "0" + +Arg value 1 +string(1) "1" + +Arg value 12345 +string(5) "12345" + +Arg value -2345 +string(5) "-2345" + +Arg value 10.5 +string(4) "10.5" + +Arg value -10.5 +string(5) "-10.5" + +Arg value 101234567000 +string(12) "101234567000" + +Arg value 1.07654321E-9 +string(16) "1.07654321[Ee]-9" + +Arg value 0.5 +string(3) "0.5" +Error: 8 - Array to string conversion, %s(71) + +Arg value Array +Error: 8 - Array to string conversion, %s(72) +string(20) "[Aa][Rr][Rr][Aa][Yy]" +Error: 8 - Array to string conversion, %s(71) + +Arg value Array +Error: 8 - Array to string conversion, %s(72) +string(20) "[Aa][Rr][Rr][Aa][Yy]" +Error: 8 - Array to string conversion, %s(71) + +Arg value Array +Error: 8 - Array to string conversion, %s(72) +string(20) "[Aa][Rr][Rr][Aa][Yy]" +Error: 8 - Array to string conversion, %s(71) + +Arg value Array +Error: 8 - Array to string conversion, %s(72) +string(20) "[Aa][Rr][Rr][Aa][Yy]" +Error: 8 - Array to string conversion, %s(71) + +Arg value Array +Error: 8 - Array to string conversion, %s(72) +string(20) "[Aa][Rr][Rr][Aa][Yy]" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value +string(0) "" +Error: 4096 - Object of class stdClass could not be converted to string, %s(71) + +Arg value +Error: 4096 - Object of class stdClass could not be converted to binary string, %s(72) +Error: 8 - Object of class stdClass to string conversion, %s(72) +string(24) "[Oo][Bb][Jj][Ee][Cc][Tt]" + +Arg value +string(0) "" + +Arg value +string(0) "" +Done \ No newline at end of file diff --git a/ext/standard/tests/url/base64_decode_basic_001.phpt b/ext/standard/tests/url/base64_decode_basic_001.phpt new file mode 100644 index 0000000000..7b1052a97d --- /dev/null +++ b/ext/standard/tests/url/base64_decode_basic_001.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test base64_decode() function : basic functionality - ensure all base64 alphabet is supported. +--FILE-- + +--EXPECTF-- +Decode an input string containing the whole base64 alphabet: +string(96) "00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbf" +string(96) "00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbf" +string(96) "00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbf" +Done +--UEXPECTF-- +Decode an input string containing the whole base64 alphabet: +unicode(96) "00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbf" +unicode(96) "00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbf" +unicode(96) "00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbf" +Done \ No newline at end of file diff --git a/ext/standard/tests/url/base64_decode_basic_002.phpt b/ext/standard/tests/url/base64_decode_basic_002.phpt new file mode 100644 index 0000000000..1289894f4a --- /dev/null +++ b/ext/standard/tests/url/base64_decode_basic_002.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test base64_decode() function : basic functionality - strict vs non-strict with non-base64 chars. +--FILE-- + +--EXPECTF-- +Decode 'hello world!': +string(12) "hello world!" +string(12) "hello world!" +string(12) "hello world!" + +Whitespace does not affect base64_decode, even with $strict===true: +string(12) "hello world!" +string(12) "hello world!" +string(12) "hello world!" + +Other chars outside the base64 alphabet are ignored when $strict===false, but cause failure with $strict===true: +string(12) "hello world!" +string(12) "hello world!" +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/url/base64_decode_error_001.phpt b/ext/standard/tests/url/base64_decode_error_001.phpt new file mode 100644 index 0000000000..2725164464 --- /dev/null +++ b/ext/standard/tests/url/base64_decode_error_001.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test base64_decode() function : error conditions - wrong number of args +--FILE-- + +--EXPECTF-- +*** Testing base64_decode() : error conditions *** + +-- Testing base64_decode() function with Zero arguments -- + +Warning: base64_decode() expects at least 1 parameter, 0 given in %s on line 12 +NULL + +-- Testing base64_decode() function with more than expected no. of arguments -- + +Warning: base64_decode() expects at most 2 parameters, 3 given in %s on line 19 +NULL +Done diff --git a/ext/standard/tests/url/base64_decode_variation_001.phpt b/ext/standard/tests/url/base64_decode_variation_001.phpt new file mode 100644 index 0000000000..93b0a63cae --- /dev/null +++ b/ext/standard/tests/url/base64_decode_variation_001.phpt @@ -0,0 +1,264 @@ +--TEST-- +Test base64_decode() function : usage variations - unexpected types for arg 1 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for str + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( base64_decode($value, $strict) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing base64_decode() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(63) +Error: 8 - Undefined variable: unset_var, %s(66) + +Arg value 0 +string(0) "" + +Arg value 1 +string(0) "" + +Arg value 12345 +string(3) "×mø" + +Arg value -2345 +bool(false) + +Arg value 10.5 +bool(false) + +Arg value -10.5 +bool(false) + +Arg value 101234567000 +string(9) "×MvߎzïM4" + +Arg value 1.07654321E-9 +bool(false) + +Arg value 0.5 +bool(false) +Error: 8 - Array to string conversion, %s(72) + +Arg value Array +Error: 2 - base64_decode() expects parameter 1 to be string, array given, %s(73) +NULL +Error: 8 - Array to string conversion, %s(72) + +Arg value Array +Error: 2 - base64_decode() expects parameter 1 to be string, array given, %s(73) +NULL +Error: 8 - Array to string conversion, %s(72) + +Arg value Array +Error: 2 - base64_decode() expects parameter 1 to be string, array given, %s(73) +NULL +Error: 8 - Array to string conversion, %s(72) + +Arg value Array +Error: 2 - base64_decode() expects parameter 1 to be string, array given, %s(73) +NULL +Error: 8 - Array to string conversion, %s(72) + +Arg value Array +Error: 2 - base64_decode() expects parameter 1 to be string, array given, %s(73) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(0) "" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value +string(0) "" +Error: 4096 - Object of class stdClass could not be converted to string, %s(72) + +Arg value +Error: 2 - base64_decode() expects parameter 1 to be string, object given, %s(73) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" +Done +--UEXPECTF-- +*** Testing base64_decode() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(63) +Error: 8 - Undefined variable: unset_var, %s(66) + +Arg value 0 +string(0) "" + +Arg value 1 +string(0) "" + +Arg value 12345 +string(3) "×mø" + +Arg value -2345 +bool(false) + +Arg value 10.5 +bool(false) + +Arg value -10.5 +bool(false) + +Arg value 101234567000 +string(9) "×MvߎzïM4" + +Arg value 1.07654321E-9 +bool(false) + +Arg value 0.5 +bool(false) +Error: 8 - Array to string conversion, %s(72) + +Arg value Array +Error: 2 - base64_decode() expects parameter 1 to be binary string, array given, %s(73) +NULL +Error: 8 - Array to string conversion, %s(72) + +Arg value Array +Error: 2 - base64_decode() expects parameter 1 to be binary string, array given, %s(73) +NULL +Error: 8 - Array to string conversion, %s(72) + +Arg value Array +Error: 2 - base64_decode() expects parameter 1 to be binary string, array given, %s(73) +NULL +Error: 8 - Array to string conversion, %s(72) + +Arg value Array +Error: 2 - base64_decode() expects parameter 1 to be binary string, array given, %s(73) +NULL +Error: 8 - Array to string conversion, %s(72) + +Arg value Array +Error: 2 - base64_decode() expects parameter 1 to be binary string, array given, %s(73) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(0) "" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value +string(0) "" +Error: 4096 - Object of class stdClass could not be converted to string, %s(72) + +Arg value +Error: 2 - base64_decode() expects parameter 1 to be binary string, object given, %s(73) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" +Done diff --git a/ext/standard/tests/url/base64_decode_variation_002.phpt b/ext/standard/tests/url/base64_decode_variation_002.phpt new file mode 100644 index 0000000000..fc65891f9f --- /dev/null +++ b/ext/standard/tests/url/base64_decode_variation_002.phpt @@ -0,0 +1,280 @@ +--TEST-- +Test base64_decode() function : usage variations - unexpected types for arg 2 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for strict + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( base64_decode($str, $value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing base64_decode() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(67) +Error: 8 - Undefined variable: unset_var, %s(70) + +Arg value 0 +string(12) "hello world!" + +Arg value 1 +bool(false) + +Arg value 12345 +bool(false) + +Arg value -2345 +bool(false) + +Arg value 10.5 +bool(false) + +Arg value -10.5 +bool(false) + +Arg value 101234567000 +bool(false) + +Arg value 1.07654321E-9 +bool(false) + +Arg value 0.5 +bool(false) +Error: 8 - Array to string conversion, %s(76) + +Arg value Array +Error: 2 - base64_decode() expects parameter 2 to be boolean, array given, %s(77) +NULL +Error: 8 - Array to string conversion, %s(76) + +Arg value Array +Error: 2 - base64_decode() expects parameter 2 to be boolean, array given, %s(77) +NULL +Error: 8 - Array to string conversion, %s(76) + +Arg value Array +Error: 2 - base64_decode() expects parameter 2 to be boolean, array given, %s(77) +NULL +Error: 8 - Array to string conversion, %s(76) + +Arg value Array +Error: 2 - base64_decode() expects parameter 2 to be boolean, array given, %s(77) +NULL +Error: 8 - Array to string conversion, %s(76) + +Arg value Array +Error: 2 - base64_decode() expects parameter 2 to be boolean, array given, %s(77) +NULL + +Arg value +string(12) "hello world!" + +Arg value +string(12) "hello world!" + +Arg value 1 +bool(false) + +Arg value +string(12) "hello world!" + +Arg value 1 +bool(false) + +Arg value +string(12) "hello world!" + +Arg value +string(12) "hello world!" + +Arg value +string(12) "hello world!" + +Arg value string +bool(false) + +Arg value string +bool(false) +Error: 4096 - Object of class stdClass could not be converted to string, %s(76) + +Arg value +Error: 2 - base64_decode() expects parameter 2 to be boolean, object given, %s(77) +NULL + +Arg value +string(12) "hello world!" + +Arg value +string(12) "hello world!" +Done +--UEXPECTF-- +*** Testing base64_decode() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(67) +Error: 8 - Undefined variable: unset_var, %s(70) + +Arg value 0 +string(12) "hello world!" + +Arg value 1 +bool(false) + +Arg value 12345 +bool(false) + +Arg value -2345 +bool(false) + +Arg value 10.5 +bool(false) + +Arg value -10.5 +bool(false) + +Arg value 101234567000 +bool(false) + +Arg value 1.07654321E-9 +bool(false) + +Arg value 0.5 +bool(false) +Error: 8 - Array to string conversion, %s(76) + +Arg value Array +Error: 2 - base64_decode() expects parameter 2 to be boolean, array given, %s(77) +NULL +Error: 8 - Array to string conversion, %s(76) + +Arg value Array +Error: 2 - base64_decode() expects parameter 2 to be boolean, array given, %s(77) +NULL +Error: 8 - Array to string conversion, %s(76) + +Arg value Array +Error: 2 - base64_decode() expects parameter 2 to be boolean, array given, %s(77) +NULL +Error: 8 - Array to string conversion, %s(76) + +Arg value Array +Error: 2 - base64_decode() expects parameter 2 to be boolean, array given, %s(77) +NULL +Error: 8 - Array to string conversion, %s(76) + +Arg value Array +Error: 2 - base64_decode() expects parameter 2 to be boolean, array given, %s(77) +NULL + +Arg value +string(12) "hello world!" + +Arg value +string(12) "hello world!" + +Arg value 1 +bool(false) + +Arg value +string(12) "hello world!" + +Arg value 1 +bool(false) + +Arg value +string(12) "hello world!" + +Arg value +string(12) "hello world!" + +Arg value +string(12) "hello world!" + +Arg value string +bool(false) + +Arg value string +bool(false) +Error: 4096 - Object of class stdClass could not be converted to string, %s(76) + +Arg value +Error: 2 - base64_decode() expects parameter 2 to be boolean, object given, %s(77) +NULL + +Arg value +string(12) "hello world!" + +Arg value +string(12) "hello world!" +Done \ No newline at end of file diff --git a/ext/standard/tests/url/base64_encode_basic_001.phpt b/ext/standard/tests/url/base64_encode_basic_001.phpt new file mode 100644 index 0000000000..6ab57f4c55 --- /dev/null +++ b/ext/standard/tests/url/base64_encode_basic_001.phpt @@ -0,0 +1,283 @@ +--TEST-- +Test base64_encode() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing base64_encode() : basic functionality *** +0x0: AA== +0x1: AQ== +0x2: Ag== +0x3: Aw== +0x4: BA== +0x5: BQ== +0x6: Bg== +0x7: Bw== +0x8: CA== +0x9: CQ== +0xA: Cg== +0xB: Cw== +0xC: DA== +0xD: DQ== +0xE: Dg== +0xF: Dw== +0x10: EA== +0x11: EQ== +0x12: Eg== +0x13: Ew== +0x14: FA== +0x15: FQ== +0x16: Fg== +0x17: Fw== +0x18: GA== +0x19: GQ== +0x1A: Gg== +0x1B: Gw== +0x1C: HA== +0x1D: HQ== +0x1E: Hg== +0x1F: Hw== +0x20: IA== +0x21: IQ== +0x22: Ig== +0x23: Iw== +0x24: JA== +0x25: JQ== +0x26: Jg== +0x27: Jw== +0x28: KA== +0x29: KQ== +0x2A: Kg== +0x2B: Kw== +0x2C: LA== +0x2D: LQ== +0x2E: Lg== +0x2F: Lw== +0x30: MA== +0x31: MQ== +0x32: Mg== +0x33: Mw== +0x34: NA== +0x35: NQ== +0x36: Ng== +0x37: Nw== +0x38: OA== +0x39: OQ== +0x3A: Og== +0x3B: Ow== +0x3C: PA== +0x3D: PQ== +0x3E: Pg== +0x3F: Pw== +0x40: QA== +0x41: QQ== +0x42: Qg== +0x43: Qw== +0x44: RA== +0x45: RQ== +0x46: Rg== +0x47: Rw== +0x48: SA== +0x49: SQ== +0x4A: Sg== +0x4B: Sw== +0x4C: TA== +0x4D: TQ== +0x4E: Tg== +0x4F: Tw== +0x50: UA== +0x51: UQ== +0x52: Ug== +0x53: Uw== +0x54: VA== +0x55: VQ== +0x56: Vg== +0x57: Vw== +0x58: WA== +0x59: WQ== +0x5A: Wg== +0x5B: Ww== +0x5C: XA== +0x5D: XQ== +0x5E: Xg== +0x5F: Xw== +0x60: YA== +0x61: YQ== +0x62: Yg== +0x63: Yw== +0x64: ZA== +0x65: ZQ== +0x66: Zg== +0x67: Zw== +0x68: aA== +0x69: aQ== +0x6A: ag== +0x6B: aw== +0x6C: bA== +0x6D: bQ== +0x6E: bg== +0x6F: bw== +0x70: cA== +0x71: cQ== +0x72: cg== +0x73: cw== +0x74: dA== +0x75: dQ== +0x76: dg== +0x77: dw== +0x78: eA== +0x79: eQ== +0x7A: eg== +0x7B: ew== +0x7C: fA== +0x7D: fQ== +0x7E: fg== +0x7F: fw== +0x80: gA== +0x81: gQ== +0x82: gg== +0x83: gw== +0x84: hA== +0x85: hQ== +0x86: hg== +0x87: hw== +0x88: iA== +0x89: iQ== +0x8A: ig== +0x8B: iw== +0x8C: jA== +0x8D: jQ== +0x8E: jg== +0x8F: jw== +0x90: kA== +0x91: kQ== +0x92: kg== +0x93: kw== +0x94: lA== +0x95: lQ== +0x96: lg== +0x97: lw== +0x98: mA== +0x99: mQ== +0x9A: mg== +0x9B: mw== +0x9C: nA== +0x9D: nQ== +0x9E: ng== +0x9F: nw== +0xA0: oA== +0xA1: oQ== +0xA2: og== +0xA3: ow== +0xA4: pA== +0xA5: pQ== +0xA6: pg== +0xA7: pw== +0xA8: qA== +0xA9: qQ== +0xAA: qg== +0xAB: qw== +0xAC: rA== +0xAD: rQ== +0xAE: rg== +0xAF: rw== +0xB0: sA== +0xB1: sQ== +0xB2: sg== +0xB3: sw== +0xB4: tA== +0xB5: tQ== +0xB6: tg== +0xB7: tw== +0xB8: uA== +0xB9: uQ== +0xBA: ug== +0xBB: uw== +0xBC: vA== +0xBD: vQ== +0xBE: vg== +0xBF: vw== +0xC0: wA== +0xC1: wQ== +0xC2: wg== +0xC3: ww== +0xC4: xA== +0xC5: xQ== +0xC6: xg== +0xC7: xw== +0xC8: yA== +0xC9: yQ== +0xCA: yg== +0xCB: yw== +0xCC: zA== +0xCD: zQ== +0xCE: zg== +0xCF: zw== +0xD0: 0A== +0xD1: 0Q== +0xD2: 0g== +0xD3: 0w== +0xD4: 1A== +0xD5: 1Q== +0xD6: 1g== +0xD7: 1w== +0xD8: 2A== +0xD9: 2Q== +0xDA: 2g== +0xDB: 2w== +0xDC: 3A== +0xDD: 3Q== +0xDE: 3g== +0xDF: 3w== +0xE0: 4A== +0xE1: 4Q== +0xE2: 4g== +0xE3: 4w== +0xE4: 5A== +0xE5: 5Q== +0xE6: 5g== +0xE7: 5w== +0xE8: 6A== +0xE9: 6Q== +0xEA: 6g== +0xEB: 6w== +0xEC: 7A== +0xED: 7Q== +0xEE: 7g== +0xEF: 7w== +0xF0: 8A== +0xF1: 8Q== +0xF2: 8g== +0xF3: 8w== +0xF4: 9A== +0xF5: 9Q== +0xF6: 9g== +0xF7: 9w== +0xF8: +A== +0xF9: +Q== +0xFA: +g== +0xFB: +w== +0xFC: /A== +0xFD: /Q== +0xFE: /g== +0xFF: /w== +Done diff --git a/ext/standard/tests/url/base64_encode_error_001.phpt b/ext/standard/tests/url/base64_encode_error_001.phpt new file mode 100644 index 0000000000..a8883ac8f9 --- /dev/null +++ b/ext/standard/tests/url/base64_encode_error_001.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test base64_encode() function : error conditions - wrong number of args +--FILE-- + +--EXPECTF-- +*** Testing base64_encode() : error conditions - wrong number of args *** + +-- Testing base64_encode() function with Zero arguments -- + +Warning: base64_encode() expects exactly 1 parameter, 0 given in %s on line 12 +NULL + +-- Testing base64_encode() function with more than expected no. of arguments -- + +Warning: base64_encode() expects exactly 1 parameter, 2 given in %s on line 18 +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/url/base64_encode_variation_001.phpt b/ext/standard/tests/url/base64_encode_variation_001.phpt new file mode 100644 index 0000000000..3fc1a7f549 --- /dev/null +++ b/ext/standard/tests/url/base64_encode_variation_001.phpt @@ -0,0 +1,266 @@ +--TEST-- +Test base64_encode() function : usage variations - unexpected types for argument 1 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for str + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( base64_encode($value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing base64_encode() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(63) +Error: 8 - Undefined variable: unset_var, %s(66) + +Arg value 0 +string(4) "MA==" + +Arg value 1 +string(4) "MQ==" + +Arg value 12345 +string(8) "MTIzNDU=" + +Arg value -2345 +string(8) "LTIzNDU=" + +Arg value 10.5 +string(8) "MTAuNQ==" + +Arg value -10.5 +string(8) "LTEwLjU=" + +Arg value 101234567000 +string(16) "MTAxMjM0NTY3MDAw" + +Arg value 1.07654321E-9 +string(20) "MS4wNzY1NDMyMUUtOQ==" + +Arg value 0.5 +string(4) "MC41" +Error: 8 - Array to string conversion, %s(72) + +Arg value Array +Error: 2 - base64_encode() expects parameter 1 to be string, array given, %s(73) +NULL +Error: 8 - Array to string conversion, %s(72) + +Arg value Array +Error: 2 - base64_encode() expects parameter 1 to be string, array given, %s(73) +NULL +Error: 8 - Array to string conversion, %s(72) + +Arg value Array +Error: 2 - base64_encode() expects parameter 1 to be string, array given, %s(73) +NULL +Error: 8 - Array to string conversion, %s(72) + +Arg value Array +Error: 2 - base64_encode() expects parameter 1 to be string, array given, %s(73) +NULL +Error: 8 - Array to string conversion, %s(72) + +Arg value Array +Error: 2 - base64_encode() expects parameter 1 to be string, array given, %s(73) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(4) "MQ==" + +Arg value +string(0) "" + +Arg value 1 +string(4) "MQ==" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value +string(0) "" +Error: 4096 - Object of class stdClass could not be converted to string, %s(72) + +Arg value +Error: 2 - base64_encode() expects parameter 1 to be string, object given, %s(73) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" +Done +--UEXPECTF-- +*** Testing base64_encode() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(63) +Error: 8 - Undefined variable: unset_var, %s(66) + +Arg value 0 +string(4) "MA==" + +Arg value 1 +string(4) "MQ==" + +Arg value 12345 +string(8) "MTIzNDU=" + +Arg value -2345 +string(8) "LTIzNDU=" + +Arg value 10.5 +string(8) "MTAuNQ==" + +Arg value -10.5 +string(8) "LTEwLjU=" + +Arg value 101234567000 +string(16) "MTAxMjM0NTY3MDAw" + +Arg value 1.07654321E-9 +string(20) "MS4wNzY1NDMyMUUtOQ==" + +Arg value 0.5 +string(4) "MC41" +Error: 8 - Array to string conversion, %s(72) + +Arg value Array +Error: 2 - base64_encode() expects parameter 1 to be binary string, array given, %s(73) +NULL +Error: 8 - Array to string conversion, %s(72) + +Arg value Array +Error: 2 - base64_encode() expects parameter 1 to be binary string, array given, %s(73) +NULL +Error: 8 - Array to string conversion, %s(72) + +Arg value Array +Error: 2 - base64_encode() expects parameter 1 to be binary string, array given, %s(73) +NULL +Error: 8 - Array to string conversion, %s(72) + +Arg value Array +Error: 2 - base64_encode() expects parameter 1 to be binary string, array given, %s(73) +NULL +Error: 8 - Array to string conversion, %s(72) + +Arg value Array +Error: 2 - base64_encode() expects parameter 1 to be binary string, array given, %s(73) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(4) "MQ==" + +Arg value +string(0) "" + +Arg value 1 +string(4) "MQ==" + +Arg value +string(0) "" + +Arg value +Error: 2 - base64_encode() expects parameter 1 to be strictly a binary string, Unicode string given, %s(73) +NULL + +Arg value +Error: 2 - base64_encode() expects parameter 1 to be strictly a binary string, Unicode string given, %s(73) +NULL +Error: 4096 - Object of class stdClass could not be converted to string, %s(72) + +Arg value +Error: 2 - base64_encode() expects parameter 1 to be binary string, object given, %s(73) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" +Done diff --git a/ext/standard/tests/url/parse_url_basic_001.phpt b/ext/standard/tests/url/parse_url_basic_001.phpt new file mode 100644 index 0000000000..78a751f81f --- /dev/null +++ b/ext/standard/tests/url/parse_url_basic_001.phpt @@ -0,0 +1,1776 @@ +--TEST-- +Test parse_url() function: Parse a load of URLs without specifying the component +--FILE-- + $url: "; + var_dump(parse_url($url)); +} + +echo "Done"; +?> +--EXPECTF-- + +--> 64.246.30.37: array(1) { + ["path"]=> + string(12) "64.246.30.37" +} + +--> http://64.246.30.37: array(2) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(12) "64.246.30.37" +} + +--> http://64.246.30.37/: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(12) "64.246.30.37" + ["path"]=> + string(1) "/" +} + +--> 64.246.30.37/: array(1) { + ["path"]=> + string(13) "64.246.30.37/" +} + +--> 64.246.30.37:80/: array(3) { + ["host"]=> + string(12) "64.246.30.37" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" +} + +--> php.net: array(1) { + ["path"]=> + string(7) "php.net" +} + +--> php.net/: array(1) { + ["path"]=> + string(8) "php.net/" +} + +--> http://php.net: array(2) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(7) "php.net" +} + +--> http://php.net/: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(7) "php.net" + ["path"]=> + string(1) "/" +} + +--> www.php.net: array(1) { + ["path"]=> + string(11) "www.php.net" +} + +--> www.php.net/: array(1) { + ["path"]=> + string(12) "www.php.net/" +} + +--> http://www.php.net: array(2) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" +} + +--> http://www.php.net/: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(1) "/" +} + +--> www.php.net:80: array(2) { + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) +} + +--> http://www.php.net:80: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) +} + +--> http://www.php.net:80/: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" +} + +--> http://www.php.net/index.php: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(10) "/index.php" +} + +--> www.php.net/?: array(1) { + ["path"]=> + string(12) "www.php.net/" +} + +--> www.php.net:80/?: array(3) { + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" +} + +--> http://www.php.net/?: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(1) "/" +} + +--> http://www.php.net:80/?: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" +} + +--> http://www.php.net:80/index.php: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" +} + +--> http://www.php.net:80/foo/bar/index.php: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(18) "/foo/bar/index.php" +} + +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(53) "/this/is/a/very/deep/directory/structure/and/file.php" +} + +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5: array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(53) "/this/is/a/very/deep/directory/structure/and/file.php" + ["query"]=> + string(37) "lots=1&of=2¶meters=3&too=4&here=5" +} + +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(45) "/this/is/a/very/deep/directory/structure/and/" +} + +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(53) "/this/is/a/very/deep/directory/structure/and/file.php" +} + +--> http://www.php.net:80/this/../a/../deep/directory: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(28) "/this/../a/../deep/directory" +} + +--> http://www.php.net:80/this/../a/../deep/directory/: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(29) "/this/../a/../deep/directory/" +} + +--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(42) "/this/is/a/very/deep/directory/../file.php" +} + +--> http://www.php.net:80/index.php: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" +} + +--> http://www.php.net:80/index.php?: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" +} + +--> http://www.php.net:80/#foo: array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" + ["fragment"]=> + string(3) "foo" +} + +--> http://www.php.net:80/?#: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" +} + +--> http://www.php.net:80/?test=1: array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" + ["query"]=> + string(6) "test=1" +} + +--> http://www.php.net/?test=1&: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(1) "/" + ["query"]=> + string(7) "test=1&" +} + +--> http://www.php.net:80/?&: array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" + ["query"]=> + string(1) "&" +} + +--> http://www.php.net:80/index.php?test=1&: array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(7) "test=1&" +} + +--> http://www.php.net/index.php?&: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(1) "&" +} + +--> http://www.php.net:80/index.php?foo&: array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(4) "foo&" +} + +--> http://www.php.net/index.php?&foo: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(4) "&foo" +} + +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI: array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" +} + +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(5) { + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["user"]=> + string(6) "secret" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(6) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["user"]=> + string(6) "secret" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["pass"]=> + string(7) "hideout" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["user"]=> + string(6) "secret" + ["pass"]=> + string(7) "hideout" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["user"]=> + string(14) "secret@hideout" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(8) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["user"]=> + string(6) "secret" + ["pass"]=> + string(7) "hid:out" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +--> nntp://news.php.net: array(2) { + ["scheme"]=> + string(4) "nntp" + ["host"]=> + string(12) "news.php.net" +} + +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz: array(3) { + ["scheme"]=> + string(3) "ftp" + ["host"]=> + string(11) "ftp.gnu.org" + ["path"]=> + string(22) "/gnu/glic/glibc.tar.gz" +} + +--> zlib:http://foo@bar: array(2) { + ["scheme"]=> + string(4) "zlib" + ["path"]=> + string(14) "http://foo@bar" +} + +--> zlib:filename.txt: array(2) { + ["scheme"]=> + string(4) "zlib" + ["path"]=> + string(12) "filename.txt" +} + +--> zlib:/path/to/my/file/file.txt: array(2) { + ["scheme"]=> + string(4) "zlib" + ["path"]=> + string(25) "/path/to/my/file/file.txt" +} + +--> foo://foo@bar: array(3) { + ["scheme"]=> + string(3) "foo" + ["host"]=> + string(3) "bar" + ["user"]=> + string(3) "foo" +} + +--> mailto:me@mydomain.com: array(2) { + ["scheme"]=> + string(6) "mailto" + ["path"]=> + string(15) "me@mydomain.com" +} + +--> /foo.php?a=b&c=d: array(2) { + ["path"]=> + string(8) "/foo.php" + ["query"]=> + string(7) "a=b&c=d" +} + +--> foo.php?a=b&c=d: array(2) { + ["path"]=> + string(7) "foo.php" + ["query"]=> + string(7) "a=b&c=d" +} + +--> http://user:passwd@www.example.com:8080?bar=1&boom=0: array(6) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(15) "www.example.com" + ["port"]=> + int(8080) + ["user"]=> + string(4) "user" + ["pass"]=> + string(6) "passwd" + ["query"]=> + string(12) "bar=1&boom=0" +} + +--> file:///path/to/file: array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(13) "/path/to/file" +} + +--> file://path/to/file: array(3) { + ["scheme"]=> + string(4) "file" + ["host"]=> + string(4) "path" + ["path"]=> + string(8) "/to/file" +} + +--> file:/path/to/file: array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(13) "/path/to/file" +} + +--> http://1.2.3.4:/abc.asp?a=1&b=2: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(7) "1.2.3.4" + ["path"]=> + string(8) "/abc.asp" + ["query"]=> + string(7) "a=1&b=2" +} + +--> http://foo.com#bar: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(7) "foo.com" + ["fragment"]=> + string(3) "bar" +} + +--> scheme:: array(1) { + ["scheme"]=> + string(6) "scheme" +} + +--> foo+bar://baz@bang/bla: array(4) { + ["scheme"]=> + string(7) "foo+bar" + ["host"]=> + string(4) "bang" + ["user"]=> + string(3) "baz" + ["path"]=> + string(4) "/bla" +} + +--> gg:9130731: array(2) { + ["scheme"]=> + string(2) "gg" + ["path"]=> + string(7) "9130731" +} + +--> http://user:@pass@host/path?argument?value#etc: array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(4) "host" + ["user"]=> + string(4) "user" + ["pass"]=> + string(5) "@pass" + ["path"]=> + string(5) "/path" + ["query"]=> + string(14) "argument?value" + ["fragment"]=> + string(3) "etc" +} + +--> http://10.10.10.10/:80: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "10.10.10.10" + ["path"]=> + string(4) "/:80" +} + +--> http://x:?: array(2) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(1) "x" +} + +--> x:blah.com: array(2) { + ["scheme"]=> + string(1) "x" + ["path"]=> + string(8) "blah.com" +} + +--> x:/blah.com: array(2) { + ["scheme"]=> + string(1) "x" + ["path"]=> + string(9) "/blah.com" +} + +--> x://::abc/?: array(3) { + ["scheme"]=> + string(1) "x" + ["host"]=> + string(1) ":" + ["path"]=> + string(1) "/" +} + +--> http://::?: array(2) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(1) ":" +} + +--> x://::6.5: array(3) { + ["scheme"]=> + string(1) "x" + ["host"]=> + string(1) ":" + ["port"]=> + int(6) +} + +--> http://?:/: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(1) "?" + ["path"]=> + string(1) "/" +} + +--> http://@?:/: array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(1) "?" + ["user"]=> + string(0) "" + ["path"]=> + string(1) "/" +} + +--> file:///:: array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(2) "/:" +} + +--> file:///a:/: array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(3) "a:/" +} + +--> file:///ab:/: array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(5) "/ab:/" +} + +--> file:///a:/: array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(3) "a:/" +} + +--> file:///@:/: array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(3) "@:/" +} + +--> file:///:80/: array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(5) "/:80/" +} + +--> []: array(1) { + ["path"]=> + string(2) "[]" +} + +--> http://[x:80]/: array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(6) "[x:80]" + ["path"]=> + string(1) "/" +} + +--> : array(1) { + ["path"]=> + string(0) "" +} + +--> /: array(1) { + ["path"]=> + string(1) "/" +} + +--> http:///blah.com: +Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 +bool(false) + +--> http://:80: +Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 +bool(false) + +--> http://user@:80: +Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 +bool(false) + +--> http://user:pass@:80: +Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 +bool(false) + +--> http://:: +Warning: parse_url(http://:): Unable to parse URL in %s on line 15 +bool(false) + +--> http://@/: +Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 +bool(false) + +--> http://@:/: +Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 +bool(false) + +--> http://:/: +Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 +bool(false) + +--> http://?: +Warning: parse_url(http://?): Unable to parse URL in %s on line 15 +bool(false) + +--> http://?:: +Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 +bool(false) + +--> http://:?: +Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 +bool(false) + +--> http://blah.com:123456: +Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 +bool(false) + +--> http://blah.com:abcdef: +Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 +bool(false) +Done +--UEXPECTF-- + +--> 64.246.30.37: array(1) { + [u"path"]=> + unicode(12) "64.246.30.37" +} + +--> http://64.246.30.37: array(2) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(12) "64.246.30.37" +} + +--> http://64.246.30.37/: array(3) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(12) "64.246.30.37" + [u"path"]=> + unicode(1) "/" +} + +--> 64.246.30.37/: array(1) { + [u"path"]=> + unicode(13) "64.246.30.37/" +} + +--> 64.246.30.37:80/: array(3) { + [u"host"]=> + unicode(12) "64.246.30.37" + [u"port"]=> + int(80) + [u"path"]=> + unicode(1) "/" +} + +--> php.net: array(1) { + [u"path"]=> + unicode(7) "php.net" +} + +--> php.net/: array(1) { + [u"path"]=> + unicode(8) "php.net/" +} + +--> http://php.net: array(2) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(7) "php.net" +} + +--> http://php.net/: array(3) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(7) "php.net" + [u"path"]=> + unicode(1) "/" +} + +--> www.php.net: array(1) { + [u"path"]=> + unicode(11) "www.php.net" +} + +--> www.php.net/: array(1) { + [u"path"]=> + unicode(12) "www.php.net/" +} + +--> http://www.php.net: array(2) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" +} + +--> http://www.php.net/: array(3) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"path"]=> + unicode(1) "/" +} + +--> www.php.net:80: array(2) { + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) +} + +--> http://www.php.net:80: array(3) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) +} + +--> http://www.php.net:80/: array(4) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"path"]=> + unicode(1) "/" +} + +--> http://www.php.net/index.php: array(3) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"path"]=> + unicode(10) "/index.php" +} + +--> www.php.net/?: array(1) { + [u"path"]=> + unicode(12) "www.php.net/" +} + +--> www.php.net:80/?: array(3) { + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"path"]=> + unicode(1) "/" +} + +--> http://www.php.net/?: array(3) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"path"]=> + unicode(1) "/" +} + +--> http://www.php.net:80/?: array(4) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"path"]=> + unicode(1) "/" +} + +--> http://www.php.net:80/index.php: array(4) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"path"]=> + unicode(10) "/index.php" +} + +--> http://www.php.net:80/foo/bar/index.php: array(4) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"path"]=> + unicode(18) "/foo/bar/index.php" +} + +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php: array(4) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"path"]=> + unicode(53) "/this/is/a/very/deep/directory/structure/and/file.php" +} + +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5: array(5) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"path"]=> + unicode(53) "/this/is/a/very/deep/directory/structure/and/file.php" + [u"query"]=> + unicode(37) "lots=1&of=2¶meters=3&too=4&here=5" +} + +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/: array(4) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"path"]=> + unicode(45) "/this/is/a/very/deep/directory/structure/and/" +} + +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php: array(4) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"path"]=> + unicode(53) "/this/is/a/very/deep/directory/structure/and/file.php" +} + +--> http://www.php.net:80/this/../a/../deep/directory: array(4) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"path"]=> + unicode(28) "/this/../a/../deep/directory" +} + +--> http://www.php.net:80/this/../a/../deep/directory/: array(4) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"path"]=> + unicode(29) "/this/../a/../deep/directory/" +} + +--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php: array(4) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"path"]=> + unicode(42) "/this/is/a/very/deep/directory/../file.php" +} + +--> http://www.php.net:80/index.php: array(4) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"path"]=> + unicode(10) "/index.php" +} + +--> http://www.php.net:80/index.php?: array(4) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"path"]=> + unicode(10) "/index.php" +} + +--> http://www.php.net:80/#foo: array(5) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"path"]=> + unicode(1) "/" + [u"fragment"]=> + unicode(3) "foo" +} + +--> http://www.php.net:80/?#: array(4) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"path"]=> + unicode(1) "/" +} + +--> http://www.php.net:80/?test=1: array(5) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"path"]=> + unicode(1) "/" + [u"query"]=> + unicode(6) "test=1" +} + +--> http://www.php.net/?test=1&: array(4) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"path"]=> + unicode(1) "/" + [u"query"]=> + unicode(7) "test=1&" +} + +--> http://www.php.net:80/?&: array(5) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"path"]=> + unicode(1) "/" + [u"query"]=> + unicode(1) "&" +} + +--> http://www.php.net:80/index.php?test=1&: array(5) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"path"]=> + unicode(10) "/index.php" + [u"query"]=> + unicode(7) "test=1&" +} + +--> http://www.php.net/index.php?&: array(4) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"path"]=> + unicode(10) "/index.php" + [u"query"]=> + unicode(1) "&" +} + +--> http://www.php.net:80/index.php?foo&: array(5) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"path"]=> + unicode(10) "/index.php" + [u"query"]=> + unicode(4) "foo&" +} + +--> http://www.php.net/index.php?&foo: array(4) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"path"]=> + unicode(10) "/index.php" + [u"query"]=> + unicode(4) "&foo" +} + +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI: array(5) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"path"]=> + unicode(10) "/index.php" + [u"query"]=> + unicode(31) "test=1&test2=char&test3=mixesCI" +} + +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(5) { + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"path"]=> + unicode(10) "/index.php" + [u"query"]=> + unicode(31) "test=1&test2=char&test3=mixesCI" + [u"fragment"]=> + unicode(16) "some_page_ref123" +} + +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"user"]=> + unicode(6) "secret" + [u"path"]=> + unicode(10) "/index.php" + [u"query"]=> + unicode(31) "test=1&test2=char&test3=mixesCI" + [u"fragment"]=> + unicode(16) "some_page_ref123" +} + +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(6) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"user"]=> + unicode(6) "secret" + [u"path"]=> + unicode(10) "/index.php" + [u"query"]=> + unicode(31) "test=1&test2=char&test3=mixesCI" + [u"fragment"]=> + unicode(16) "some_page_ref123" +} + +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"pass"]=> + unicode(7) "hideout" + [u"path"]=> + unicode(10) "/index.php" + [u"query"]=> + unicode(31) "test=1&test2=char&test3=mixesCI" + [u"fragment"]=> + unicode(16) "some_page_ref123" +} + +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"user"]=> + unicode(6) "secret" + [u"pass"]=> + unicode(7) "hideout" + [u"path"]=> + unicode(10) "/index.php" + [u"query"]=> + unicode(31) "test=1&test2=char&test3=mixesCI" + [u"fragment"]=> + unicode(16) "some_page_ref123" +} + +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"user"]=> + unicode(14) "secret@hideout" + [u"path"]=> + unicode(10) "/index.php" + [u"query"]=> + unicode(31) "test=1&test2=char&test3=mixesCI" + [u"fragment"]=> + unicode(16) "some_page_ref123" +} + +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(8) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"user"]=> + unicode(6) "secret" + [u"pass"]=> + unicode(7) "hid:out" + [u"path"]=> + unicode(10) "/index.php" + [u"query"]=> + unicode(31) "test=1&test2=char&test3=mixesCI" + [u"fragment"]=> + unicode(16) "some_page_ref123" +} + +--> nntp://news.php.net: array(2) { + [u"scheme"]=> + unicode(4) "nntp" + [u"host"]=> + unicode(12) "news.php.net" +} + +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz: array(3) { + [u"scheme"]=> + unicode(3) "ftp" + [u"host"]=> + unicode(11) "ftp.gnu.org" + [u"path"]=> + unicode(22) "/gnu/glic/glibc.tar.gz" +} + +--> zlib:http://foo@bar: array(2) { + [u"scheme"]=> + unicode(4) "zlib" + [u"path"]=> + unicode(14) "http://foo@bar" +} + +--> zlib:filename.txt: array(2) { + [u"scheme"]=> + unicode(4) "zlib" + [u"path"]=> + unicode(12) "filename.txt" +} + +--> zlib:/path/to/my/file/file.txt: array(2) { + [u"scheme"]=> + unicode(4) "zlib" + [u"path"]=> + unicode(25) "/path/to/my/file/file.txt" +} + +--> foo://foo@bar: array(3) { + [u"scheme"]=> + unicode(3) "foo" + [u"host"]=> + unicode(3) "bar" + [u"user"]=> + unicode(3) "foo" +} + +--> mailto:me@mydomain.com: array(2) { + [u"scheme"]=> + unicode(6) "mailto" + [u"path"]=> + unicode(15) "me@mydomain.com" +} + +--> /foo.php?a=b&c=d: array(2) { + [u"path"]=> + unicode(8) "/foo.php" + [u"query"]=> + unicode(7) "a=b&c=d" +} + +--> foo.php?a=b&c=d: array(2) { + [u"path"]=> + unicode(7) "foo.php" + [u"query"]=> + unicode(7) "a=b&c=d" +} + +--> http://user:passwd@www.example.com:8080?bar=1&boom=0: array(6) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(15) "www.example.com" + [u"port"]=> + int(8080) + [u"user"]=> + unicode(4) "user" + [u"pass"]=> + unicode(6) "passwd" + [u"query"]=> + unicode(12) "bar=1&boom=0" +} + +--> file:///path/to/file: array(2) { + [u"scheme"]=> + unicode(4) "file" + [u"path"]=> + unicode(13) "/path/to/file" +} + +--> file://path/to/file: array(3) { + [u"scheme"]=> + unicode(4) "file" + [u"host"]=> + unicode(4) "path" + [u"path"]=> + unicode(8) "/to/file" +} + +--> file:/path/to/file: array(2) { + [u"scheme"]=> + unicode(4) "file" + [u"path"]=> + unicode(13) "/path/to/file" +} + +--> http://1.2.3.4:/abc.asp?a=1&b=2: array(4) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(7) "1.2.3.4" + [u"path"]=> + unicode(8) "/abc.asp" + [u"query"]=> + unicode(7) "a=1&b=2" +} + +--> http://foo.com#bar: array(3) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(7) "foo.com" + [u"fragment"]=> + unicode(3) "bar" +} + +--> scheme:: array(1) { + [u"scheme"]=> + unicode(6) "scheme" +} + +--> foo+bar://baz@bang/bla: array(4) { + [u"scheme"]=> + unicode(7) "foo+bar" + [u"host"]=> + unicode(4) "bang" + [u"user"]=> + unicode(3) "baz" + [u"path"]=> + unicode(4) "/bla" +} + +--> gg:9130731: array(2) { + [u"scheme"]=> + unicode(2) "gg" + [u"path"]=> + unicode(7) "9130731" +} + +--> http://user:@pass@host/path?argument?value#etc: array(7) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(4) "host" + [u"user"]=> + unicode(4) "user" + [u"pass"]=> + unicode(5) "@pass" + [u"path"]=> + unicode(5) "/path" + [u"query"]=> + unicode(14) "argument?value" + [u"fragment"]=> + unicode(3) "etc" +} + +--> http://10.10.10.10/:80: array(3) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "10.10.10.10" + [u"path"]=> + unicode(4) "/:80" +} + +--> http://x:?: array(2) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(1) "x" +} + +--> x:blah.com: array(2) { + [u"scheme"]=> + unicode(1) "x" + [u"path"]=> + unicode(8) "blah.com" +} + +--> x:/blah.com: array(2) { + [u"scheme"]=> + unicode(1) "x" + [u"path"]=> + unicode(9) "/blah.com" +} + +--> x://::abc/?: array(3) { + [u"scheme"]=> + unicode(1) "x" + [u"host"]=> + unicode(1) ":" + [u"path"]=> + unicode(1) "/" +} + +--> http://::?: array(2) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(1) ":" +} + +--> x://::6.5: array(3) { + [u"scheme"]=> + unicode(1) "x" + [u"host"]=> + unicode(1) ":" + [u"port"]=> + int(6) +} + +--> http://?:/: array(3) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(1) "?" + [u"path"]=> + unicode(1) "/" +} + +--> http://@?:/: array(4) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(1) "?" + [u"user"]=> + unicode(0) "" + [u"path"]=> + unicode(1) "/" +} + +--> file:///:: array(2) { + [u"scheme"]=> + unicode(4) "file" + [u"path"]=> + unicode(2) "/:" +} + +--> file:///a:/: array(2) { + [u"scheme"]=> + unicode(4) "file" + [u"path"]=> + unicode(3) "a:/" +} + +--> file:///ab:/: array(2) { + [u"scheme"]=> + unicode(4) "file" + [u"path"]=> + unicode(5) "/ab:/" +} + +--> file:///a:/: array(2) { + [u"scheme"]=> + unicode(4) "file" + [u"path"]=> + unicode(3) "a:/" +} + +--> file:///@:/: array(2) { + [u"scheme"]=> + unicode(4) "file" + [u"path"]=> + unicode(3) "@:/" +} + +--> file:///:80/: array(2) { + [u"scheme"]=> + unicode(4) "file" + [u"path"]=> + unicode(5) "/:80/" +} + +--> []: array(1) { + [u"path"]=> + unicode(2) "[]" +} + +--> http://[x:80]/: array(3) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(6) "[x:80]" + [u"path"]=> + unicode(1) "/" +} + +--> : array(1) { + [u"path"]=> + unicode(0) "" +} + +--> /: array(1) { + [u"path"]=> + unicode(1) "/" +} + +--> http:///blah.com: +Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 +bool(false) + +--> http://:80: +Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 +bool(false) + +--> http://user@:80: +Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 +bool(false) + +--> http://user:pass@:80: +Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 +bool(false) + +--> http://:: +Warning: parse_url(http://:): Unable to parse URL in %s on line 15 +bool(false) + +--> http://@/: +Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 +bool(false) + +--> http://@:/: +Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 +bool(false) + +--> http://:/: +Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 +bool(false) + +--> http://?: +Warning: parse_url(http://?): Unable to parse URL in %s on line 15 +bool(false) + +--> http://?:: +Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 +bool(false) + +--> http://:?: +Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 +bool(false) + +--> http://blah.com:123456: +Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 +bool(false) + +--> http://blah.com:abcdef: +Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_002.phpt b/ext/standard/tests/url/parse_url_basic_002.phpt new file mode 100644 index 0000000000..26c4404fc8 --- /dev/null +++ b/ext/standard/tests/url/parse_url_basic_002.phpt @@ -0,0 +1,279 @@ +--TEST-- +Test parse_url() function: Parse a load of URLs without specifying PHP_URL_SCHEME as the URL component +--FILE-- + $url : "; + var_dump(parse_url($url, PHP_URL_SCHEME)); + +} + +echo "Done"; +?> +--EXPECTF-- +--> 64.246.30.37 : NULL +--> http://64.246.30.37 : string(4) "http" +--> http://64.246.30.37/ : string(4) "http" +--> 64.246.30.37/ : NULL +--> 64.246.30.37:80/ : NULL +--> php.net : NULL +--> php.net/ : NULL +--> http://php.net : string(4) "http" +--> http://php.net/ : string(4) "http" +--> www.php.net : NULL +--> www.php.net/ : NULL +--> http://www.php.net : string(4) "http" +--> http://www.php.net/ : string(4) "http" +--> www.php.net:80 : NULL +--> http://www.php.net:80 : string(4) "http" +--> http://www.php.net:80/ : string(4) "http" +--> http://www.php.net/index.php : string(4) "http" +--> www.php.net/? : NULL +--> www.php.net:80/? : NULL +--> http://www.php.net/? : string(4) "http" +--> http://www.php.net:80/? : string(4) "http" +--> http://www.php.net:80/index.php : string(4) "http" +--> http://www.php.net:80/foo/bar/index.php : string(4) "http" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : string(4) "http" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : string(4) "http" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : string(4) "http" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : string(4) "http" +--> http://www.php.net:80/this/../a/../deep/directory : string(4) "http" +--> http://www.php.net:80/this/../a/../deep/directory/ : string(4) "http" +--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : string(4) "http" +--> http://www.php.net:80/index.php : string(4) "http" +--> http://www.php.net:80/index.php? : string(4) "http" +--> http://www.php.net:80/#foo : string(4) "http" +--> http://www.php.net:80/?# : string(4) "http" +--> http://www.php.net:80/?test=1 : string(4) "http" +--> http://www.php.net/?test=1& : string(4) "http" +--> http://www.php.net:80/?& : string(4) "http" +--> http://www.php.net:80/index.php?test=1& : string(4) "http" +--> http://www.php.net/index.php?& : string(4) "http" +--> http://www.php.net:80/index.php?foo& : string(4) "http" +--> http://www.php.net/index.php?&foo : string(4) "http" +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : string(4) "http" +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http" +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http" +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http" +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http" +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http" +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http" +--> nntp://news.php.net : string(4) "nntp" +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : string(3) "ftp" +--> zlib:http://foo@bar : string(4) "zlib" +--> zlib:filename.txt : string(4) "zlib" +--> zlib:/path/to/my/file/file.txt : string(4) "zlib" +--> foo://foo@bar : string(3) "foo" +--> mailto:me@mydomain.com : string(6) "mailto" +--> /foo.php?a=b&c=d : NULL +--> foo.php?a=b&c=d : NULL +--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : string(4) "http" +--> file:///path/to/file : string(4) "file" +--> file://path/to/file : string(4) "file" +--> file:/path/to/file : string(4) "file" +--> http://1.2.3.4:/abc.asp?a=1&b=2 : string(4) "http" +--> http://foo.com#bar : string(4) "http" +--> scheme: : string(6) "scheme" +--> foo+bar://baz@bang/bla : string(7) "foo+bar" +--> gg:9130731 : string(2) "gg" +--> http://user:@pass@host/path?argument?value#etc : string(4) "http" +--> http://10.10.10.10/:80 : string(4) "http" +--> http://x:? : string(4) "http" +--> x:blah.com : string(1) "x" +--> x:/blah.com : string(1) "x" +--> x://::abc/? : string(1) "x" +--> http://::? : string(4) "http" +--> x://::6.5 : string(1) "x" +--> http://?:/ : string(4) "http" +--> http://@?:/ : string(4) "http" +--> file:///: : string(4) "file" +--> file:///a:/ : string(4) "file" +--> file:///ab:/ : string(4) "file" +--> file:///a:/ : string(4) "file" +--> file:///@:/ : string(4) "file" +--> file:///:80/ : string(4) "file" +--> [] : NULL +--> http://[x:80]/ : string(4) "http" +--> : NULL +--> / : NULL +--> http:///blah.com : +Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 +bool(false) +--> http://:80 : +Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user@:80 : +Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user:pass@:80 : +Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://: : +Warning: parse_url(http://:): Unable to parse URL in %s on line 15 +bool(false) +--> http://@/ : +Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 +bool(false) +--> http://@:/ : +Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://:/ : +Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://? : +Warning: parse_url(http://?): Unable to parse URL in %s on line 15 +bool(false) +--> http://?: : +Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 +bool(false) +--> http://:? : +Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:123456 : +Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:abcdef : +Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 +bool(false) +Done +--UEXPECTF-- +--> 64.246.30.37 : NULL +--> http://64.246.30.37 : unicode(4) "http" +--> http://64.246.30.37/ : unicode(4) "http" +--> 64.246.30.37/ : NULL +--> 64.246.30.37:80/ : NULL +--> php.net : NULL +--> php.net/ : NULL +--> http://php.net : unicode(4) "http" +--> http://php.net/ : unicode(4) "http" +--> www.php.net : NULL +--> www.php.net/ : NULL +--> http://www.php.net : unicode(4) "http" +--> http://www.php.net/ : unicode(4) "http" +--> www.php.net:80 : NULL +--> http://www.php.net:80 : unicode(4) "http" +--> http://www.php.net:80/ : unicode(4) "http" +--> http://www.php.net/index.php : unicode(4) "http" +--> www.php.net/? : NULL +--> www.php.net:80/? : NULL +--> http://www.php.net/? : unicode(4) "http" +--> http://www.php.net:80/? : unicode(4) "http" +--> http://www.php.net:80/index.php : unicode(4) "http" +--> http://www.php.net:80/foo/bar/index.php : unicode(4) "http" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : unicode(4) "http" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : unicode(4) "http" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : unicode(4) "http" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : unicode(4) "http" +--> http://www.php.net:80/this/../a/../deep/directory : unicode(4) "http" +--> http://www.php.net:80/this/../a/../deep/directory/ : unicode(4) "http" +--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : unicode(4) "http" +--> http://www.php.net:80/index.php : unicode(4) "http" +--> http://www.php.net:80/index.php? : unicode(4) "http" +--> http://www.php.net:80/#foo : unicode(4) "http" +--> http://www.php.net:80/?# : unicode(4) "http" +--> http://www.php.net:80/?test=1 : unicode(4) "http" +--> http://www.php.net/?test=1& : unicode(4) "http" +--> http://www.php.net:80/?& : unicode(4) "http" +--> http://www.php.net:80/index.php?test=1& : unicode(4) "http" +--> http://www.php.net/index.php?& : unicode(4) "http" +--> http://www.php.net:80/index.php?foo& : unicode(4) "http" +--> http://www.php.net/index.php?&foo : unicode(4) "http" +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : unicode(4) "http" +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(4) "http" +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(4) "http" +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(4) "http" +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(4) "http" +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(4) "http" +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(4) "http" +--> nntp://news.php.net : unicode(4) "nntp" +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : unicode(3) "ftp" +--> zlib:http://foo@bar : unicode(4) "zlib" +--> zlib:filename.txt : unicode(4) "zlib" +--> zlib:/path/to/my/file/file.txt : unicode(4) "zlib" +--> foo://foo@bar : unicode(3) "foo" +--> mailto:me@mydomain.com : unicode(6) "mailto" +--> /foo.php?a=b&c=d : NULL +--> foo.php?a=b&c=d : NULL +--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : unicode(4) "http" +--> file:///path/to/file : unicode(4) "file" +--> file://path/to/file : unicode(4) "file" +--> file:/path/to/file : unicode(4) "file" +--> http://1.2.3.4:/abc.asp?a=1&b=2 : unicode(4) "http" +--> http://foo.com#bar : unicode(4) "http" +--> scheme: : unicode(6) "scheme" +--> foo+bar://baz@bang/bla : unicode(7) "foo+bar" +--> gg:9130731 : unicode(2) "gg" +--> http://user:@pass@host/path?argument?value#etc : unicode(4) "http" +--> http://10.10.10.10/:80 : unicode(4) "http" +--> http://x:? : unicode(4) "http" +--> x:blah.com : unicode(1) "x" +--> x:/blah.com : unicode(1) "x" +--> x://::abc/? : unicode(1) "x" +--> http://::? : unicode(4) "http" +--> x://::6.5 : unicode(1) "x" +--> http://?:/ : unicode(4) "http" +--> http://@?:/ : unicode(4) "http" +--> file:///: : unicode(4) "file" +--> file:///a:/ : unicode(4) "file" +--> file:///ab:/ : unicode(4) "file" +--> file:///a:/ : unicode(4) "file" +--> file:///@:/ : unicode(4) "file" +--> file:///:80/ : unicode(4) "file" +--> [] : NULL +--> http://[x:80]/ : unicode(4) "http" +--> : NULL +--> / : NULL +--> http:///blah.com : +Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 +bool(false) +--> http://:80 : +Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user@:80 : +Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user:pass@:80 : +Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://: : +Warning: parse_url(http://:): Unable to parse URL in %s on line 15 +bool(false) +--> http://@/ : +Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 +bool(false) +--> http://@:/ : +Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://:/ : +Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://? : +Warning: parse_url(http://?): Unable to parse URL in %s on line 15 +bool(false) +--> http://?: : +Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 +bool(false) +--> http://:? : +Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:123456 : +Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:abcdef : +Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_003.phpt b/ext/standard/tests/url/parse_url_basic_003.phpt new file mode 100644 index 0000000000..0bb3e9e141 --- /dev/null +++ b/ext/standard/tests/url/parse_url_basic_003.phpt @@ -0,0 +1,278 @@ +--TEST-- +Test parse_url() function: Parse a load of URLs without specifying PHP_URL_HOST as the URL component +--FILE-- + $url : "; + var_dump(parse_url($url, PHP_URL_HOST)); +} + +echo "Done"; +?> +--EXPECTF-- +--> 64.246.30.37 : NULL +--> http://64.246.30.37 : string(12) "64.246.30.37" +--> http://64.246.30.37/ : string(12) "64.246.30.37" +--> 64.246.30.37/ : NULL +--> 64.246.30.37:80/ : string(12) "64.246.30.37" +--> php.net : NULL +--> php.net/ : NULL +--> http://php.net : string(7) "php.net" +--> http://php.net/ : string(7) "php.net" +--> www.php.net : NULL +--> www.php.net/ : NULL +--> http://www.php.net : string(11) "www.php.net" +--> http://www.php.net/ : string(11) "www.php.net" +--> www.php.net:80 : string(11) "www.php.net" +--> http://www.php.net:80 : string(11) "www.php.net" +--> http://www.php.net:80/ : string(11) "www.php.net" +--> http://www.php.net/index.php : string(11) "www.php.net" +--> www.php.net/? : NULL +--> www.php.net:80/? : string(11) "www.php.net" +--> http://www.php.net/? : string(11) "www.php.net" +--> http://www.php.net:80/? : string(11) "www.php.net" +--> http://www.php.net:80/index.php : string(11) "www.php.net" +--> http://www.php.net:80/foo/bar/index.php : string(11) "www.php.net" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : string(11) "www.php.net" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : string(11) "www.php.net" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : string(11) "www.php.net" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : string(11) "www.php.net" +--> http://www.php.net:80/this/../a/../deep/directory : string(11) "www.php.net" +--> http://www.php.net:80/this/../a/../deep/directory/ : string(11) "www.php.net" +--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : string(11) "www.php.net" +--> http://www.php.net:80/index.php : string(11) "www.php.net" +--> http://www.php.net:80/index.php? : string(11) "www.php.net" +--> http://www.php.net:80/#foo : string(11) "www.php.net" +--> http://www.php.net:80/?# : string(11) "www.php.net" +--> http://www.php.net:80/?test=1 : string(11) "www.php.net" +--> http://www.php.net/?test=1& : string(11) "www.php.net" +--> http://www.php.net:80/?& : string(11) "www.php.net" +--> http://www.php.net:80/index.php?test=1& : string(11) "www.php.net" +--> http://www.php.net/index.php?& : string(11) "www.php.net" +--> http://www.php.net:80/index.php?foo& : string(11) "www.php.net" +--> http://www.php.net/index.php?&foo : string(11) "www.php.net" +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : string(11) "www.php.net" +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net" +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net" +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net" +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net" +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net" +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net" +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net" +--> nntp://news.php.net : string(12) "news.php.net" +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : string(11) "ftp.gnu.org" +--> zlib:http://foo@bar : NULL +--> zlib:filename.txt : NULL +--> zlib:/path/to/my/file/file.txt : NULL +--> foo://foo@bar : string(3) "bar" +--> mailto:me@mydomain.com : NULL +--> /foo.php?a=b&c=d : NULL +--> foo.php?a=b&c=d : NULL +--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : string(15) "www.example.com" +--> file:///path/to/file : NULL +--> file://path/to/file : string(4) "path" +--> file:/path/to/file : NULL +--> http://1.2.3.4:/abc.asp?a=1&b=2 : string(7) "1.2.3.4" +--> http://foo.com#bar : string(7) "foo.com" +--> scheme: : NULL +--> foo+bar://baz@bang/bla : string(4) "bang" +--> gg:9130731 : NULL +--> http://user:@pass@host/path?argument?value#etc : string(4) "host" +--> http://10.10.10.10/:80 : string(11) "10.10.10.10" +--> http://x:? : string(1) "x" +--> x:blah.com : NULL +--> x:/blah.com : NULL +--> x://::abc/? : string(1) ":" +--> http://::? : string(1) ":" +--> x://::6.5 : string(1) ":" +--> http://?:/ : string(1) "?" +--> http://@?:/ : string(1) "?" +--> file:///: : NULL +--> file:///a:/ : NULL +--> file:///ab:/ : NULL +--> file:///a:/ : NULL +--> file:///@:/ : NULL +--> file:///:80/ : NULL +--> [] : NULL +--> http://[x:80]/ : string(6) "[x:80]" +--> : NULL +--> / : NULL +--> http:///blah.com : +Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 +bool(false) +--> http://:80 : +Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user@:80 : +Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user:pass@:80 : +Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://: : +Warning: parse_url(http://:): Unable to parse URL in %s on line 15 +bool(false) +--> http://@/ : +Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 +bool(false) +--> http://@:/ : +Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://:/ : +Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://? : +Warning: parse_url(http://?): Unable to parse URL in %s on line 15 +bool(false) +--> http://?: : +Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 +bool(false) +--> http://:? : +Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:123456 : +Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:abcdef : +Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 +bool(false) +Done +--UEXPECTF-- +--> 64.246.30.37 : NULL +--> http://64.246.30.37 : unicode(12) "64.246.30.37" +--> http://64.246.30.37/ : unicode(12) "64.246.30.37" +--> 64.246.30.37/ : NULL +--> 64.246.30.37:80/ : unicode(12) "64.246.30.37" +--> php.net : NULL +--> php.net/ : NULL +--> http://php.net : unicode(7) "php.net" +--> http://php.net/ : unicode(7) "php.net" +--> www.php.net : NULL +--> www.php.net/ : NULL +--> http://www.php.net : unicode(11) "www.php.net" +--> http://www.php.net/ : unicode(11) "www.php.net" +--> www.php.net:80 : unicode(11) "www.php.net" +--> http://www.php.net:80 : unicode(11) "www.php.net" +--> http://www.php.net:80/ : unicode(11) "www.php.net" +--> http://www.php.net/index.php : unicode(11) "www.php.net" +--> www.php.net/? : NULL +--> www.php.net:80/? : unicode(11) "www.php.net" +--> http://www.php.net/? : unicode(11) "www.php.net" +--> http://www.php.net:80/? : unicode(11) "www.php.net" +--> http://www.php.net:80/index.php : unicode(11) "www.php.net" +--> http://www.php.net:80/foo/bar/index.php : unicode(11) "www.php.net" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : unicode(11) "www.php.net" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : unicode(11) "www.php.net" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : unicode(11) "www.php.net" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : unicode(11) "www.php.net" +--> http://www.php.net:80/this/../a/../deep/directory : unicode(11) "www.php.net" +--> http://www.php.net:80/this/../a/../deep/directory/ : unicode(11) "www.php.net" +--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : unicode(11) "www.php.net" +--> http://www.php.net:80/index.php : unicode(11) "www.php.net" +--> http://www.php.net:80/index.php? : unicode(11) "www.php.net" +--> http://www.php.net:80/#foo : unicode(11) "www.php.net" +--> http://www.php.net:80/?# : unicode(11) "www.php.net" +--> http://www.php.net:80/?test=1 : unicode(11) "www.php.net" +--> http://www.php.net/?test=1& : unicode(11) "www.php.net" +--> http://www.php.net:80/?& : unicode(11) "www.php.net" +--> http://www.php.net:80/index.php?test=1& : unicode(11) "www.php.net" +--> http://www.php.net/index.php?& : unicode(11) "www.php.net" +--> http://www.php.net:80/index.php?foo& : unicode(11) "www.php.net" +--> http://www.php.net/index.php?&foo : unicode(11) "www.php.net" +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : unicode(11) "www.php.net" +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(11) "www.php.net" +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(11) "www.php.net" +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(11) "www.php.net" +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(11) "www.php.net" +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(11) "www.php.net" +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(11) "www.php.net" +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(11) "www.php.net" +--> nntp://news.php.net : unicode(12) "news.php.net" +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : unicode(11) "ftp.gnu.org" +--> zlib:http://foo@bar : NULL +--> zlib:filename.txt : NULL +--> zlib:/path/to/my/file/file.txt : NULL +--> foo://foo@bar : unicode(3) "bar" +--> mailto:me@mydomain.com : NULL +--> /foo.php?a=b&c=d : NULL +--> foo.php?a=b&c=d : NULL +--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : unicode(15) "www.example.com" +--> file:///path/to/file : NULL +--> file://path/to/file : unicode(4) "path" +--> file:/path/to/file : NULL +--> http://1.2.3.4:/abc.asp?a=1&b=2 : unicode(7) "1.2.3.4" +--> http://foo.com#bar : unicode(7) "foo.com" +--> scheme: : NULL +--> foo+bar://baz@bang/bla : unicode(4) "bang" +--> gg:9130731 : NULL +--> http://user:@pass@host/path?argument?value#etc : unicode(4) "host" +--> http://10.10.10.10/:80 : unicode(11) "10.10.10.10" +--> http://x:? : unicode(1) "x" +--> x:blah.com : NULL +--> x:/blah.com : NULL +--> x://::abc/? : unicode(1) ":" +--> http://::? : unicode(1) ":" +--> x://::6.5 : unicode(1) ":" +--> http://?:/ : unicode(1) "?" +--> http://@?:/ : unicode(1) "?" +--> file:///: : NULL +--> file:///a:/ : NULL +--> file:///ab:/ : NULL +--> file:///a:/ : NULL +--> file:///@:/ : NULL +--> file:///:80/ : NULL +--> [] : NULL +--> http://[x:80]/ : unicode(6) "[x:80]" +--> : NULL +--> / : NULL +--> http:///blah.com : +Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 +bool(false) +--> http://:80 : +Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user@:80 : +Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user:pass@:80 : +Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://: : +Warning: parse_url(http://:): Unable to parse URL in %s on line 15 +bool(false) +--> http://@/ : +Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 +bool(false) +--> http://@:/ : +Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://:/ : +Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://? : +Warning: parse_url(http://?): Unable to parse URL in %s on line 15 +bool(false) +--> http://?: : +Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 +bool(false) +--> http://:? : +Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:123456 : +Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:abcdef : +Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_004.phpt b/ext/standard/tests/url/parse_url_basic_004.phpt new file mode 100644 index 0000000000..af32795470 --- /dev/null +++ b/ext/standard/tests/url/parse_url_basic_004.phpt @@ -0,0 +1,150 @@ +--TEST-- +Test parse_url() function: Parse a load of URLs without specifying PHP_URL_PORT as the URL component +--FILE-- + $url : "; + var_dump(parse_url($url, PHP_URL_PORT)); +} + +echo "Done"; +?> +--EXPECTF-- +--> 64.246.30.37 : NULL +--> http://64.246.30.37 : NULL +--> http://64.246.30.37/ : NULL +--> 64.246.30.37/ : NULL +--> 64.246.30.37:80/ : int(80) +--> php.net : NULL +--> php.net/ : NULL +--> http://php.net : NULL +--> http://php.net/ : NULL +--> www.php.net : NULL +--> www.php.net/ : NULL +--> http://www.php.net : NULL +--> http://www.php.net/ : NULL +--> www.php.net:80 : int(80) +--> http://www.php.net:80 : int(80) +--> http://www.php.net:80/ : int(80) +--> http://www.php.net/index.php : NULL +--> www.php.net/? : NULL +--> www.php.net:80/? : int(80) +--> http://www.php.net/? : NULL +--> http://www.php.net:80/? : int(80) +--> http://www.php.net:80/index.php : int(80) +--> http://www.php.net:80/foo/bar/index.php : int(80) +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : int(80) +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : int(80) +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : int(80) +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : int(80) +--> http://www.php.net:80/this/../a/../deep/directory : int(80) +--> http://www.php.net:80/this/../a/../deep/directory/ : int(80) +--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : int(80) +--> http://www.php.net:80/index.php : int(80) +--> http://www.php.net:80/index.php? : int(80) +--> http://www.php.net:80/#foo : int(80) +--> http://www.php.net:80/?# : int(80) +--> http://www.php.net:80/?test=1 : int(80) +--> http://www.php.net/?test=1& : NULL +--> http://www.php.net:80/?& : int(80) +--> http://www.php.net:80/index.php?test=1& : int(80) +--> http://www.php.net/index.php?& : NULL +--> http://www.php.net:80/index.php?foo& : int(80) +--> http://www.php.net/index.php?&foo : NULL +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : int(80) +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : int(80) +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : int(80) +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : int(80) +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : int(80) +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : int(80) +--> nntp://news.php.net : NULL +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL +--> zlib:http://foo@bar : NULL +--> zlib:filename.txt : NULL +--> zlib:/path/to/my/file/file.txt : NULL +--> foo://foo@bar : NULL +--> mailto:me@mydomain.com : NULL +--> /foo.php?a=b&c=d : NULL +--> foo.php?a=b&c=d : NULL +--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : int(8080) +--> file:///path/to/file : NULL +--> file://path/to/file : NULL +--> file:/path/to/file : NULL +--> http://1.2.3.4:/abc.asp?a=1&b=2 : NULL +--> http://foo.com#bar : NULL +--> scheme: : NULL +--> foo+bar://baz@bang/bla : NULL +--> gg:9130731 : NULL +--> http://user:@pass@host/path?argument?value#etc : NULL +--> http://10.10.10.10/:80 : NULL +--> http://x:? : NULL +--> x:blah.com : NULL +--> x:/blah.com : NULL +--> x://::abc/? : NULL +--> http://::? : NULL +--> x://::6.5 : int(6) +--> http://?:/ : NULL +--> http://@?:/ : NULL +--> file:///: : NULL +--> file:///a:/ : NULL +--> file:///ab:/ : NULL +--> file:///a:/ : NULL +--> file:///@:/ : NULL +--> file:///:80/ : NULL +--> [] : NULL +--> http://[x:80]/ : NULL +--> : NULL +--> / : NULL +--> http:///blah.com : +Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 +bool(false) +--> http://:80 : +Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user@:80 : +Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user:pass@:80 : +Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://: : +Warning: parse_url(http://:): Unable to parse URL in %s on line 15 +bool(false) +--> http://@/ : +Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 +bool(false) +--> http://@:/ : +Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://:/ : +Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://? : +Warning: parse_url(http://?): Unable to parse URL in %s on line 15 +bool(false) +--> http://?: : +Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 +bool(false) +--> http://:? : +Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:123456 : +Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:abcdef : +Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_005.phpt b/ext/standard/tests/url/parse_url_basic_005.phpt new file mode 100644 index 0000000000..a5778eac14 --- /dev/null +++ b/ext/standard/tests/url/parse_url_basic_005.phpt @@ -0,0 +1,278 @@ +--TEST-- +Test parse_url() function: Parse a load of URLs without specifying PHP_URL_USER as the URL component +--FILE-- + $url : "; + var_dump(parse_url($url, PHP_URL_USER)); +} + +echo "Done"; +?> +--EXPECTF-- +--> 64.246.30.37 : NULL +--> http://64.246.30.37 : NULL +--> http://64.246.30.37/ : NULL +--> 64.246.30.37/ : NULL +--> 64.246.30.37:80/ : NULL +--> php.net : NULL +--> php.net/ : NULL +--> http://php.net : NULL +--> http://php.net/ : NULL +--> www.php.net : NULL +--> www.php.net/ : NULL +--> http://www.php.net : NULL +--> http://www.php.net/ : NULL +--> www.php.net:80 : NULL +--> 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 +--> 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 +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL +--> http://www.php.net:80/this/../a/../deep/directory : NULL +--> 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/#foo : NULL +--> http://www.php.net:80/?# : NULL +--> http://www.php.net:80/?test=1 : NULL +--> http://www.php.net/?test=1& : NULL +--> http://www.php.net:80/?& : NULL +--> http://www.php.net:80/index.php?test=1& : NULL +--> http://www.php.net/index.php?& : NULL +--> http://www.php.net:80/index.php?foo& : NULL +--> http://www.php.net/index.php?&foo : NULL +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : NULL +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret" +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret" +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret" +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(14) "secret@hideout" +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret" +--> nntp://news.php.net : NULL +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL +--> zlib:http://foo@bar : NULL +--> zlib:filename.txt : NULL +--> zlib:/path/to/my/file/file.txt : NULL +--> foo://foo@bar : string(3) "foo" +--> mailto:me@mydomain.com : NULL +--> /foo.php?a=b&c=d : NULL +--> foo.php?a=b&c=d : NULL +--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : string(4) "user" +--> file:///path/to/file : NULL +--> file://path/to/file : NULL +--> file:/path/to/file : NULL +--> http://1.2.3.4:/abc.asp?a=1&b=2 : NULL +--> http://foo.com#bar : NULL +--> scheme: : NULL +--> foo+bar://baz@bang/bla : string(3) "baz" +--> gg:9130731 : NULL +--> http://user:@pass@host/path?argument?value#etc : string(4) "user" +--> http://10.10.10.10/:80 : NULL +--> http://x:? : NULL +--> x:blah.com : NULL +--> x:/blah.com : NULL +--> x://::abc/? : NULL +--> http://::? : NULL +--> x://::6.5 : NULL +--> http://?:/ : NULL +--> http://@?:/ : string(0) "" +--> file:///: : NULL +--> file:///a:/ : NULL +--> file:///ab:/ : NULL +--> file:///a:/ : NULL +--> file:///@:/ : NULL +--> file:///:80/ : NULL +--> [] : NULL +--> http://[x:80]/ : NULL +--> : NULL +--> / : NULL +--> http:///blah.com : +Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 +bool(false) +--> http://:80 : +Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user@:80 : +Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user:pass@:80 : +Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://: : +Warning: parse_url(http://:): Unable to parse URL in %s on line 15 +bool(false) +--> http://@/ : +Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 +bool(false) +--> http://@:/ : +Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://:/ : +Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://? : +Warning: parse_url(http://?): Unable to parse URL in %s on line 15 +bool(false) +--> http://?: : +Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 +bool(false) +--> http://:? : +Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:123456 : +Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:abcdef : +Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 +bool(false) +Done +--UEXPECTF-- +--> 64.246.30.37 : NULL +--> http://64.246.30.37 : NULL +--> http://64.246.30.37/ : NULL +--> 64.246.30.37/ : NULL +--> 64.246.30.37:80/ : NULL +--> php.net : NULL +--> php.net/ : NULL +--> http://php.net : NULL +--> http://php.net/ : NULL +--> www.php.net : NULL +--> www.php.net/ : NULL +--> http://www.php.net : NULL +--> http://www.php.net/ : NULL +--> www.php.net:80 : NULL +--> 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 +--> 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 +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL +--> http://www.php.net:80/this/../a/../deep/directory : NULL +--> 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/#foo : NULL +--> http://www.php.net:80/?# : NULL +--> http://www.php.net:80/?test=1 : NULL +--> http://www.php.net/?test=1& : NULL +--> http://www.php.net:80/?& : NULL +--> http://www.php.net:80/index.php?test=1& : NULL +--> http://www.php.net/index.php?& : NULL +--> http://www.php.net:80/index.php?foo& : NULL +--> http://www.php.net/index.php?&foo : NULL +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : NULL +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(6) "secret" +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(6) "secret" +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(6) "secret" +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(14) "secret@hideout" +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(6) "secret" +--> nntp://news.php.net : NULL +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL +--> zlib:http://foo@bar : NULL +--> zlib:filename.txt : NULL +--> zlib:/path/to/my/file/file.txt : NULL +--> foo://foo@bar : unicode(3) "foo" +--> mailto:me@mydomain.com : NULL +--> /foo.php?a=b&c=d : NULL +--> foo.php?a=b&c=d : NULL +--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : unicode(4) "user" +--> file:///path/to/file : NULL +--> file://path/to/file : NULL +--> file:/path/to/file : NULL +--> http://1.2.3.4:/abc.asp?a=1&b=2 : NULL +--> http://foo.com#bar : NULL +--> scheme: : NULL +--> foo+bar://baz@bang/bla : unicode(3) "baz" +--> gg:9130731 : NULL +--> http://user:@pass@host/path?argument?value#etc : unicode(4) "user" +--> http://10.10.10.10/:80 : NULL +--> http://x:? : NULL +--> x:blah.com : NULL +--> x:/blah.com : NULL +--> x://::abc/? : NULL +--> http://::? : NULL +--> x://::6.5 : NULL +--> http://?:/ : NULL +--> http://@?:/ : unicode(0) "" +--> file:///: : NULL +--> file:///a:/ : NULL +--> file:///ab:/ : NULL +--> file:///a:/ : NULL +--> file:///@:/ : NULL +--> file:///:80/ : NULL +--> [] : NULL +--> http://[x:80]/ : NULL +--> : NULL +--> / : NULL +--> http:///blah.com : +Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 +bool(false) +--> http://:80 : +Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user@:80 : +Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user:pass@:80 : +Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://: : +Warning: parse_url(http://:): Unable to parse URL in %s on line 15 +bool(false) +--> http://@/ : +Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 +bool(false) +--> http://@:/ : +Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://:/ : +Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://? : +Warning: parse_url(http://?): Unable to parse URL in %s on line 15 +bool(false) +--> http://?: : +Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 +bool(false) +--> http://:? : +Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:123456 : +Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:abcdef : +Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_006.phpt b/ext/standard/tests/url/parse_url_basic_006.phpt new file mode 100644 index 0000000000..97d06bae9a --- /dev/null +++ b/ext/standard/tests/url/parse_url_basic_006.phpt @@ -0,0 +1,278 @@ +--TEST-- +Test parse_url() function: Parse a load of URLs without specifying PHP_URL_PASS as the URL component +--FILE-- + $url : "; + var_dump(parse_url($url, PHP_URL_PASS)); +} + +echo "Done"; +?> +--EXPECTF-- +--> 64.246.30.37 : NULL +--> http://64.246.30.37 : NULL +--> http://64.246.30.37/ : NULL +--> 64.246.30.37/ : NULL +--> 64.246.30.37:80/ : NULL +--> php.net : NULL +--> php.net/ : NULL +--> http://php.net : NULL +--> http://php.net/ : NULL +--> www.php.net : NULL +--> www.php.net/ : NULL +--> http://www.php.net : NULL +--> http://www.php.net/ : NULL +--> www.php.net:80 : NULL +--> 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 +--> 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 +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL +--> http://www.php.net:80/this/../a/../deep/directory : NULL +--> 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/#foo : NULL +--> http://www.php.net:80/?# : NULL +--> http://www.php.net:80/?test=1 : NULL +--> http://www.php.net/?test=1& : NULL +--> http://www.php.net:80/?& : NULL +--> http://www.php.net:80/index.php?test=1& : NULL +--> http://www.php.net/index.php?& : NULL +--> http://www.php.net:80/index.php?foo& : NULL +--> http://www.php.net/index.php?&foo : NULL +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : NULL +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(7) "hideout" +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(7) "hideout" +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(7) "hid:out" +--> nntp://news.php.net : NULL +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL +--> zlib:http://foo@bar : NULL +--> zlib:filename.txt : NULL +--> zlib:/path/to/my/file/file.txt : NULL +--> foo://foo@bar : NULL +--> mailto:me@mydomain.com : NULL +--> /foo.php?a=b&c=d : NULL +--> foo.php?a=b&c=d : NULL +--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : string(6) "passwd" +--> file:///path/to/file : NULL +--> file://path/to/file : NULL +--> file:/path/to/file : NULL +--> http://1.2.3.4:/abc.asp?a=1&b=2 : NULL +--> http://foo.com#bar : NULL +--> scheme: : NULL +--> foo+bar://baz@bang/bla : NULL +--> gg:9130731 : NULL +--> http://user:@pass@host/path?argument?value#etc : string(5) "@pass" +--> http://10.10.10.10/:80 : NULL +--> http://x:? : NULL +--> x:blah.com : NULL +--> x:/blah.com : NULL +--> x://::abc/? : NULL +--> http://::? : NULL +--> x://::6.5 : NULL +--> http://?:/ : NULL +--> http://@?:/ : NULL +--> file:///: : NULL +--> file:///a:/ : NULL +--> file:///ab:/ : NULL +--> file:///a:/ : NULL +--> file:///@:/ : NULL +--> file:///:80/ : NULL +--> [] : NULL +--> http://[x:80]/ : NULL +--> : NULL +--> / : NULL +--> http:///blah.com : +Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 +bool(false) +--> http://:80 : +Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user@:80 : +Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user:pass@:80 : +Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://: : +Warning: parse_url(http://:): Unable to parse URL in %s on line 15 +bool(false) +--> http://@/ : +Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 +bool(false) +--> http://@:/ : +Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://:/ : +Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://? : +Warning: parse_url(http://?): Unable to parse URL in %s on line 15 +bool(false) +--> http://?: : +Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 +bool(false) +--> http://:? : +Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:123456 : +Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:abcdef : +Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 +bool(false) +Done +--UEXPECTF-- +--> 64.246.30.37 : NULL +--> http://64.246.30.37 : NULL +--> http://64.246.30.37/ : NULL +--> 64.246.30.37/ : NULL +--> 64.246.30.37:80/ : NULL +--> php.net : NULL +--> php.net/ : NULL +--> http://php.net : NULL +--> http://php.net/ : NULL +--> www.php.net : NULL +--> www.php.net/ : NULL +--> http://www.php.net : NULL +--> http://www.php.net/ : NULL +--> www.php.net:80 : NULL +--> 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 +--> 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 +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL +--> http://www.php.net:80/this/../a/../deep/directory : NULL +--> 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/#foo : NULL +--> http://www.php.net:80/?# : NULL +--> http://www.php.net:80/?test=1 : NULL +--> http://www.php.net/?test=1& : NULL +--> http://www.php.net:80/?& : NULL +--> http://www.php.net:80/index.php?test=1& : NULL +--> http://www.php.net/index.php?& : NULL +--> http://www.php.net:80/index.php?foo& : NULL +--> http://www.php.net/index.php?&foo : NULL +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : NULL +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(7) "hideout" +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(7) "hideout" +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(7) "hid:out" +--> nntp://news.php.net : NULL +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL +--> zlib:http://foo@bar : NULL +--> zlib:filename.txt : NULL +--> zlib:/path/to/my/file/file.txt : NULL +--> foo://foo@bar : NULL +--> mailto:me@mydomain.com : NULL +--> /foo.php?a=b&c=d : NULL +--> foo.php?a=b&c=d : NULL +--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : unicode(6) "passwd" +--> file:///path/to/file : NULL +--> file://path/to/file : NULL +--> file:/path/to/file : NULL +--> http://1.2.3.4:/abc.asp?a=1&b=2 : NULL +--> http://foo.com#bar : NULL +--> scheme: : NULL +--> foo+bar://baz@bang/bla : NULL +--> gg:9130731 : NULL +--> http://user:@pass@host/path?argument?value#etc : unicode(5) "@pass" +--> http://10.10.10.10/:80 : NULL +--> http://x:? : NULL +--> x:blah.com : NULL +--> x:/blah.com : NULL +--> x://::abc/? : NULL +--> http://::? : NULL +--> x://::6.5 : NULL +--> http://?:/ : NULL +--> http://@?:/ : NULL +--> file:///: : NULL +--> file:///a:/ : NULL +--> file:///ab:/ : NULL +--> file:///a:/ : NULL +--> file:///@:/ : NULL +--> file:///:80/ : NULL +--> [] : NULL +--> http://[x:80]/ : NULL +--> : NULL +--> / : NULL +--> http:///blah.com : +Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 +bool(false) +--> http://:80 : +Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user@:80 : +Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user:pass@:80 : +Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://: : +Warning: parse_url(http://:): Unable to parse URL in %s on line 15 +bool(false) +--> http://@/ : +Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 +bool(false) +--> http://@:/ : +Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://:/ : +Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://? : +Warning: parse_url(http://?): Unable to parse URL in %s on line 15 +bool(false) +--> http://?: : +Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 +bool(false) +--> http://:? : +Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:123456 : +Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:abcdef : +Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_007.phpt b/ext/standard/tests/url/parse_url_basic_007.phpt new file mode 100644 index 0000000000..25e9fca8e0 --- /dev/null +++ b/ext/standard/tests/url/parse_url_basic_007.phpt @@ -0,0 +1,278 @@ +--TEST-- +Test parse_url() function: Parse a load of URLs without specifying PHP_URL_PATH as the URL component +--FILE-- + $url : "; + var_dump(parse_url($url, PHP_URL_PATH)); +} + +echo "Done"; +?> +--EXPECTF-- +--> 64.246.30.37 : string(12) "64.246.30.37" +--> http://64.246.30.37 : NULL +--> http://64.246.30.37/ : string(1) "/" +--> 64.246.30.37/ : string(13) "64.246.30.37/" +--> 64.246.30.37:80/ : string(1) "/" +--> php.net : string(7) "php.net" +--> php.net/ : string(8) "php.net/" +--> http://php.net : NULL +--> http://php.net/ : string(1) "/" +--> www.php.net : string(11) "www.php.net" +--> www.php.net/ : string(12) "www.php.net/" +--> http://www.php.net : NULL +--> http://www.php.net/ : string(1) "/" +--> www.php.net:80 : NULL +--> http://www.php.net:80 : NULL +--> http://www.php.net:80/ : string(1) "/" +--> http://www.php.net/index.php : string(10) "/index.php" +--> www.php.net/? : string(12) "www.php.net/" +--> www.php.net:80/? : string(1) "/" +--> http://www.php.net/? : string(1) "/" +--> http://www.php.net:80/? : string(1) "/" +--> http://www.php.net:80/index.php : string(10) "/index.php" +--> http://www.php.net:80/foo/bar/index.php : string(18) "/foo/bar/index.php" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : string(53) "/this/is/a/very/deep/directory/structure/and/file.php" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : string(53) "/this/is/a/very/deep/directory/structure/and/file.php" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : string(45) "/this/is/a/very/deep/directory/structure/and/" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : string(53) "/this/is/a/very/deep/directory/structure/and/file.php" +--> http://www.php.net:80/this/../a/../deep/directory : string(28) "/this/../a/../deep/directory" +--> http://www.php.net:80/this/../a/../deep/directory/ : string(29) "/this/../a/../deep/directory/" +--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : string(42) "/this/is/a/very/deep/directory/../file.php" +--> http://www.php.net:80/index.php : string(10) "/index.php" +--> http://www.php.net:80/index.php? : string(10) "/index.php" +--> http://www.php.net:80/#foo : string(1) "/" +--> http://www.php.net:80/?# : string(1) "/" +--> http://www.php.net:80/?test=1 : string(1) "/" +--> http://www.php.net/?test=1& : string(1) "/" +--> http://www.php.net:80/?& : string(1) "/" +--> http://www.php.net:80/index.php?test=1& : string(10) "/index.php" +--> http://www.php.net/index.php?& : string(10) "/index.php" +--> http://www.php.net:80/index.php?foo& : string(10) "/index.php" +--> http://www.php.net/index.php?&foo : string(10) "/index.php" +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : string(10) "/index.php" +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php" +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php" +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php" +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php" +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php" +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php" +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php" +--> nntp://news.php.net : NULL +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : string(22) "/gnu/glic/glibc.tar.gz" +--> zlib:http://foo@bar : string(14) "http://foo@bar" +--> zlib:filename.txt : string(12) "filename.txt" +--> zlib:/path/to/my/file/file.txt : string(25) "/path/to/my/file/file.txt" +--> foo://foo@bar : NULL +--> mailto:me@mydomain.com : string(15) "me@mydomain.com" +--> /foo.php?a=b&c=d : string(8) "/foo.php" +--> foo.php?a=b&c=d : string(7) "foo.php" +--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : NULL +--> file:///path/to/file : string(13) "/path/to/file" +--> file://path/to/file : string(8) "/to/file" +--> file:/path/to/file : string(13) "/path/to/file" +--> http://1.2.3.4:/abc.asp?a=1&b=2 : string(8) "/abc.asp" +--> http://foo.com#bar : NULL +--> scheme: : NULL +--> foo+bar://baz@bang/bla : string(4) "/bla" +--> gg:9130731 : string(7) "9130731" +--> http://user:@pass@host/path?argument?value#etc : string(5) "/path" +--> http://10.10.10.10/:80 : string(4) "/:80" +--> http://x:? : NULL +--> x:blah.com : string(8) "blah.com" +--> x:/blah.com : string(9) "/blah.com" +--> x://::abc/? : string(1) "/" +--> http://::? : NULL +--> x://::6.5 : NULL +--> http://?:/ : string(1) "/" +--> http://@?:/ : string(1) "/" +--> file:///: : string(2) "/:" +--> file:///a:/ : string(3) "a:/" +--> file:///ab:/ : string(5) "/ab:/" +--> file:///a:/ : string(3) "a:/" +--> file:///@:/ : string(3) "@:/" +--> file:///:80/ : string(5) "/:80/" +--> [] : string(2) "[]" +--> http://[x:80]/ : string(1) "/" +--> : string(0) "" +--> / : string(1) "/" +--> http:///blah.com : +Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 +bool(false) +--> http://:80 : +Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user@:80 : +Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user:pass@:80 : +Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://: : +Warning: parse_url(http://:): Unable to parse URL in %s on line 15 +bool(false) +--> http://@/ : +Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 +bool(false) +--> http://@:/ : +Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://:/ : +Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://? : +Warning: parse_url(http://?): Unable to parse URL in %s on line 15 +bool(false) +--> http://?: : +Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 +bool(false) +--> http://:? : +Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:123456 : +Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:abcdef : +Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 +bool(false) +Done +--UEXPECTF-- +--> 64.246.30.37 : unicode(12) "64.246.30.37" +--> http://64.246.30.37 : NULL +--> http://64.246.30.37/ : unicode(1) "/" +--> 64.246.30.37/ : unicode(13) "64.246.30.37/" +--> 64.246.30.37:80/ : unicode(1) "/" +--> php.net : unicode(7) "php.net" +--> php.net/ : unicode(8) "php.net/" +--> http://php.net : NULL +--> http://php.net/ : unicode(1) "/" +--> www.php.net : unicode(11) "www.php.net" +--> www.php.net/ : unicode(12) "www.php.net/" +--> http://www.php.net : NULL +--> http://www.php.net/ : unicode(1) "/" +--> www.php.net:80 : NULL +--> http://www.php.net:80 : NULL +--> http://www.php.net:80/ : unicode(1) "/" +--> http://www.php.net/index.php : unicode(10) "/index.php" +--> www.php.net/? : unicode(12) "www.php.net/" +--> www.php.net:80/? : unicode(1) "/" +--> http://www.php.net/? : unicode(1) "/" +--> http://www.php.net:80/? : unicode(1) "/" +--> http://www.php.net:80/index.php : unicode(10) "/index.php" +--> http://www.php.net:80/foo/bar/index.php : unicode(18) "/foo/bar/index.php" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : unicode(53) "/this/is/a/very/deep/directory/structure/and/file.php" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : unicode(53) "/this/is/a/very/deep/directory/structure/and/file.php" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : unicode(45) "/this/is/a/very/deep/directory/structure/and/" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : unicode(53) "/this/is/a/very/deep/directory/structure/and/file.php" +--> http://www.php.net:80/this/../a/../deep/directory : unicode(28) "/this/../a/../deep/directory" +--> http://www.php.net:80/this/../a/../deep/directory/ : unicode(29) "/this/../a/../deep/directory/" +--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : unicode(42) "/this/is/a/very/deep/directory/../file.php" +--> http://www.php.net:80/index.php : unicode(10) "/index.php" +--> http://www.php.net:80/index.php? : unicode(10) "/index.php" +--> http://www.php.net:80/#foo : unicode(1) "/" +--> http://www.php.net:80/?# : unicode(1) "/" +--> http://www.php.net:80/?test=1 : unicode(1) "/" +--> http://www.php.net/?test=1& : unicode(1) "/" +--> http://www.php.net:80/?& : unicode(1) "/" +--> http://www.php.net:80/index.php?test=1& : unicode(10) "/index.php" +--> http://www.php.net/index.php?& : unicode(10) "/index.php" +--> http://www.php.net:80/index.php?foo& : unicode(10) "/index.php" +--> http://www.php.net/index.php?&foo : unicode(10) "/index.php" +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : unicode(10) "/index.php" +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(10) "/index.php" +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(10) "/index.php" +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(10) "/index.php" +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(10) "/index.php" +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(10) "/index.php" +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(10) "/index.php" +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(10) "/index.php" +--> nntp://news.php.net : NULL +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : unicode(22) "/gnu/glic/glibc.tar.gz" +--> zlib:http://foo@bar : unicode(14) "http://foo@bar" +--> zlib:filename.txt : unicode(12) "filename.txt" +--> zlib:/path/to/my/file/file.txt : unicode(25) "/path/to/my/file/file.txt" +--> foo://foo@bar : NULL +--> mailto:me@mydomain.com : unicode(15) "me@mydomain.com" +--> /foo.php?a=b&c=d : unicode(8) "/foo.php" +--> foo.php?a=b&c=d : unicode(7) "foo.php" +--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : NULL +--> file:///path/to/file : unicode(13) "/path/to/file" +--> file://path/to/file : unicode(8) "/to/file" +--> file:/path/to/file : unicode(13) "/path/to/file" +--> http://1.2.3.4:/abc.asp?a=1&b=2 : unicode(8) "/abc.asp" +--> http://foo.com#bar : NULL +--> scheme: : NULL +--> foo+bar://baz@bang/bla : unicode(4) "/bla" +--> gg:9130731 : unicode(7) "9130731" +--> http://user:@pass@host/path?argument?value#etc : unicode(5) "/path" +--> http://10.10.10.10/:80 : unicode(4) "/:80" +--> http://x:? : NULL +--> x:blah.com : unicode(8) "blah.com" +--> x:/blah.com : unicode(9) "/blah.com" +--> x://::abc/? : unicode(1) "/" +--> http://::? : NULL +--> x://::6.5 : NULL +--> http://?:/ : unicode(1) "/" +--> http://@?:/ : unicode(1) "/" +--> file:///: : unicode(2) "/:" +--> file:///a:/ : unicode(3) "a:/" +--> file:///ab:/ : unicode(5) "/ab:/" +--> file:///a:/ : unicode(3) "a:/" +--> file:///@:/ : unicode(3) "@:/" +--> file:///:80/ : unicode(5) "/:80/" +--> [] : unicode(2) "[]" +--> http://[x:80]/ : unicode(1) "/" +--> : unicode(0) "" +--> / : unicode(1) "/" +--> http:///blah.com : +Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 +bool(false) +--> http://:80 : +Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user@:80 : +Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user:pass@:80 : +Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://: : +Warning: parse_url(http://:): Unable to parse URL in %s on line 15 +bool(false) +--> http://@/ : +Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 +bool(false) +--> http://@:/ : +Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://:/ : +Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://? : +Warning: parse_url(http://?): Unable to parse URL in %s on line 15 +bool(false) +--> http://?: : +Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 +bool(false) +--> http://:? : +Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:123456 : +Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:abcdef : +Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_008.phpt b/ext/standard/tests/url/parse_url_basic_008.phpt new file mode 100644 index 0000000000..6cfaa4b504 --- /dev/null +++ b/ext/standard/tests/url/parse_url_basic_008.phpt @@ -0,0 +1,278 @@ +--TEST-- +Test parse_url() function: Parse a load of URLs without specifying PHP_URL_QUERY as the URL component +--FILE-- + $url : "; + var_dump(parse_url($url, PHP_URL_QUERY)); +} + +echo "Done"; +?> +--EXPECTF-- +--> 64.246.30.37 : NULL +--> http://64.246.30.37 : NULL +--> http://64.246.30.37/ : NULL +--> 64.246.30.37/ : NULL +--> 64.246.30.37:80/ : NULL +--> php.net : NULL +--> php.net/ : NULL +--> http://php.net : NULL +--> http://php.net/ : NULL +--> www.php.net : NULL +--> www.php.net/ : NULL +--> http://www.php.net : NULL +--> http://www.php.net/ : NULL +--> www.php.net:80 : NULL +--> 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 +--> 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 +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : string(37) "lots=1&of=2¶meters=3&too=4&here=5" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL +--> http://www.php.net:80/this/../a/../deep/directory : NULL +--> 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/#foo : NULL +--> http://www.php.net:80/?# : NULL +--> 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) "&" +--> http://www.php.net:80/index.php?test=1& : string(7) "test=1&" +--> http://www.php.net/index.php?& : string(1) "&" +--> http://www.php.net:80/index.php?foo& : string(4) "foo&" +--> http://www.php.net/index.php?&foo : string(4) "&foo" +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : string(31) "test=1&test2=char&test3=mixesCI" +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI" +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI" +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI" +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI" +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI" +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI" +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(31) "test=1&test2=char&test3=mixesCI" +--> nntp://news.php.net : NULL +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL +--> zlib:http://foo@bar : NULL +--> zlib:filename.txt : NULL +--> zlib:/path/to/my/file/file.txt : NULL +--> foo://foo@bar : NULL +--> mailto:me@mydomain.com : NULL +--> /foo.php?a=b&c=d : string(7) "a=b&c=d" +--> foo.php?a=b&c=d : string(7) "a=b&c=d" +--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : string(12) "bar=1&boom=0" +--> file:///path/to/file : NULL +--> file://path/to/file : NULL +--> file:/path/to/file : NULL +--> http://1.2.3.4:/abc.asp?a=1&b=2 : string(7) "a=1&b=2" +--> http://foo.com#bar : NULL +--> scheme: : NULL +--> foo+bar://baz@bang/bla : NULL +--> 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 +--> x:blah.com : NULL +--> x:/blah.com : NULL +--> x://::abc/? : NULL +--> http://::? : NULL +--> x://::6.5 : NULL +--> http://?:/ : NULL +--> http://@?:/ : NULL +--> file:///: : NULL +--> file:///a:/ : NULL +--> file:///ab:/ : NULL +--> file:///a:/ : NULL +--> file:///@:/ : NULL +--> file:///:80/ : NULL +--> [] : NULL +--> http://[x:80]/ : NULL +--> : NULL +--> / : NULL +--> http:///blah.com : +Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 +bool(false) +--> http://:80 : +Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user@:80 : +Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user:pass@:80 : +Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://: : +Warning: parse_url(http://:): Unable to parse URL in %s on line 15 +bool(false) +--> http://@/ : +Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 +bool(false) +--> http://@:/ : +Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://:/ : +Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://? : +Warning: parse_url(http://?): Unable to parse URL in %s on line 15 +bool(false) +--> http://?: : +Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 +bool(false) +--> http://:? : +Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:123456 : +Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:abcdef : +Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 +bool(false) +Done +--UEXPECTF-- +--> 64.246.30.37 : NULL +--> http://64.246.30.37 : NULL +--> http://64.246.30.37/ : NULL +--> 64.246.30.37/ : NULL +--> 64.246.30.37:80/ : NULL +--> php.net : NULL +--> php.net/ : NULL +--> http://php.net : NULL +--> http://php.net/ : NULL +--> www.php.net : NULL +--> www.php.net/ : NULL +--> http://www.php.net : NULL +--> http://www.php.net/ : NULL +--> www.php.net:80 : NULL +--> 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 +--> 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 +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : unicode(37) "lots=1&of=2¶meters=3&too=4&here=5" +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL +--> http://www.php.net:80/this/../a/../deep/directory : NULL +--> 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/#foo : NULL +--> http://www.php.net:80/?# : NULL +--> http://www.php.net:80/?test=1 : unicode(6) "test=1" +--> http://www.php.net/?test=1& : unicode(7) "test=1&" +--> http://www.php.net:80/?& : unicode(1) "&" +--> http://www.php.net:80/index.php?test=1& : unicode(7) "test=1&" +--> http://www.php.net/index.php?& : unicode(1) "&" +--> http://www.php.net:80/index.php?foo& : unicode(4) "foo&" +--> http://www.php.net/index.php?&foo : unicode(4) "&foo" +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : unicode(31) "test=1&test2=char&test3=mixesCI" +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(31) "test=1&test2=char&test3=mixesCI" +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(31) "test=1&test2=char&test3=mixesCI" +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(31) "test=1&test2=char&test3=mixesCI" +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(31) "test=1&test2=char&test3=mixesCI" +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(31) "test=1&test2=char&test3=mixesCI" +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(31) "test=1&test2=char&test3=mixesCI" +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(31) "test=1&test2=char&test3=mixesCI" +--> nntp://news.php.net : NULL +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL +--> zlib:http://foo@bar : NULL +--> zlib:filename.txt : NULL +--> zlib:/path/to/my/file/file.txt : NULL +--> foo://foo@bar : NULL +--> mailto:me@mydomain.com : NULL +--> /foo.php?a=b&c=d : unicode(7) "a=b&c=d" +--> foo.php?a=b&c=d : unicode(7) "a=b&c=d" +--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : unicode(12) "bar=1&boom=0" +--> file:///path/to/file : NULL +--> file://path/to/file : NULL +--> file:/path/to/file : NULL +--> http://1.2.3.4:/abc.asp?a=1&b=2 : unicode(7) "a=1&b=2" +--> http://foo.com#bar : NULL +--> scheme: : NULL +--> foo+bar://baz@bang/bla : NULL +--> gg:9130731 : NULL +--> http://user:@pass@host/path?argument?value#etc : unicode(14) "argument?value" +--> http://10.10.10.10/:80 : NULL +--> http://x:? : NULL +--> x:blah.com : NULL +--> x:/blah.com : NULL +--> x://::abc/? : NULL +--> http://::? : NULL +--> x://::6.5 : NULL +--> http://?:/ : NULL +--> http://@?:/ : NULL +--> file:///: : NULL +--> file:///a:/ : NULL +--> file:///ab:/ : NULL +--> file:///a:/ : NULL +--> file:///@:/ : NULL +--> file:///:80/ : NULL +--> [] : NULL +--> http://[x:80]/ : NULL +--> : NULL +--> / : NULL +--> http:///blah.com : +Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 +bool(false) +--> http://:80 : +Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user@:80 : +Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user:pass@:80 : +Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://: : +Warning: parse_url(http://:): Unable to parse URL in %s on line 15 +bool(false) +--> http://@/ : +Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 +bool(false) +--> http://@:/ : +Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://:/ : +Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://? : +Warning: parse_url(http://?): Unable to parse URL in %s on line 15 +bool(false) +--> http://?: : +Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 +bool(false) +--> http://:? : +Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:123456 : +Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:abcdef : +Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_009.phpt b/ext/standard/tests/url/parse_url_basic_009.phpt new file mode 100644 index 0000000000..473929f02b --- /dev/null +++ b/ext/standard/tests/url/parse_url_basic_009.phpt @@ -0,0 +1,278 @@ +--TEST-- +Test parse_url() function: Parse a load of URLs without specifying PHP_URL_FRAGMENT as the URL component +--FILE-- + $url : "; + var_dump(parse_url($url, PHP_URL_FRAGMENT)); +} + +echo "Done"; +?> +--EXPECTF-- +--> 64.246.30.37 : NULL +--> http://64.246.30.37 : NULL +--> http://64.246.30.37/ : NULL +--> 64.246.30.37/ : NULL +--> 64.246.30.37:80/ : NULL +--> php.net : NULL +--> php.net/ : NULL +--> http://php.net : NULL +--> http://php.net/ : NULL +--> www.php.net : NULL +--> www.php.net/ : NULL +--> http://www.php.net : NULL +--> http://www.php.net/ : NULL +--> www.php.net:80 : NULL +--> 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 +--> 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 +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL +--> http://www.php.net:80/this/../a/../deep/directory : NULL +--> 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/#foo : string(3) "foo" +--> http://www.php.net:80/?# : NULL +--> http://www.php.net:80/?test=1 : NULL +--> http://www.php.net/?test=1& : NULL +--> http://www.php.net:80/?& : NULL +--> http://www.php.net:80/index.php?test=1& : NULL +--> http://www.php.net/index.php?& : NULL +--> http://www.php.net:80/index.php?foo& : NULL +--> http://www.php.net/index.php?&foo : NULL +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : NULL +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123" +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123" +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123" +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123" +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123" +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123" +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(16) "some_page_ref123" +--> nntp://news.php.net : NULL +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL +--> zlib:http://foo@bar : NULL +--> zlib:filename.txt : NULL +--> zlib:/path/to/my/file/file.txt : NULL +--> foo://foo@bar : NULL +--> mailto:me@mydomain.com : NULL +--> /foo.php?a=b&c=d : NULL +--> foo.php?a=b&c=d : NULL +--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : NULL +--> file:///path/to/file : NULL +--> file://path/to/file : NULL +--> file:/path/to/file : NULL +--> http://1.2.3.4:/abc.asp?a=1&b=2 : NULL +--> http://foo.com#bar : string(3) "bar" +--> scheme: : NULL +--> foo+bar://baz@bang/bla : NULL +--> gg:9130731 : NULL +--> http://user:@pass@host/path?argument?value#etc : string(3) "etc" +--> http://10.10.10.10/:80 : NULL +--> http://x:? : NULL +--> x:blah.com : NULL +--> x:/blah.com : NULL +--> x://::abc/? : NULL +--> http://::? : NULL +--> x://::6.5 : NULL +--> http://?:/ : NULL +--> http://@?:/ : NULL +--> file:///: : NULL +--> file:///a:/ : NULL +--> file:///ab:/ : NULL +--> file:///a:/ : NULL +--> file:///@:/ : NULL +--> file:///:80/ : NULL +--> [] : NULL +--> http://[x:80]/ : NULL +--> : NULL +--> / : NULL +--> http:///blah.com : +Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 +bool(false) +--> http://:80 : +Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user@:80 : +Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user:pass@:80 : +Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://: : +Warning: parse_url(http://:): Unable to parse URL in %s on line 15 +bool(false) +--> http://@/ : +Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 +bool(false) +--> http://@:/ : +Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://:/ : +Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://? : +Warning: parse_url(http://?): Unable to parse URL in %s on line 15 +bool(false) +--> http://?: : +Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 +bool(false) +--> http://:? : +Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:123456 : +Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:abcdef : +Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 +bool(false) +Done +--UEXPECTF-- +--> 64.246.30.37 : NULL +--> http://64.246.30.37 : NULL +--> http://64.246.30.37/ : NULL +--> 64.246.30.37/ : NULL +--> 64.246.30.37:80/ : NULL +--> php.net : NULL +--> php.net/ : NULL +--> http://php.net : NULL +--> http://php.net/ : NULL +--> www.php.net : NULL +--> www.php.net/ : NULL +--> http://www.php.net : NULL +--> http://www.php.net/ : NULL +--> www.php.net:80 : NULL +--> 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 +--> 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 +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php?lots=1&of=2¶meters=3&too=4&here=5 : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/ : NULL +--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL +--> http://www.php.net:80/this/../a/../deep/directory : NULL +--> 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/#foo : unicode(3) "foo" +--> http://www.php.net:80/?# : NULL +--> http://www.php.net:80/?test=1 : NULL +--> http://www.php.net/?test=1& : NULL +--> http://www.php.net:80/?& : NULL +--> http://www.php.net:80/index.php?test=1& : NULL +--> http://www.php.net/index.php?& : NULL +--> http://www.php.net:80/index.php?foo& : NULL +--> http://www.php.net/index.php?&foo : NULL +--> http://www.php.net:80/index.php?test=1&test2=char&test3=mixesCI : NULL +--> www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(16) "some_page_ref123" +--> http://secret@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(16) "some_page_ref123" +--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(16) "some_page_ref123" +--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(16) "some_page_ref123" +--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(16) "some_page_ref123" +--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(16) "some_page_ref123" +--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : unicode(16) "some_page_ref123" +--> nntp://news.php.net : NULL +--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL +--> zlib:http://foo@bar : NULL +--> zlib:filename.txt : NULL +--> zlib:/path/to/my/file/file.txt : NULL +--> foo://foo@bar : NULL +--> mailto:me@mydomain.com : NULL +--> /foo.php?a=b&c=d : NULL +--> foo.php?a=b&c=d : NULL +--> http://user:passwd@www.example.com:8080?bar=1&boom=0 : NULL +--> file:///path/to/file : NULL +--> file://path/to/file : NULL +--> file:/path/to/file : NULL +--> http://1.2.3.4:/abc.asp?a=1&b=2 : NULL +--> http://foo.com#bar : unicode(3) "bar" +--> scheme: : NULL +--> foo+bar://baz@bang/bla : NULL +--> gg:9130731 : NULL +--> http://user:@pass@host/path?argument?value#etc : unicode(3) "etc" +--> http://10.10.10.10/:80 : NULL +--> http://x:? : NULL +--> x:blah.com : NULL +--> x:/blah.com : NULL +--> x://::abc/? : NULL +--> http://::? : NULL +--> x://::6.5 : NULL +--> http://?:/ : NULL +--> http://@?:/ : NULL +--> file:///: : NULL +--> file:///a:/ : NULL +--> file:///ab:/ : NULL +--> file:///a:/ : NULL +--> file:///@:/ : NULL +--> file:///:80/ : NULL +--> [] : NULL +--> http://[x:80]/ : NULL +--> : NULL +--> / : NULL +--> http:///blah.com : +Warning: parse_url(http:///blah.com): Unable to parse URL in %s on line 15 +bool(false) +--> http://:80 : +Warning: parse_url(http://:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user@:80 : +Warning: parse_url(http://user@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://user:pass@:80 : +Warning: parse_url(http://user:pass@:80): Unable to parse URL in %s on line 15 +bool(false) +--> http://: : +Warning: parse_url(http://:): Unable to parse URL in %s on line 15 +bool(false) +--> http://@/ : +Warning: parse_url(http://@/): Unable to parse URL in %s on line 15 +bool(false) +--> http://@:/ : +Warning: parse_url(http://@:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://:/ : +Warning: parse_url(http://:/): Unable to parse URL in %s on line 15 +bool(false) +--> http://? : +Warning: parse_url(http://?): Unable to parse URL in %s on line 15 +bool(false) +--> http://?: : +Warning: parse_url(http://?:): Unable to parse URL in %s on line 15 +bool(false) +--> http://:? : +Warning: parse_url(http://:?): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:123456 : +Warning: parse_url(http://blah.com:123456): Unable to parse URL in %s on line 15 +bool(false) +--> http://blah.com:abcdef : +Warning: parse_url(http://blah.com:abcdef): Unable to parse URL in %s on line 15 +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_basic_010.phpt b/ext/standard/tests/url/parse_url_basic_010.phpt new file mode 100644 index 0000000000..3bb2dba142 --- /dev/null +++ b/ext/standard/tests/url/parse_url_basic_010.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test parse_url() function : check values of URL related constants +--FILE-- + $constantValue) { + if (strpos($constantName, 'PHP_URL')===0) { + echo "$constantName: $constantValue \n"; + } +} + +echo "Done"; +?> +--EXPECTF-- +PHP_URL_SCHEME: 0 +PHP_URL_HOST: 1 +PHP_URL_PORT: 2 +PHP_URL_USER: 3 +PHP_URL_PASS: 4 +PHP_URL_PATH: 5 +PHP_URL_QUERY: 6 +PHP_URL_FRAGMENT: 7 +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_error_001.phpt b/ext/standard/tests/url/parse_url_error_001.phpt new file mode 100644 index 0000000000..0280a87cbc --- /dev/null +++ b/ext/standard/tests/url/parse_url_error_001.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test parse_url() function : error conditions - wrong number of args +--FILE-- + +--EXPECTF-- +*** Testing parse_url() : error conditions *** + +-- Testing parse_url() function with Zero arguments -- + +Warning: parse_url() expects at least 1 parameter, 0 given in %s on line 12 +NULL + +-- Testing parse_url() function with more than expected no. of arguments -- + +Warning: parse_url() expects at most 2 parameters, 3 given in %s on line 19 +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_error_002.phpt b/ext/standard/tests/url/parse_url_error_002.phpt new file mode 100644 index 0000000000..9939df2f0b --- /dev/null +++ b/ext/standard/tests/url/parse_url_error_002.phpt @@ -0,0 +1,73 @@ +--TEST-- +Test parse_url() function: url component specifier out of range +--FILE-- + Below range:"; +var_dump(parse_url($url, -1)); + +echo "\n\n--> Above range:"; +var_dump(parse_url($url, 99)); + +echo "Done" +?> +--EXPECTF-- +*** Testing parse_url() : error conditions: url component specifier out of range *** +--> Below range:array(8) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["user"]=> + string(6) "secret" + ["pass"]=> + string(7) "hideout" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + + +--> Above range: +Warning: parse_url(): Invalid URL component identifier 99 in %s on line 15 +bool(false) +Done +--UEXPECTF-- +*** Testing parse_url() : error conditions: url component specifier out of range *** +--> Below range:array(8) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"user"]=> + unicode(6) "secret" + [u"pass"]=> + unicode(7) "hideout" + [u"path"]=> + unicode(10) "/index.php" + [u"query"]=> + unicode(31) "test=1&test2=char&test3=mixesCI" + [u"fragment"]=> + unicode(16) "some_page_ref123" +} + + +--> Above range: +Warning: parse_url(): Invalid URL component identifier 99 in %s on line 15 +bool(false) +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_variation_001.phpt b/ext/standard/tests/url/parse_url_variation_001.phpt new file mode 100644 index 0000000000..d35612d9da --- /dev/null +++ b/ext/standard/tests/url/parse_url_variation_001.phpt @@ -0,0 +1,375 @@ +--TEST-- +Test parse_url() function : usage variations - unexpected type for arg 1 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for url + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( parse_url($value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing parse_url() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(60) +Error: 8 - Undefined variable: unset_var, %s(63) + +Arg value 0 +array(1) { + ["path"]=> + string(1) "0" +} + +Arg value 1 +array(1) { + ["path"]=> + string(1) "1" +} + +Arg value 12345 +array(1) { + ["path"]=> + string(5) "12345" +} + +Arg value -2345 +array(1) { + ["path"]=> + string(5) "-2345" +} + +Arg value 10.5 +array(1) { + ["path"]=> + string(4) "10.5" +} + +Arg value -10.5 +array(1) { + ["path"]=> + string(5) "-10.5" +} + +Arg value 101234567000 +array(1) { + ["path"]=> + string(12) "101234567000" +} + +Arg value 1.07654321E-9 +array(1) { + ["path"]=> + string(13) "1.07654321E-9" +} + +Arg value 0.5 +array(1) { + ["path"]=> + string(3) "0.5" +} +Error: 8 - Array to string conversion, %s(69) + +Arg value Array +Error: 2 - parse_url() expects parameter 1 to be string (Unicode or binary), array given, %s(70) +NULL +Error: 8 - Array to string conversion, %s(69) + +Arg value Array +Error: 2 - parse_url() expects parameter 1 to be string (Unicode or binary), array given, %s(70) +NULL +Error: 8 - Array to string conversion, %s(69) + +Arg value Array +Error: 2 - parse_url() expects parameter 1 to be string (Unicode or binary), array given, %s(70) +NULL +Error: 8 - Array to string conversion, %s(69) + +Arg value Array +Error: 2 - parse_url() expects parameter 1 to be string (Unicode or binary), array given, %s(70) +NULL +Error: 8 - Array to string conversion, %s(69) + +Arg value Array +Error: 2 - parse_url() expects parameter 1 to be string (Unicode or binary), array given, %s(70) +NULL + +Arg value +array(1) { + ["path"]=> + string(0) "" +} + +Arg value +array(1) { + ["path"]=> + string(0) "" +} + +Arg value 1 +array(1) { + ["path"]=> + string(1) "1" +} + +Arg value +array(1) { + ["path"]=> + string(0) "" +} + +Arg value 1 +array(1) { + ["path"]=> + string(1) "1" +} + +Arg value +array(1) { + ["path"]=> + string(0) "" +} + +Arg value +array(1) { + ["path"]=> + string(0) "" +} + +Arg value +array(1) { + ["path"]=> + string(0) "" +} +Error: 4096 - Object of class stdClass could not be converted to string, %s(69) + +Arg value +Error: 2 - parse_url() expects parameter 1 to be string (Unicode or binary), object given, %s(70) +NULL + +Arg value +array(1) { + ["path"]=> + string(0) "" +} + +Arg value +array(1) { + ["path"]=> + string(0) "" +} +Done +--UEXPECTF-- +*** Testing parse_url() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(60) +Error: 8 - Undefined variable: unset_var, %s(63) + +Arg value 0 +array(1) { + [u"path"]=> + unicode(1) "0" +} + +Arg value 1 +array(1) { + [u"path"]=> + unicode(1) "1" +} + +Arg value 12345 +array(1) { + [u"path"]=> + unicode(5) "12345" +} + +Arg value -2345 +array(1) { + [u"path"]=> + unicode(5) "-2345" +} + +Arg value 10.5 +array(1) { + [u"path"]=> + unicode(4) "10.5" +} + +Arg value -10.5 +array(1) { + [u"path"]=> + unicode(5) "-10.5" +} + +Arg value 101234567000 +array(1) { + [u"path"]=> + unicode(12) "101234567000" +} + +Arg value 1.07654321E-9 +array(1) { + [u"path"]=> + unicode(13) "1.07654321E-9" +} + +Arg value 0.5 +array(1) { + [u"path"]=> + unicode(3) "0.5" +} +Error: 8 - Array to string conversion, %s(69) + +Arg value Array +Error: 2 - parse_url() expects parameter 1 to be string (Unicode or binary), array given, %s(70) +NULL +Error: 8 - Array to string conversion, %s(69) + +Arg value Array +Error: 2 - parse_url() expects parameter 1 to be string (Unicode or binary), array given, %s(70) +NULL +Error: 8 - Array to string conversion, %s(69) + +Arg value Array +Error: 2 - parse_url() expects parameter 1 to be string (Unicode or binary), array given, %s(70) +NULL +Error: 8 - Array to string conversion, %s(69) + +Arg value Array +Error: 2 - parse_url() expects parameter 1 to be string (Unicode or binary), array given, %s(70) +NULL +Error: 8 - Array to string conversion, %s(69) + +Arg value Array +Error: 2 - parse_url() expects parameter 1 to be string (Unicode or binary), array given, %s(70) +NULL + +Arg value +array(1) { + [u"path"]=> + unicode(0) "" +} + +Arg value +array(1) { + [u"path"]=> + unicode(0) "" +} + +Arg value 1 +array(1) { + [u"path"]=> + unicode(1) "1" +} + +Arg value +array(1) { + [u"path"]=> + unicode(0) "" +} + +Arg value 1 +array(1) { + [u"path"]=> + unicode(1) "1" +} + +Arg value +array(1) { + [u"path"]=> + unicode(0) "" +} + +Arg value +array(1) { + [u"path"]=> + unicode(0) "" +} + +Arg value +array(1) { + [u"path"]=> + unicode(0) "" +} +Error: 4096 - Object of class stdClass could not be converted to string, %s(69) + +Arg value +Error: 2 - parse_url() expects parameter 1 to be string (Unicode or binary), object given, %s(70) +NULL + +Arg value +array(1) { + [u"path"]=> + unicode(0) "" +} + +Arg value +array(1) { + [u"path"]=> + unicode(0) "" +} +Done \ No newline at end of file diff --git a/ext/standard/tests/url/parse_url_variation_002.phpt b/ext/standard/tests/url/parse_url_variation_002.phpt new file mode 100644 index 0000000000..8c97113bcb --- /dev/null +++ b/ext/standard/tests/url/parse_url_variation_002.phpt @@ -0,0 +1,296 @@ +--TEST-- +Test parse_url() function : usage variations - unexpected type for arg 2 +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for url_component + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( parse_url($url, $value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing parse_url() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(61) +Error: 8 - Undefined variable: unset_var, %s(64) + +Arg value 10.5 +Error: 2 - parse_url(): Invalid URL component identifier 10, %s(71) +bool(false) + +Arg value -10.5 +array(8) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["user"]=> + string(6) "secret" + ["pass"]=> + string(7) "hideout" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} + +Arg value 101234567000 +Error: 2 - parse_url(): Invalid URL component identifier 2147483647, %s(71) +bool(false) + +Arg value 1.07654321E-9 +string(4) "http" + +Arg value 0.5 +string(4) "http" +Error: 8 - Array to string conversion, %s(70) + +Arg value Array +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +NULL +Error: 8 - Array to string conversion, %s(70) + +Arg value Array +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +NULL +Error: 8 - Array to string conversion, %s(70) + +Arg value Array +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +NULL +Error: 8 - Array to string conversion, %s(70) + +Arg value Array +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +NULL +Error: 8 - Array to string conversion, %s(70) + +Arg value Array +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +NULL + +Arg value +string(4) "http" + +Arg value +string(4) "http" + +Arg value 1 +string(11) "www.php.net" + +Arg value +string(4) "http" + +Arg value 1 +string(11) "www.php.net" + +Arg value +string(4) "http" + +Arg value +Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71) +NULL + +Arg value +Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71) +NULL + +Arg value string +Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71) +NULL + +Arg value string +Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71) +NULL +Error: 4096 - Object of class stdClass could not be converted to string, %s(70) + +Arg value +Error: 2 - parse_url() expects parameter 2 to be long, object given, %s(71) +NULL + +Arg value +string(4) "http" + +Arg value +string(4) "http" +Done +--UEXPECTF-- +*** Testing parse_url() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(61) +Error: 8 - Undefined variable: unset_var, %s(64) + +Arg value 10.5 +Error: 2 - parse_url(): Invalid URL component identifier 10, %s(71) +bool(false) + +Arg value -10.5 +array(8) { + [u"scheme"]=> + unicode(4) "http" + [u"host"]=> + unicode(11) "www.php.net" + [u"port"]=> + int(80) + [u"user"]=> + unicode(6) "secret" + [u"pass"]=> + unicode(7) "hideout" + [u"path"]=> + unicode(10) "/index.php" + [u"query"]=> + unicode(31) "test=1&test2=char&test3=mixesCI" + [u"fragment"]=> + unicode(16) "some_page_ref123" +} + +Arg value 101234567000 +Error: 2 - parse_url(): Invalid URL component identifier 2147483647, %s(71) +bool(false) + +Arg value 1.07654321E-9 +unicode(4) "http" + +Arg value 0.5 +unicode(4) "http" +Error: 8 - Array to string conversion, %s(70) + +Arg value Array +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +NULL +Error: 8 - Array to string conversion, %s(70) + +Arg value Array +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +NULL +Error: 8 - Array to string conversion, %s(70) + +Arg value Array +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +NULL +Error: 8 - Array to string conversion, %s(70) + +Arg value Array +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +NULL +Error: 8 - Array to string conversion, %s(70) + +Arg value Array +Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71) +NULL + +Arg value +unicode(4) "http" + +Arg value +unicode(4) "http" + +Arg value 1 +unicode(11) "www.php.net" + +Arg value +unicode(4) "http" + +Arg value 1 +unicode(11) "www.php.net" + +Arg value +unicode(4) "http" + +Arg value +Error: 2 - parse_url() expects parameter 2 to be long, Unicode string given, %s(71) +NULL + +Arg value +Error: 2 - parse_url() expects parameter 2 to be long, Unicode string given, %s(71) +NULL + +Arg value string +Error: 2 - parse_url() expects parameter 2 to be long, Unicode string given, %s(71) +NULL + +Arg value string +Error: 2 - parse_url() expects parameter 2 to be long, Unicode string given, %s(71) +NULL +Error: 4096 - Object of class stdClass could not be converted to string, %s(70) + +Arg value +Error: 2 - parse_url() expects parameter 2 to be long, object given, %s(71) +NULL + +Arg value +unicode(4) "http" + +Arg value +unicode(4) "http" +Done \ No newline at end of file diff --git a/ext/standard/tests/url/rawurldecode_error_001.phpt b/ext/standard/tests/url/rawurldecode_error_001.phpt new file mode 100644 index 0000000000..1dcaf40fd4 --- /dev/null +++ b/ext/standard/tests/url/rawurldecode_error_001.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test rawurldecode() function : error conditions - wrong number of args +--FILE-- + +--EXPECTF-- +*** Testing rawurldecode() : error conditions *** + +-- Testing rawurldecode() function with Zero arguments -- + +Warning: rawurldecode() expects exactly 1 parameter, 0 given in %s on line 14 +NULL + +-- Testing rawurldecode() function with more than expected no. of arguments -- + +Warning: rawurldecode() expects exactly 1 parameter, 2 given in %s on line 20 +NULL +Done diff --git a/ext/standard/tests/url/rawurldecode_variation_001.phpt b/ext/standard/tests/url/rawurldecode_variation_001.phpt new file mode 100644 index 0000000000..e7f7581390 --- /dev/null +++ b/ext/standard/tests/url/rawurldecode_variation_001.phpt @@ -0,0 +1,267 @@ +--TEST-- +Test rawurldecode() function : usage variations - unexpected type for arg 1. +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for str + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( rawurldecode($value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing rawurldecode() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +string(1) "0" + +Arg value 1 +string(1) "1" + +Arg value 12345 +string(5) "12345" + +Arg value -2345 +string(5) "-2345" + +Arg value 10.5 +string(4) "10.5" + +Arg value -10.5 +string(5) "-10.5" + +Arg value 101234567000 +string(12) "101234567000" + +Arg value 1.07654321E-9 +string(13) "1.07654321E-9" + +Arg value 0.5 +string(3) "0.5" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - rawurldecode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - rawurldecode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - rawurldecode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - rawurldecode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - rawurldecode() expects parameter 1 to be string, array given, %s(74) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value +string(0) "" +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 2 - rawurldecode() expects parameter 1 to be string, object given, %s(74) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" +Done +--UEXPECTF-- +*** Testing rawurldecode() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +string(1) "0" + +Arg value 1 +string(1) "1" + +Arg value 12345 +string(5) "12345" + +Arg value -2345 +string(5) "-2345" + +Arg value 10.5 +string(4) "10.5" + +Arg value -10.5 +string(5) "-10.5" + +Arg value 101234567000 +string(12) "101234567000" + +Arg value 1.07654321E-9 +string(13) "1.07654321E-9" + +Arg value 0.5 +string(3) "0.5" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - rawurldecode() expects parameter 1 to be binary string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - rawurldecode() expects parameter 1 to be binary string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - rawurldecode() expects parameter 1 to be binary string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - rawurldecode() expects parameter 1 to be binary string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - rawurldecode() expects parameter 1 to be binary string, array given, %s(74) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value +Error: 2 - rawurldecode() expects parameter 1 to be strictly a binary string, Unicode string given, %s(74) +NULL + +Arg value +Error: 2 - rawurldecode() expects parameter 1 to be strictly a binary string, Unicode string given, %s(74) +NULL +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 2 - rawurldecode() expects parameter 1 to be binary string, object given, %s(74) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" +Done diff --git a/ext/standard/tests/url/rawurlencode_error_001.phpt b/ext/standard/tests/url/rawurlencode_error_001.phpt new file mode 100644 index 0000000000..7acce9e0c4 --- /dev/null +++ b/ext/standard/tests/url/rawurlencode_error_001.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test rawurlencode() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing rawurlencode() : error conditions *** + +-- Testing rawurlencode() function with Zero arguments -- + +Warning: rawurlencode() expects exactly 1 parameter, 0 given in %s on line 14 +NULL + +-- Testing rawurlencode() function with more than expected no. of arguments -- + +Warning: rawurlencode() expects exactly 1 parameter, 2 given in %s on line 20 +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/url/rawurlencode_variation_001.phpt b/ext/standard/tests/url/rawurlencode_variation_001.phpt new file mode 100644 index 0000000000..b5fd86d7db --- /dev/null +++ b/ext/standard/tests/url/rawurlencode_variation_001.phpt @@ -0,0 +1,267 @@ +--TEST-- +Test rawurlencode() function : usage variations - unexpected type for arg 1. +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for str + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( rawurlencode($value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing rawurlencode() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +string(1) "0" + +Arg value 1 +string(1) "1" + +Arg value 12345 +string(5) "12345" + +Arg value -2345 +string(5) "-2345" + +Arg value 10.5 +string(4) "10.5" + +Arg value -10.5 +string(5) "-10.5" + +Arg value 101234567000 +string(12) "101234567000" + +Arg value 1.07654321E-9 +string(13) "1.07654321E-9" + +Arg value 0.5 +string(3) "0.5" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - rawurlencode() expects parameter 1 to be string, array given, %s(74) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value +string(0) "" +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 2 - rawurlencode() expects parameter 1 to be string, object given, %s(74) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" +Done +--UEXPECTF-- +*** Testing rawurlencode() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +string(1) "0" + +Arg value 1 +string(1) "1" + +Arg value 12345 +string(5) "12345" + +Arg value -2345 +string(5) "-2345" + +Arg value 10.5 +string(4) "10.5" + +Arg value -10.5 +string(5) "-10.5" + +Arg value 101234567000 +string(12) "101234567000" + +Arg value 1.07654321E-9 +string(13) "1.07654321E-9" + +Arg value 0.5 +string(3) "0.5" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - rawurlencode() expects parameter 1 to be binary string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - rawurlencode() expects parameter 1 to be binary string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - rawurlencode() expects parameter 1 to be binary string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - rawurlencode() expects parameter 1 to be binary string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - rawurlencode() expects parameter 1 to be binary string, array given, %s(74) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value +Error: 2 - rawurlencode() expects parameter 1 to be strictly a binary string, Unicode string given, %s(74) +NULL + +Arg value +Error: 2 - rawurlencode() expects parameter 1 to be strictly a binary string, Unicode string given, %s(74) +NULL +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 2 - rawurlencode() expects parameter 1 to be binary string, object given, %s(74) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" +Done diff --git a/ext/standard/tests/url/urldecode_error_001.phpt b/ext/standard/tests/url/urldecode_error_001.phpt new file mode 100644 index 0000000000..f0e5ae0838 --- /dev/null +++ b/ext/standard/tests/url/urldecode_error_001.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test urldecode() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing urldecode() : error conditions *** + +-- Testing urldecode() function with Zero arguments -- + +Warning: urldecode() expects exactly 1 parameter, 0 given in %s on line 14 +NULL + +-- Testing urldecode() function with more than expected no. of arguments -- + +Warning: urldecode() expects exactly 1 parameter, 2 given in %s on line 20 +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/url/urldecode_variation_001.phpt b/ext/standard/tests/url/urldecode_variation_001.phpt new file mode 100644 index 0000000000..e8b662908c --- /dev/null +++ b/ext/standard/tests/url/urldecode_variation_001.phpt @@ -0,0 +1,267 @@ +--TEST-- +Test urldecode() function : usage variations - +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for str + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( urldecode($value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing urldecode() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +string(1) "0" + +Arg value 1 +string(1) "1" + +Arg value 12345 +string(5) "12345" + +Arg value -2345 +string(5) "-2345" + +Arg value 10.5 +string(4) "10.5" + +Arg value -10.5 +string(5) "-10.5" + +Arg value 101234567000 +string(12) "101234567000" + +Arg value 1.07654321E-9 +string(13) "1.07654321E-9" + +Arg value 0.5 +string(3) "0.5" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - urldecode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - urldecode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - urldecode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - urldecode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - urldecode() expects parameter 1 to be string, array given, %s(74) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value +string(0) "" +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 2 - urldecode() expects parameter 1 to be string, object given, %s(74) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" +Done +--UEXPECTF-- +*** Testing urldecode() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +string(1) "0" + +Arg value 1 +string(1) "1" + +Arg value 12345 +string(5) "12345" + +Arg value -2345 +string(5) "-2345" + +Arg value 10.5 +string(4) "10.5" + +Arg value -10.5 +string(5) "-10.5" + +Arg value 101234567000 +string(12) "101234567000" + +Arg value 1.07654321E-9 +string(13) "1.07654321E-9" + +Arg value 0.5 +string(3) "0.5" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - urldecode() expects parameter 1 to be binary string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - urldecode() expects parameter 1 to be binary string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - urldecode() expects parameter 1 to be binary string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - urldecode() expects parameter 1 to be binary string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - urldecode() expects parameter 1 to be binary string, array given, %s(74) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value +Error: 2 - urldecode() expects parameter 1 to be strictly a binary string, Unicode string given, %s(74) +NULL + +Arg value +Error: 2 - urldecode() expects parameter 1 to be strictly a binary string, Unicode string given, %s(74) +NULL +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 2 - urldecode() expects parameter 1 to be binary string, object given, %s(74) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" +Done diff --git a/ext/standard/tests/url/urlencode_error_001.phpt b/ext/standard/tests/url/urlencode_error_001.phpt new file mode 100644 index 0000000000..fc00b057d8 --- /dev/null +++ b/ext/standard/tests/url/urlencode_error_001.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test urlencode() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing urlencode() : error conditions *** + +-- Testing urlencode() function with Zero arguments -- + +Warning: urlencode() expects exactly 1 parameter, 0 given in %s on line 14 +NULL + +-- Testing urlencode() function with more than expected no. of arguments -- + +Warning: urlencode() expects exactly 1 parameter, 2 given in %s on line 20 +NULL +Done \ No newline at end of file diff --git a/ext/standard/tests/url/urlencode_variation_001.phpt b/ext/standard/tests/url/urlencode_variation_001.phpt new file mode 100644 index 0000000000..0d0373458e --- /dev/null +++ b/ext/standard/tests/url/urlencode_variation_001.phpt @@ -0,0 +1,267 @@ +--TEST-- +Test urlencode() function : usage variations - +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new stdclass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for str + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( urlencode($value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing urlencode() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +string(1) "0" + +Arg value 1 +string(1) "1" + +Arg value 12345 +string(5) "12345" + +Arg value -2345 +string(5) "-2345" + +Arg value 10.5 +string(4) "10.5" + +Arg value -10.5 +string(5) "-10.5" + +Arg value 101234567000 +string(12) "101234567000" + +Arg value 1.07654321E-9 +string(13) "1.07654321E-9" + +Arg value 0.5 +string(3) "0.5" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - urlencode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - urlencode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - urlencode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - urlencode() expects parameter 1 to be string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - urlencode() expects parameter 1 to be string, array given, %s(74) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value +string(0) "" +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 2 - urlencode() expects parameter 1 to be string, object given, %s(74) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" +Done +--UEXPECTF-- +*** Testing urlencode() : usage variations *** +Error: 8 - Undefined variable: undefined_var, %s(64) +Error: 8 - Undefined variable: unset_var, %s(67) + +Arg value 0 +string(1) "0" + +Arg value 1 +string(1) "1" + +Arg value 12345 +string(5) "12345" + +Arg value -2345 +string(5) "-2345" + +Arg value 10.5 +string(4) "10.5" + +Arg value -10.5 +string(5) "-10.5" + +Arg value 101234567000 +string(12) "101234567000" + +Arg value 1.07654321E-9 +string(13) "1.07654321E-9" + +Arg value 0.5 +string(3) "0.5" +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - urlencode() expects parameter 1 to be binary string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - urlencode() expects parameter 1 to be binary string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - urlencode() expects parameter 1 to be binary string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - urlencode() expects parameter 1 to be binary string, array given, %s(74) +NULL +Error: 8 - Array to string conversion, %s(73) + +Arg value Array +Error: 2 - urlencode() expects parameter 1 to be binary string, array given, %s(74) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value +Error: 2 - urlencode() expects parameter 1 to be strictly a binary string, Unicode string given, %s(74) +NULL + +Arg value +Error: 2 - urlencode() expects parameter 1 to be strictly a binary string, Unicode string given, %s(74) +NULL +Error: 4096 - Object of class stdClass could not be converted to string, %s(73) + +Arg value +Error: 2 - urlencode() expects parameter 1 to be binary string, object given, %s(74) +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" +Done \ No newline at end of file diff --git a/ext/standard/tests/url/urls.inc b/ext/standard/tests/url/urls.inc new file mode 100644 index 0000000000..27521c8520 --- /dev/null +++ b/ext/standard/tests/url/urls.inc @@ -0,0 +1,109 @@ + \ No newline at end of file -- 2.40.0