Skip to content

Commit

Permalink
Ensure Compatibility to supported range of PHP Versions (#32)
Browse files Browse the repository at this point in the history
* PHP8.1; Fix UriHelper Automatic conversion of false to array, upstream for Joomla #36774 (#30)

Co-authored-by: Michael Babker <[email protected]>
Co-authored-by: Hannes Papenberg <[email protected]>
Co-authored-by: Robert Deutz <[email protected]>
Co-authored-by: JProof <[email protected]>
Co-authored-by: Phil Taylor <[email protected]>
Co-authored-by: beat <[email protected]>
  • Loading branch information
7 people authored Jan 25, 2022
1 parent 12042a4 commit 5046ea5
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ local composer(phpversion, params) = {
local phpunit(phpversion) = {
name: "PHPUnit",
image: "joomlaprojects/docker-images:php" + phpversion,
[if phpversion == "8.0" then "failure"]: "ignore",
commands: ["vendor/bin/phpunit"]
};

Expand Down Expand Up @@ -110,5 +109,6 @@ local pipeline(name, phpversion, params) = {
pipeline("7.2", "7.2", "--prefer-stable"),
pipeline("7.3", "7.3", "--prefer-stable"),
pipeline("7.4", "7.4", "--prefer-stable"),
pipeline("8.0", "8.0", "--ignore-platform-reqs --prefer-stable")
pipeline("8.0", "8.0", "--prefer-stable"),
pipeline("8.1", "8.1", "--prefer-stable")
]
33 changes: 30 additions & 3 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ steps:
image: joomlaprojects/docker-images:php8.0
commands:
- php -v
- composer update --ignore-platform-reqs --prefer-stable
- composer update --prefer-stable
volumes:
- name: composer-cache
path: /tmp/composer-cache
Expand All @@ -190,7 +190,34 @@ steps:
image: joomlaprojects/docker-images:php8.0
commands:
- vendor/bin/phpunit
failure: ignore

volumes:
- name: composer-cache
host:
path: /tmp/composer-cache

---
kind: pipeline
name: PHP 8.1

platform:
os: linux
arch: amd64

steps:
- name: composer
image: joomlaprojects/docker-images:php8.1
commands:
- php -v
- composer update --prefer-stable
volumes:
- name: composer-cache
path: /tmp/composer-cache

- name: PHPUnit
image: joomlaprojects/docker-images:php8.1
commands:
- vendor/bin/phpunit

volumes:
- name: composer-cache
Expand All @@ -199,6 +226,6 @@ volumes:

---
kind: signature
hmac: 8382dbf5577f074439bfa6182a30ce231e341f6430dbb23b9b814ea3e552c9c7
hmac: ef7eaaa4dab03be15f5ca91154f6a0bd0fb572b615feb5de5ab8c800cfe03b0e

...
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Unix-style newlines with a newline ending every file
[*]
indent_style = tab
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ composer.phar
composer.lock
phpunit.xml
.phpunit.result.cache
/build/
6 changes: 3 additions & 3 deletions src/AbstractUri.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function __toString()
*
* @since 1.0
*/
public function toString(array $parts = ['scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment'])
public function toString($parts = ['scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment'])
{
$bitmask = 0;

Expand Down Expand Up @@ -342,7 +342,7 @@ public function isSsl()
* @see parse_str()
* @since 1.0
*/
protected static function buildQuery(array $params)
protected static function buildQuery($params)
{
return urldecode(http_build_query($params, '', '&'));
}
Expand Down Expand Up @@ -376,7 +376,7 @@ protected function parse($uri)
$retval = ($parts) ? true : false;

// We need to replace &amp; with & for parse_str to work right...
if (isset($parts['query']) && strpos($parts['query'], '&amp;'))
if (isset($parts['query']) && strpos($parts['query'], '&amp;') !== false)
{
$parts['query'] = str_replace('&amp;', '&', $parts['query']);
}
Expand Down
2 changes: 2 additions & 0 deletions src/UriHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class UriHelper
*/
public static function parse_url($url, $component = -1)
{
$result = [];

// If no UTF-8 chars in the url just parse it using php native parse_url which is faster.
if (utf8_decode($url) === $url)
{
Expand Down
20 changes: 10 additions & 10 deletions src/UriInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,71 +23,71 @@ interface UriInterface
* @var integer
* @since 1.2.0
*/
const SCHEME = 1;
public const SCHEME = 1;

/**
* Include the user
*
* @var integer
* @since 1.2.0
*/
const USER = 2;
public const USER = 2;

/**
* Include the password
*
* @var integer
* @since 1.2.0
*/
const PASS = 4;
public const PASS = 4;

/**
* Include the host
*
* @var integer
* @since 1.2.0
*/
const HOST = 8;
public const HOST = 8;

/**
* Include the port
*
* @var integer
* @since 1.2.0
*/
const PORT = 16;
public const PORT = 16;

/**
* Include the path
*
* @var integer
* @since 1.2.0
*/
const PATH = 32;
public const PATH = 32;

/**
* Include the query string
*
* @var integer
* @since 1.2.0
*/
const QUERY = 64;
public const QUERY = 64;

/**
* Include the fragment
*
* @var integer
* @since 1.2.0
*/
const FRAGMENT = 128;
public const FRAGMENT = 128;

/**
* Include all available url parts (scheme, user, pass, host, port, path, query, fragment)
*
* @var integer
* @since 1.2.0
*/
const ALL = 255;
public const ALL = 255;

/**
* Magic method to get the string representation of the URI object.
Expand All @@ -107,7 +107,7 @@ public function __toString();
*
* @since 1.0
*/
public function toString(array $parts = ['scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment']);
public function toString($parts = ['scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment']);

/**
* Checks if variable exists.
Expand Down

0 comments on commit 5046ea5

Please sign in to comment.