Removed warning suppression from parse_url().
PUC uses parse_url() in a number of places to parse the metadata URL or repository URL. If someone provides an invalid URL then that's already a configuration error so it's not necessary to hide the warnings emitted by parse_url(). Also, as of PHP 5.3.3, parse_url() no longer emits warnings when it fails to parse something, so anyone using an actively supported PHP version (7.2+) wouldn't see any warnings anyway.
This commit is contained in:
parent
45374e3c02
commit
5f856d8d80
|
|
@ -188,8 +188,8 @@ if ( !class_exists('Puc_v4p6_Factory', false) ):
|
|||
$service = null;
|
||||
|
||||
//Which hosting service does the URL point to?
|
||||
$host = @parse_url($metadataUrl, PHP_URL_HOST);
|
||||
$path = @parse_url($metadataUrl, PHP_URL_PATH);
|
||||
$host = parse_url($metadataUrl, PHP_URL_HOST);
|
||||
$path = parse_url($metadataUrl, PHP_URL_PATH);
|
||||
|
||||
//Check if the path looks like "/user-name/repository".
|
||||
//For GitLab.com it can also be "/user/group1/group2/.../repository".
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ if ( !class_exists('Puc_v4p6_OAuthSignature', false) ):
|
|||
$parameters = array();
|
||||
|
||||
//Parse query parameters.
|
||||
$query = @parse_url($url, PHP_URL_QUERY);
|
||||
$query = parse_url($url, PHP_URL_QUERY);
|
||||
if ( !empty($query) ) {
|
||||
parse_str($query, $parsedParams);
|
||||
if ( is_array($parameters) ) {
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ if ( !class_exists('Puc_v4p6_UpdateChecker', false) ):
|
|||
public function allowMetadataHost($allow, $host) {
|
||||
static $metadataHost = 0; //Using 0 instead of NULL because parse_url can return NULL.
|
||||
if ( $metadataHost === 0 ) {
|
||||
$metadataHost = @parse_url($this->metadataUrl, PHP_URL_HOST);
|
||||
$metadataHost = parse_url($this->metadataUrl, PHP_URL_HOST);
|
||||
}
|
||||
|
||||
if ( is_string($metadataHost) && (strtolower($host) === strtolower($metadataHost)) ) {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ if ( !class_exists('Puc_v4p6_Vcs_BitBucketApi', false) ):
|
|||
private $repository;
|
||||
|
||||
public function __construct($repositoryUrl, $credentials = array()) {
|
||||
$path = @parse_url($repositoryUrl, PHP_URL_PATH);
|
||||
$path = parse_url($repositoryUrl, PHP_URL_PATH);
|
||||
if ( preg_match('@^/?(?P<username>[^/]+?)/(?P<repository>[^/#?&]+?)/?$@', $path, $matches) ) {
|
||||
$this->username = $matches['username'];
|
||||
$this->repository = $matches['repository'];
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ if ( !class_exists('Puc_v4p6_Vcs_GitHubApi', false) ):
|
|||
protected $assetApiBaseUrl = null;
|
||||
|
||||
public function __construct($repositoryUrl, $accessToken = null) {
|
||||
$path = @parse_url($repositoryUrl, PHP_URL_PATH);
|
||||
$path = parse_url($repositoryUrl, PHP_URL_PATH);
|
||||
if ( preg_match('@^/?(?P<username>[^/]+?)/(?P<repository>[^/#?&]+?)/?$@', $path, $matches) ) {
|
||||
$this->userName = $matches['username'];
|
||||
$this->repositoryName = $matches['repository'];
|
||||
|
|
|
|||
|
|
@ -30,18 +30,18 @@ if ( !class_exists('Puc_v4p6_Vcs_GitLabApi', false) ):
|
|||
|
||||
public function __construct($repositoryUrl, $accessToken = null) {
|
||||
//Parse the repository host to support custom hosts.
|
||||
$port = @parse_url($repositoryUrl, PHP_URL_PORT);
|
||||
$port = parse_url($repositoryUrl, PHP_URL_PORT);
|
||||
if ( !empty($port) ){
|
||||
$port = ':' . $port;
|
||||
}
|
||||
$this->repositoryHost = @parse_url($repositoryUrl, PHP_URL_HOST) . $port;
|
||||
$this->repositoryHost = parse_url($repositoryUrl, PHP_URL_HOST) . $port;
|
||||
|
||||
if ( $this->repositoryHost !== 'gitlab.com' ) {
|
||||
$this->repositoryProtocol = @parse_url($repositoryUrl, PHP_URL_SCHEME);
|
||||
$this->repositoryProtocol = parse_url($repositoryUrl, PHP_URL_SCHEME);
|
||||
}
|
||||
|
||||
//Find the repository information
|
||||
$path = @parse_url($repositoryUrl, PHP_URL_PATH);
|
||||
$path = parse_url($repositoryUrl, PHP_URL_PATH);
|
||||
if ( preg_match('@^/?(?P<username>[^/]+?)/(?P<repository>[^/#?&]+?)/?$@', $path, $matches) ) {
|
||||
$this->userName = $matches['username'];
|
||||
$this->repositoryName = $matches['repository'];
|
||||
|
|
|
|||
Loading…
Reference in New Issue