summaryrefslogtreecommitdiff
path: root/ext/standard/tests/url/base64_decode_basic_003.phpt
blob: 521f959da43c39773a87e2b4f9ed983470f67874 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
--TEST--
Test base64_decode() function : basic functionality - padding and whitespace
--FILE--
<?php
echo "Test base64_decode (output as JSON):\n";
$data = [
    "", "=", "==", "===", "====",
    "V", "V=", "V==", "V===", "V====",
    "VV", "VV=", "VV==", "VV===", "VV====",
    "VVV", "VVV=", "VVV==", "VVV===", "VVV====",
    "VVVV", "VVVV=", "VVVV==", "VVVV===", "VVVV====",
    "=V", "=VV", "=VVV",
    "==V", "==VV", "==VVV",
    "===V", "===VV", "===VVV",
    "====V", "====VV", "====VVV",
    "=VVV", "V=VV", "VV=V", "VVV=",
    "=VVVV", "V=VVV", "VV=VV", "VVV=V", "VVVV=",
    "=VVV=", "V=VV=", "VV=V=", "VVV==",
    "\nVV", "V\nV", "VV\n",
    "\nVV==", "V\nV==", "VV\n==", "VV=\n=", "VV==\n",
    "*VV", "V*V", "VV*",
    "*VV==", "V*V==", "VV*==", "VV=*=", "VV==*",
    "\0VV==", "V\0V==", "VV\0==", "VV=\0=", "VV==\0",
    "\0VVV==", "V\0VV==", "VV\0V==", "VVV\0==", "VVV=\0=", "VVV==\0",
];
foreach ($data as $a) {
    $b = base64_decode($a, false);
    $c = base64_decode($a, true);
    printf("base64 %-16s non-strict %-8s strict %s\n", json_encode($a), json_encode($b), json_encode($c));
}
echo "Done\n";
?>
--EXPECT--
Test base64_decode (output as JSON):
base64 ""               non-strict ""       strict ""
base64 "="              non-strict ""       strict false
base64 "=="             non-strict ""       strict false
base64 "==="            non-strict ""       strict false
base64 "===="           non-strict ""       strict false
base64 "V"              non-strict ""       strict false
base64 "V="             non-strict ""       strict false
base64 "V=="            non-strict ""       strict false
base64 "V==="           non-strict ""       strict false
base64 "V===="          non-strict ""       strict false
base64 "VV"             non-strict "U"      strict "U"
base64 "VV="            non-strict "U"      strict false
base64 "VV=="           non-strict "U"      strict "U"
base64 "VV==="          non-strict "U"      strict false
base64 "VV===="         non-strict "U"      strict false
base64 "VVV"            non-strict "UU"     strict "UU"
base64 "VVV="           non-strict "UU"     strict "UU"
base64 "VVV=="          non-strict "UU"     strict false
base64 "VVV==="         non-strict "UU"     strict false
base64 "VVV===="        non-strict "UU"     strict false
base64 "VVVV"           non-strict "UUU"    strict "UUU"
base64 "VVVV="          non-strict "UUU"    strict false
base64 "VVVV=="         non-strict "UUU"    strict false
base64 "VVVV==="        non-strict "UUU"    strict false
base64 "VVVV===="       non-strict "UUU"    strict false
base64 "=V"             non-strict ""       strict false
base64 "=VV"            non-strict "U"      strict false
base64 "=VVV"           non-strict "UU"     strict false
base64 "==V"            non-strict ""       strict false
base64 "==VV"           non-strict "U"      strict false
base64 "==VVV"          non-strict "UU"     strict false
base64 "===V"           non-strict ""       strict false
base64 "===VV"          non-strict "U"      strict false
base64 "===VVV"         non-strict "UU"     strict false
base64 "====V"          non-strict ""       strict false
base64 "====VV"         non-strict "U"      strict false
base64 "====VVV"        non-strict "UU"     strict false
base64 "=VVV"           non-strict "UU"     strict false
base64 "V=VV"           non-strict "UU"     strict false
base64 "VV=V"           non-strict "UU"     strict false
base64 "VVV="           non-strict "UU"     strict "UU"
base64 "=VVVV"          non-strict "UUU"    strict false
base64 "V=VVV"          non-strict "UUU"    strict false
base64 "VV=VV"          non-strict "UUU"    strict false
base64 "VVV=V"          non-strict "UUU"    strict false
base64 "VVVV="          non-strict "UUU"    strict false
base64 "=VVV="          non-strict "UU"     strict false
base64 "V=VV="          non-strict "UU"     strict false
base64 "VV=V="          non-strict "UU"     strict false
base64 "VVV=="          non-strict "UU"     strict false
base64 "\nVV"           non-strict "U"      strict "U"
base64 "V\nV"           non-strict "U"      strict "U"
base64 "VV\n"           non-strict "U"      strict "U"
base64 "\nVV=="         non-strict "U"      strict "U"
base64 "V\nV=="         non-strict "U"      strict "U"
base64 "VV\n=="         non-strict "U"      strict "U"
base64 "VV=\n="         non-strict "U"      strict "U"
base64 "VV==\n"         non-strict "U"      strict "U"
base64 "*VV"            non-strict "U"      strict false
base64 "V*V"            non-strict "U"      strict false
base64 "VV*"            non-strict "U"      strict false
base64 "*VV=="          non-strict "U"      strict false
base64 "V*V=="          non-strict "U"      strict false
base64 "VV*=="          non-strict "U"      strict false
base64 "VV=*="          non-strict "U"      strict false
base64 "VV==*"          non-strict "U"      strict false
base64 "\u0000VV=="     non-strict "U"      strict false
base64 "V\u0000V=="     non-strict "U"      strict false
base64 "VV\u0000=="     non-strict "U"      strict false
base64 "VV=\u0000="     non-strict "U"      strict false
base64 "VV==\u0000"     non-strict "U"      strict false
base64 "\u0000VVV=="    non-strict "UU"     strict false
base64 "V\u0000VV=="    non-strict "UU"     strict false
base64 "VV\u0000V=="    non-strict "UU"     strict false
base64 "VVV\u0000=="    non-strict "UU"     strict false
base64 "VVV=\u0000="    non-strict "UU"     strict false
base64 "VVV==\u0000"    non-strict "UU"     strict false
Done