Issues (60)

examples/upload/josh_sean.php (1 issue)

Labels
Severity
1
<?php
2
3
function generateUpToDateMimeArray(string $url): array
4
{
5
	$s = array();
6
	foreach (@explode("\n", @file_get_contents($url)) as $x) {
0 ignored issues
show
It seems like @file_get_contents($url) can also be of type false; however, parameter $string of explode() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

6
	foreach (@explode("\n", /** @scrutinizer ignore-type */ @file_get_contents($url)) as $x) {
Loading history...
7
		if (isset($x[0]) && $x[0] !== '#' && preg_match_all('#([^\s]+)#', $x, $out) && isset($out[1]) && ($c = count($out[1])) > 1) {
8
			for ($i = 1; $i < $c; $i++) {
9
				$s[$out[1][$i]] = $out[1][0];
10
			}
11
		}
12
	}
13
	return $s;
14
}
15
16
$data = generateUpToDateMimeArray('https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types');
17
echo '<pre>' . json_encode($data, JSON_PRETTY_PRINT) . '</pre>';