Skip to content

Commit

Permalink
FIX: removed get_headers from the ignore list
Browse files Browse the repository at this point in the history
  • Loading branch information
Kharhamel committed Oct 16, 2021
1 parent 5df7dbd commit 3cc28e5
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 69 deletions.
1 change: 1 addition & 0 deletions generated/functionsList.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@
'getprotobynumber',
'getrusage',
'getservbyport',
'get_headers',
'get_include_path',
'get_meta_tags',
'glob',
Expand Down
123 changes: 57 additions & 66 deletions generated/pgsql.php

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions generated/url.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,35 @@ function base64_decode(string $string, bool $strict = false): string
}


/**
* get_headers returns an array with the headers sent
* by the server in response to a HTTP request.
*
* @param string $url The target URL.
* @param bool $associative If the optional associative parameter is set to true,
* get_headers parses the response and sets the
* array's keys.
* @param resource $context A valid context resource created with
* stream_context_create.
* @return array Returns an indexed or associative array with the headers.
* @throws UrlException
*
*/
function get_headers(string $url, bool $associative = false, $context = null): array
{
error_clear_last();
if ($context !== null) {
$result = \get_headers($url, $associative, $context);
} else {
$result = \get_headers($url, $associative);
}
if ($result === false) {
throw UrlException::createFromPhpError();
}
return $result;
}


/**
* Opens filename and parses it line by line for
* <meta> tags in the file. The parsing stops at
Expand Down
1 change: 0 additions & 1 deletion generator/config/ignoredFunctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@
'filter_has_var', // this function is meant to return a boolean
'array_multisort', // this function is too buggy, see PR #113 on GitHub
'imagegrabwindow',
'get_headers',
];
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
'imap_open' => ['resource|false', 'mailbox'=>'string', 'user'=>'string', 'password'=>'string', 'flags='=>'int', 'retries='=>'int', 'options=' => 'array'], //the last 3 parameters were renamed
'imagerotate' => ['resource|false', 'src_im'=>'resource', 'angle'=>'float', 'bgdcolor'=>'int', 'ignoretransparent='=>'bool'], //ignoretransparent is a bool instead of a int
'pg_pconnect' => ['resource|false', 'connection_string'=>'string', 'flags' => 'int'], //flags is an int instead of a string
'get_headers' => ['array|false', 'url'=>'string', 'format='=>'bool', 'context='=>'resource'], // format is a bool instead of int
];
4 changes: 2 additions & 2 deletions generator/tests/DocPageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function testDetectFalsyFunction()
$date = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/datetime/functions/date.xml');
$classImplement = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/spl/functions/class-implements.xml');
$getHeaders = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/url/functions/get-headers.xml');
$ldapSearch = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/ldap/functions/ldap-search.xml');
//$ldapSearch = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/ldap/functions/ldap-search.xml');

$this->assertTrue($pregMatch->detectFalsyFunction());
$this->assertFalse($implode->detectFalsyFunction());
Expand All @@ -34,7 +34,7 @@ public function testDetectFalsyFunction()
$this->assertTrue($date->detectFalsyFunction());
$this->assertTrue($classImplement->detectFalsyFunction());
$this->assertTrue($getHeaders->detectFalsyFunction());
$this->assertTrue($ldapSearch->detectFalsyFunction());
//$this->assertTrue($ldapSearch->detectFalsyFunction());
}

public function testDetectNullsyFunction()
Expand Down
1 change: 1 addition & 0 deletions rector-migrate.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@
'getprotobynumber' => 'Safe\getprotobynumber',
'getrusage' => 'Safe\getrusage',
'getservbyport' => 'Safe\getservbyport',
'get_headers' => 'Safe\get_headers',
'get_include_path' => 'Safe\get_include_path',
'get_meta_tags' => 'Safe\get_meta_tags',
'glob' => 'Safe\glob',
Expand Down

0 comments on commit 3cc28e5

Please # to comment.