mirror of
https://github.com/php/php-src.git
synced 2024-09-22 18:37:25 +00:00
7a02704c0e
As the tests already show, the data URI wrapper is supposed to fail for corrupt input, but for some reason, one case of invalid input is still allowed to pass?! Strict base64 makes a lot more sense here. Also, Chromium and Firefox fail on invalid base64, so it's a logical choice for PHP as well.
36 lines
927 B
PHP
36 lines
927 B
PHP
--TEST--
|
|
Stream: RFC2397 with corrupt? payload
|
|
--INI--
|
|
allow_url_fopen=1
|
|
--FILE--
|
|
<?php
|
|
|
|
$streams = array(
|
|
"data:;base64,\0Zm9vYmFyIGZvb2Jhcg==",
|
|
"data:;base64,Zm9vYmFy\0IGZvb2Jhcg==",
|
|
'data:;base64,#Zm9vYmFyIGZvb2Jhcg==',
|
|
'data:;base64,#Zm9vYmFyIGZvb2Jhc=',
|
|
);
|
|
|
|
foreach($streams as $stream)
|
|
{
|
|
var_dump(file_get_contents($stream));
|
|
}
|
|
|
|
?>
|
|
===DONE===
|
|
<?php exit(0); ?>
|
|
--EXPECTF--
|
|
Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s line %d
|
|
NULL
|
|
|
|
Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s line %d
|
|
NULL
|
|
|
|
Warning: file_get_contents(data:;base64,#Zm9vYmFyIGZvb2Jhcg==): failed to open stream: rfc2397: unable to decode in %sstream_rfc2397_006.php on line %d
|
|
bool(false)
|
|
|
|
Warning: file_get_contents(data:;base64,#Zm9vYmFyIGZvb2Jhc=): failed to open stream: rfc2397: unable to decode in %sstream_rfc2397_006.php on line %d
|
|
bool(false)
|
|
===DONE===
|