1--TEST--
2Test base64_decode() function : basic functionality - strict vs non-strict with non-base64 chars.
3--FILE--
4<?php
5echo "Decode 'hello world!':\n";
6$noWhiteSpace = "aGVsbG8gd29ybGQh";
7var_dump(base64_decode($noWhiteSpace));
8var_dump(base64_decode($noWhiteSpace, false));
9var_dump(base64_decode($noWhiteSpace, true));
10
11echo "\nWhitespace does not affect base64_decode, even with \$strict===true:\n";
12$withWhiteSpace = "a GVs   bG8gd2
13                        9ybGQh";
14var_dump(base64_decode($withWhiteSpace));
15var_dump(base64_decode($withWhiteSpace, false));
16var_dump(base64_decode($withWhiteSpace, true));
17
18echo "\nOther chars outside the base64 alphabet are ignored when \$strict===false, but cause failure with \$strict===true:\n";
19$badChars = $noWhiteSpace . '*';
20var_dump(base64_decode($badChars));
21var_dump(base64_decode($badChars, false));
22var_dump(base64_decode($badChars, true));
23
24echo "Done";
25?>
26--EXPECT--
27Decode 'hello world!':
28string(12) "hello world!"
29string(12) "hello world!"
30string(12) "hello world!"
31
32Whitespace does not affect base64_decode, even with $strict===true:
33string(12) "hello world!"
34string(12) "hello world!"
35string(12) "hello world!"
36
37Other chars outside the base64 alphabet are ignored when $strict===false, but cause failure with $strict===true:
38string(12) "hello world!"
39string(12) "hello world!"
40bool(false)
41Done
42