From 07bf19243e00b981b1e9460da980e5343a250a7a Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Sat, 25 Sep 2021 10:44:28 +0200 Subject: [PATCH] Patch 3rd party libs for PHP 8.1 Patch Slim Patch Smarty Patch Smarty-View Use upstream php81 compatible pimple version refs #1570 --- galette/composer.json | 4 +- galette/composer.lock | 40 +++++------ patches/slim-php81.patch | 118 ++++++++++++++++++++++++++++++++ patches/smarty-php81.patch | 12 ++++ patches/smarty-view-php81.patch | 39 +++++++++++ patches/tcpdf-hrs.patch | 23 ------- 6 files changed, 192 insertions(+), 44 deletions(-) create mode 100644 patches/slim-php81.patch create mode 100644 patches/smarty-php81.patch create mode 100644 patches/smarty-view-php81.patch delete mode 100644 patches/tcpdf-hrs.patch diff --git a/galette/composer.json b/galette/composer.json index f6313654f..c9f4aa689 100644 --- a/galette/composer.json +++ b/galette/composer.json @@ -60,7 +60,9 @@ }, "scripts": { "post-install-cmd": [ - "patch -d vendor/tecnickcom/tcpdf/ -p3 < ../patches/tcpdf-hrs.patch" + "patch -d vendor/slim/slim/ -p3 < ../patches/slim-php81.patch", + "patch -d vendor/smarty/smarty/ -p3 < ../patches/smarty-php81.patch", + "patch -d vendor/mathmarques/smarty-view/ -p3 < ../patches/smarty-view-php81.patch" ] } } diff --git a/galette/composer.lock b/galette/composer.lock index 2c3bc453d..34aff016c 100644 --- a/galette/composer.lock +++ b/galette/composer.lock @@ -2452,24 +2452,24 @@ }, { "name": "pimple/pimple", - "version": "v3.4.0", + "version": "v3.5.0", "source": { "type": "git", "url": "https://github.com/silexphp/Pimple.git", - "reference": "86406047271859ffc13424a048541f4531f53601" + "reference": "a94b3a4db7fb774b3d78dad2315ddc07629e1bed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/silexphp/Pimple/zipball/86406047271859ffc13424a048541f4531f53601", - "reference": "86406047271859ffc13424a048541f4531f53601", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/a94b3a4db7fb774b3d78dad2315ddc07629e1bed", + "reference": "a94b3a4db7fb774b3d78dad2315ddc07629e1bed", "shasum": "" }, "require": { "php": ">=7.2.5", - "psr/container": "^1.1" + "psr/container": "^1.1 || ^2.0" }, "require-dev": { - "symfony/phpunit-bridge": "^5.0" + "symfony/phpunit-bridge": "^5.4@dev" }, "type": "library", "extra": { @@ -2499,9 +2499,9 @@ "dependency injection" ], "support": { - "source": "https://github.com/silexphp/Pimple/tree/v3.4.0" + "source": "https://github.com/silexphp/Pimple/tree/v3.5.0" }, - "time": "2021-03-06T08:28:00+00:00" + "time": "2021-10-28T11:13:42+00:00" }, { "name": "psr/cache", @@ -3336,16 +3336,16 @@ }, { "name": "symfony/console", - "version": "v5.3.7", + "version": "v5.3.10", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "8b1008344647462ae6ec57559da166c2bfa5e16a" + "reference": "d4e409d9fbcfbf71af0e5a940abb7b0b4bad0bd3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/8b1008344647462ae6ec57559da166c2bfa5e16a", - "reference": "8b1008344647462ae6ec57559da166c2bfa5e16a", + "url": "https://api.github.com/repos/symfony/console/zipball/d4e409d9fbcfbf71af0e5a940abb7b0b4bad0bd3", + "reference": "d4e409d9fbcfbf71af0e5a940abb7b0b4bad0bd3", "shasum": "" }, "require": { @@ -3415,7 +3415,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.3.7" + "source": "https://github.com/symfony/console/tree/v5.3.10" }, "funding": [ { @@ -3431,7 +3431,7 @@ "type": "tidelift" } ], - "time": "2021-08-25T20:02:16+00:00" + "time": "2021-10-26T09:30:15+00:00" }, { "name": "symfony/deprecation-contracts", @@ -4129,16 +4129,16 @@ }, { "name": "symfony/string", - "version": "v5.3.7", + "version": "v5.3.10", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5" + "reference": "d70c35bb20bbca71fc4ab7921e3c6bda1a82a60c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/8d224396e28d30f81969f083a58763b8b9ceb0a5", - "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5", + "url": "https://api.github.com/repos/symfony/string/zipball/d70c35bb20bbca71fc4ab7921e3c6bda1a82a60c", + "reference": "d70c35bb20bbca71fc4ab7921e3c6bda1a82a60c", "shasum": "" }, "require": { @@ -4192,7 +4192,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.3.7" + "source": "https://github.com/symfony/string/tree/v5.3.10" }, "funding": [ { @@ -4208,7 +4208,7 @@ "type": "tidelift" } ], - "time": "2021-08-26T08:00:08+00:00" + "time": "2021-10-27T18:21:46+00:00" } ], "aliases": [], diff --git a/patches/slim-php81.patch b/patches/slim-php81.patch new file mode 100644 index 000000000..67c5340d8 --- /dev/null +++ b/patches/slim-php81.patch @@ -0,0 +1,118 @@ +diff -up vendor/slim/slim/Slim/App.php.patch vendor/slim/slim/Slim/App.php +--- vendor/slim/slim/Slim/App.php.patch 2021-10-11 15:47:02.759006753 +0200 ++++ vendor/slim/slim/Slim/App.php 2021-10-11 15:42:04.816335261 +0200 +@@ -663,7 +663,7 @@ class App + */ + protected function isHeadRequest(RequestInterface $request) + { +- return strtoupper($request->getMethod()) === 'HEAD'; ++ return strtoupper($request->getMethod() ?? '') === 'HEAD'; + } + + /** +diff -up vendor/slim/slim/Slim/Collection.php.patch vendor/slim/slim/Slim/Collection.php +--- vendor/slim/slim/Slim/Collection.php.patch 2021-10-11 15:46:20.250066699 +0200 ++++ vendor/slim/slim/Slim/Collection.php 2021-10-11 15:04:06.200385425 +0200 +@@ -109,7 +109,7 @@ class Collection implements CollectionIn + * + * @return bool + */ +- public function offsetExists($key) ++ public function offsetExists($key): bool + { + return $this->has($key); + } +@@ -121,6 +121,7 @@ class Collection implements CollectionIn + * + * @return mixed The key's value, or the default value + */ ++ #[\ReturnTypeWillChange] + public function offsetGet($key) + { + return $this->get($key); +@@ -132,7 +133,7 @@ class Collection implements CollectionIn + * @param string $key The data key + * @param mixed $value The data value + */ +- public function offsetSet($key, $value) ++ public function offsetSet($key, $value): void + { + $this->set($key, $value); + } +@@ -142,7 +143,7 @@ class Collection implements CollectionIn + * + * @param string $key The data key + */ +- public function offsetUnset($key) ++ public function offsetUnset($key): void + { + $this->remove($key); + } +@@ -152,7 +153,7 @@ class Collection implements CollectionIn + * + * @return int + */ +- public function count() ++ public function count(): int + { + return count($this->data); + } +@@ -162,7 +163,7 @@ class Collection implements CollectionIn + * + * @return ArrayIterator + */ +- public function getIterator() ++ public function getIterator(): \Traversable + { + return new ArrayIterator($this->data); + } +diff -up vendor/slim/slim/Slim/Http/Request.php.patch vendor/slim/slim/Slim/Http/Request.php +--- vendor/slim/slim/Slim/Http/Request.php.patch 2021-10-16 07:19:02.079746981 +0200 ++++ vendor/slim/slim/Slim/Http/Request.php 2021-10-16 07:19:22.315187184 +0200 +@@ -1016,7 +1016,7 @@ class Request extends Message implements + // Check if this specific media type has a parser registered first + if (!isset($this->bodyParsers[$mediaType])) { + // If not, look for a media type with a structured syntax suffix (RFC 6839) +- $parts = explode('+', $mediaType); ++ $parts = explode('+', $mediaType ?? ''); + if (count($parts) >= 2) { + $mediaType = 'application/' . $parts[count($parts)-1]; + } +diff -up vendor/slim/slim/Slim/Http/Uri.php.patch vendor/slim/slim/Slim/Http/Uri.php +--- vendor/slim/slim/Slim/Http/Uri.php.patch 2021-10-11 15:45:45.184291247 +0200 ++++ vendor/slim/slim/Slim/Http/Uri.php 2021-10-11 15:41:39.278759355 +0200 +@@ -179,14 +179,14 @@ class Uri implements UriInterface + $port = (int)$env->get('SERVER_PORT', 80); + } + +- if (preg_match('/^(\[[a-fA-F0-9:.]+\])(:\d+)?\z/', $host, $matches)) { ++ if (preg_match('/^(\[[a-fA-F0-9:.]+\])(:\d+)?\z/', $host ?? '', $matches)) { + $host = $matches[1]; + + if (isset($matches[2])) { + $port = (int) substr($matches[2], 1); + } + } else { +- $pos = strpos($host, ':'); ++ $pos = strpos($host ?? '', ':'); + if ($pos !== false) { + $port = (int) substr($host, $pos + 1); + $host = strstr($host, ':', true); +@@ -389,7 +389,7 @@ class Uri implements UriInterface + * + * @return string The percent-encoded query string. + */ +- protected function filterUserInfo($query) ++ protected function filterUserInfo(string $query) + { + return preg_replace_callback( + '/(?:[^a-zA-Z0-9_\-\.~!\$&\'\(\)\*\+,;=]+|%(?![A-Fa-f0-9]{2}))/u', +@@ -718,7 +718,7 @@ class Uri implements UriInterface + function ($match) { + return rawurlencode($match[0]); + }, +- $query ++ $query ?? '' + ); + } + diff --git a/patches/smarty-php81.patch b/patches/smarty-php81.patch new file mode 100644 index 000000000..f0c694662 --- /dev/null +++ b/patches/smarty-php81.patch @@ -0,0 +1,12 @@ +diff -up vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php.patch vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php +--- vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php.patch 2021-10-11 16:02:02.854032181 +0200 ++++ vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php 2021-10-11 16:02:17.246356570 +0200 +@@ -45,7 +45,7 @@ class Smarty_Internal_Runtime_CodeFrame + $properties[ 'cache_lifetime' ] = $_template->cache_lifetime; + } + $output = "source->filepath) . "' */\n\n"; + $output .= "/* @var Smarty_Internal_Template \$_smarty_tpl */\n"; + $dec = "\$_smarty_tpl->_decodeProperties(\$_smarty_tpl, " . var_export($properties, true) . ',' . diff --git a/patches/smarty-view-php81.patch b/patches/smarty-view-php81.patch new file mode 100644 index 000000000..f17db5a44 --- /dev/null +++ b/patches/smarty-view-php81.patch @@ -0,0 +1,39 @@ +diff -up vendor/mathmarques/smarty-view/src/Smarty.php.patch vendor/mathmarques/smarty-view/src/Smarty.php +--- vendor/mathmarques/smarty-view/src/Smarty.php.patch 2021-09-24 12:02:58.287223301 +0200 ++++ vendor/mathmarques/smarty-view/src/Smarty.php 2021-09-25 10:35:50.856555954 +0200 +@@ -153,7 +153,7 @@ class Smarty implements \ArrayAccess + * + * @return bool + */ +- public function offsetExists($key) ++ public function offsetExists($key): bool + { + return array_key_exists($key, $this->defaultVariables); + } +@@ -165,7 +165,7 @@ class Smarty implements \ArrayAccess + * + * @return mixed The key's value, or the default value + */ +- public function offsetGet($key) ++ public function offsetGet($key): mixed + { + return $this->defaultVariables[$key]; + } +@@ -176,7 +176,7 @@ class Smarty implements \ArrayAccess + * @param string $key The data key + * @param mixed $value The data value + */ +- public function offsetSet($key, $value) ++ public function offsetSet($key, $value): void + { + $this->defaultVariables[$key] = $value; + } +@@ -186,7 +186,7 @@ class Smarty implements \ArrayAccess + * + * @param string $key The data key + */ +- public function offsetUnset($key) ++ public function offsetUnset($key): void + { + unset($this->defaultVariables[$key]); + } diff --git a/patches/tcpdf-hrs.patch b/patches/tcpdf-hrs.patch deleted file mode 100644 index 765f8aed3..000000000 --- a/patches/tcpdf-hrs.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff -up vendor/tecnickcom/tcpdf/tcpdf.php.patch vendor/tecnickcom/tcpdf/tcpdf.php ---- vendor/tecnickcom/tcpdf/tcpdf.php.patch 2021-05-23 10:30:56.970668957 +0200 -+++ vendor/tecnickcom/tcpdf/tcpdf.php 2021-05-23 10:33:11.760593379 +0200 -@@ -18918,18 +18918,7 @@ Putting 1 is equivalent to putting 0 and - } - $prevlinewidth = $this->GetLineWidth(); - $this->SetLineWidth($hrHeight); -- -- $lineStyle = array( -- 'color' => $tag['fgcolor'], -- 'cap' => $tag['style']['cap'], -- 'join' => $tag['style']['join'], -- 'dash' => $tag['style']['dash'], -- 'phase' => $tag['style']['phase'], -- ); -- -- $lineStyle = array_filter($lineStyle); -- -- $this->Line($x, $y, $x + $hrWidth, $y, $lineStyle); -+ $this->Line($x, $y, $x + $hrWidth, $y); - $this->SetLineWidth($prevlinewidth); - $this->addHTMLVertSpace(max($hbc, ($hrHeight / 2)), 0, $cell, !isset($dom[($key + 1)])); - break; -- 2.39.2