Skip to content

Commit

Permalink
Merge 0ca738b into 5015fb0
Browse files Browse the repository at this point in the history
  • Loading branch information
jderusse committed Mar 6, 2019
2 parents 5015fb0 + 0ca738b commit 572d887
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 1 deletion.
1 change: 1 addition & 0 deletions generated/functionsList.php
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,7 @@
'uopz_implement',
'base64_decode',
'get_headers',
'parse_url',
'settype',
'xdiff_file_bdiff',
'xdiff_file_bpatch',
Expand Down
2 changes: 1 addition & 1 deletion generated/ibmDb2.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* @return mixed When db2_autocommit receives only the
* connection parameter, it returns the current state
* of AUTOCOMMIT for the requested connection as an integer value. A value of
* 0 indicates that AUTOCOMMIT is off, while a value of 1 indicates that
* DB2_AUTOCOMMIT_OFF indicates that AUTOCOMMIT is off, while a value of DB2_AUTOCOMMIT_ON indicates that
* AUTOCOMMIT is on.
*
* When db2_autocommit receives both the
Expand Down
87 changes: 87 additions & 0 deletions generated/url.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,90 @@ function get_headers(string $url, int $format = 0, $context = null): array
}
return $result;
}


/**
* This function parses a URL and returns an associative array containing any
* of the various components of the URL that are present.
* The values of the array elements are not URL decoded.
*
* This function is not meant to validate
* the given URL, it only breaks it up into the above listed parts. Partial
* URLs are also accepted, parse_url tries its best to
* parse them correctly.
*
* @param string $url The URL to parse. Invalid characters are replaced by
* _.
* @param int $component Specify one of PHP_URL_SCHEME,
* PHP_URL_HOST, PHP_URL_PORT,
* PHP_URL_USER, PHP_URL_PASS,
* PHP_URL_PATH, PHP_URL_QUERY
* or PHP_URL_FRAGMENT to retrieve just a specific
* URL component as a string (except when
* PHP_URL_PORT is given, in which case the return
* value will be an integer).
* @return mixed On seriously malformed URLs, parse_url.
*
* If the component parameter is omitted, an
* associative array is returned. At least one element will be
* present within the array. Potential keys within this array are:
*
*
*
* scheme - e.g. http
*
*
*
*
* host
*
*
*
*
* port
*
*
*
*
* user
*
*
*
*
* pass
*
*
*
*
* path
*
*
*
*
* query - after the question mark ?
*
*
*
*
* fragment - after the hashmark #
*
*
*
*
* If the component parameter is specified,
* parse_url returns a string (or an
* integer, in the case of PHP_URL_PORT)
* instead of an array. If the requested component doesn't exist
* within the given URL, NULL will be returned.
* @throws UrlException
*
*/
function parse_url(string $url, int $component = -1)
{
error_clear_last();
$result = \parse_url($url, $component);
if ($result === false) {
throw UrlException::createFromPhpError();
}
return $result;
}
3 changes: 3 additions & 0 deletions generator/src/DocPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public function detectFalsyFunction(): bool
if (preg_match('/&false;\s+otherwise/m', $file) && !preg_match('/(returns\s+&true;|&true;\s+on\s+success|&true;\s+if)/im', $file)) {
return true;
}
if (preg_match('/may\s+return\s+&false;/m', $file) && !preg_match('/(returns\s+&true;|&true;\s+on\s+success|&true;\s+if)/im', $file)) {
return true;
}
if (preg_match('/&false;\s+if\s+an\s+error\s+occurred/m', $file)) {
return true;
}
Expand Down
1 change: 1 addition & 0 deletions generator/src/Method.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ private function stripReturnFalseText(string $string): string
{
$string = \strip_tags($string);
$string = $this->removeString($string, 'or FALSE on failure');
$string = $this->removeString($string, 'may return FALSE');
$string = $this->removeString($string, 'and FALSE on failure');
$string = $this->removeString($string, 'on success, or FALSE otherwise');
$string = $this->removeString($string, 'or FALSE on error');
Expand Down
1 change: 1 addition & 0 deletions rector-migrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,7 @@ services:
uopz_implement: 'Safe\uopz_implement'
base64_decode: 'Safe\base64_decode'
get_headers: 'Safe\get_headers'
parse_url: 'Safe\parse_url'
settype: 'Safe\settype'
xdiff_file_bdiff: 'Safe\xdiff_file_bdiff'
xdiff_file_bpatch: 'Safe\xdiff_file_bpatch'
Expand Down

0 comments on commit 572d887

Please sign in to comment.