summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--php-phpmyadmin-sql-parser5-php81.patch187
-rw-r--r--php-phpmyadmin-sql-parser5.spec16
3 files changed, 198 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index 1ab5c4f..01f0400 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,7 @@
+clog
package-*.xml
*.tgz
+*.tar.bz2
*.tar.gz
*.tar.xz
*.tar.xz.asc
diff --git a/php-phpmyadmin-sql-parser5-php81.patch b/php-phpmyadmin-sql-parser5-php81.patch
new file mode 100644
index 0000000..e43d7a7
--- /dev/null
+++ b/php-phpmyadmin-sql-parser5-php81.patch
@@ -0,0 +1,187 @@
+Adapted for 5.4.2 from upstream:
+
+
+From 57b6c4366da680dbde339393edb3055c0ca6311d Mon Sep 17 00:00:00 2001
+From: William Desportes <williamdes@wdes.fr>
+Date: Tue, 17 Aug 2021 00:11:59 +0200
+Subject: [PATCH] Fix PHP 8.1 fatal errors on classes that "implements
+ ArrayAccess"
+
+"PHP Fatal error: During inheritance of ArrayAccess: Uncaught Return type of PhpMyAdmin\SqlParser\TokensList::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice"
+
+"Fatal error: During inheritance of ArrayAccess: Uncaught Return type of PhpMyAdmin\SqlParser\TokensList::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice"
+
+I added "#[ReturnTypeWillChange]"
+
+Signed-off-by: William Desportes <williamdes@wdes.fr>
+---
+ src/TokensList.php | 4 ++++
+ src/UtfString.php | 4 ++++
+ 2 files changed, 8 insertions(+)
+
+diff --git a/src/TokensList.php b/src/TokensList.php
+index 486e3aa6..7b63a045 100644
+--- a/src/TokensList.php
++++ b/src/TokensList.php
+@@ -153,6 +153,7 @@ public function getNextOfTypeAndValue($type, $value)
+ * @param int $offset the offset to be set
+ * @param Token $value the token to be saved
+ */
++ #[ReturnTypeWillChange]
+ public function offsetSet($offset, $value)
+ {
+ if ($offset === null) {
+@@ -169,6 +170,7 @@ public function offsetSet($offset, $value)
+ *
+ * @return Token
+ */
++ #[ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $offset < $this->count ? $this->tokens[$offset] : null;
+@@ -181,6 +183,7 @@ public function offsetGet($offset)
+ *
+ * @return bool
+ */
++ #[ReturnTypeWillChange]
+ public function offsetExists($offset)
+ {
+ return $offset < $this->count;
+@@ -191,6 +194,7 @@ public function offsetExists($offset)
+ *
+ * @param int $offset the offset to be unset
+ */
++ #[ReturnTypeWillChange]
+ public function offsetUnset($offset)
+ {
+ unset($this->tokens[$offset]);
+diff --git a/src/UtfString.php b/src/UtfString.php
+index 217d1989..ee6e21f0 100644
+--- a/src/UtfString.php
++++ b/src/UtfString.php
+@@ -91,6 +91,7 @@ public function __construct($str)
+ *
+ * @return bool
+ */
++ #[ReturnTypeWillChange]
+ public function offsetExists($offset)
+ {
+ return ($offset >= 0) && ($offset < $this->charLen);
+@@ -103,6 +104,7 @@ public function offsetExists($offset)
+ *
+ * @return string|null
+ */
++ #[ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ if (($offset < 0) || ($offset >= $this->charLen)) {
+@@ -146,6 +148,7 @@ public function offsetGet($offset)
+ *
+ * @throws Exception not implemented.
+ */
++ #[ReturnTypeWillChange]
+ public function offsetSet($offset, $value)
+ {
+ throw new Exception('Not implemented.');
+@@ -158,6 +161,7 @@ public function offsetSet($offset, $value)
+ *
+ * @throws Exception not implemented.
+ */
++ #[ReturnTypeWillChange]
+ public function offsetUnset($offset)
+ {
+ throw new Exception('Not implemented.');
+
+From ed900e5b219b13c62dd260fd03ff65c31723d385 Mon Sep 17 00:00:00 2001
+From: William Desportes <williamdes@wdes.fr>
+Date: Sun, 5 Sep 2021 21:58:36 +0200
+Subject: [PATCH] Use fully qualified syntax for "#[\ReturnTypeWillChange]"
+
+Ref: 644f6bea450d5d22cb7c7c7991698d9d7945756b
+
+Signed-off-by: William Desportes <williamdes@wdes.fr>
+---
+ src/TokensList.php | 9 ++++-----
+ src/UtfString.php | 9 ++++-----
+ 2 files changed, 8 insertions(+), 10 deletions(-)
+
+diff --git a/src/TokensList.php b/src/TokensList.php
+index bdc520c5..21cac879 100644
+--- a/src/TokensList.php
++++ b/src/TokensList.php
+@@ -154,7 +153,7 @@ public function getNextOfTypeAndValue($type, $value)
+ * @param int $offset the offset to be set
+ * @param Token $value the token to be saved
+ */
+- #[ReturnTypeWillChange]
++ #[\ReturnTypeWillChange]
+ public function offsetSet($offset, $value)
+ {
+ if ($offset === null) {
+@@ -171,7 +170,7 @@ public function offsetSet($offset, $value)
+ *
+ * @return Token
+ */
+- #[ReturnTypeWillChange]
++ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $offset < $this->count ? $this->tokens[$offset] : null;
+@@ -184,7 +183,7 @@ public function offsetGet($offset)
+ *
+ * @return bool
+ */
+- #[ReturnTypeWillChange]
++ #[\ReturnTypeWillChange]
+ public function offsetExists($offset)
+ {
+ return $offset < $this->count;
+@@ -195,7 +194,7 @@ public function offsetExists($offset)
+ *
+ * @param int $offset the offset to be unset
+ */
+- #[ReturnTypeWillChange]
++ #[\ReturnTypeWillChange]
+ public function offsetUnset($offset)
+ {
+ unset($this->tokens[$offset]);
+diff --git a/src/UtfString.php b/src/UtfString.php
+index 548aa28f..ffd89323 100644
+--- a/src/UtfString.php
++++ b/src/UtfString.php
+@@ -92,7 +91,7 @@ public function __construct($str)
+ *
+ * @return bool
+ */
+- #[ReturnTypeWillChange]
++ #[\ReturnTypeWillChange]
+ public function offsetExists($offset)
+ {
+ return ($offset >= 0) && ($offset < $this->charLen);
+@@ -105,7 +104,7 @@ public function offsetExists($offset)
+ *
+ * @return string|null
+ */
+- #[ReturnTypeWillChange]
++ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ if (($offset < 0) || ($offset >= $this->charLen)) {
+@@ -149,7 +148,7 @@ public function offsetGet($offset)
+ *
+ * @throws Exception not implemented.
+ */
+- #[ReturnTypeWillChange]
++ #[\ReturnTypeWillChange]
+ public function offsetSet($offset, $value)
+ {
+ throw new Exception('Not implemented.');
+@@ -162,7 +161,7 @@ public function offsetSet($offset, $value)
+ *
+ * @throws Exception not implemented.
+ */
+- #[ReturnTypeWillChange]
++ #[\ReturnTypeWillChange]
+ public function offsetUnset($offset)
+ {
+ throw new Exception('Not implemented.');
diff --git a/php-phpmyadmin-sql-parser5.spec b/php-phpmyadmin-sql-parser5.spec
index 75600a4..ff1e4a2 100644
--- a/php-phpmyadmin-sql-parser5.spec
+++ b/php-phpmyadmin-sql-parser5.spec
@@ -20,7 +20,7 @@
Name: php-%{gh_owner}-%{gh_project}%{major}
Version: 5.4.2
-Release: 1%{?gh_date?%{gh_date}git%{gh_short}}%{?dist}
+Release: 3%{?gh_date?%{gh_date}git%{gh_short}}%{?dist}
Summary: A validating SQL lexer and parser with a focus on MySQL dialect
License: GPLv2+
@@ -29,6 +29,8 @@ Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit
# Use our autoloader and locale relocation
Patch0: %{name}-autoload.patch
+# Upstream patches for PHP 8.1
+Patch1: %{name}-php81.patch
BuildArch: noarch
BuildRequires: gettext
@@ -45,13 +47,8 @@ BuildRequires: php-spl
# "phpstan/phpstan-phpunit": "^0.12.16",
# "phpunit/php-code-coverage": "*",
# "phpunit/phpunit": "^7.4 || ^8 || 9"
-%if 0%{?fedora} >= 31 || 0%{?rhel} >= 9
BuildRequires: phpunit9
%global phpunit %{_bindir}/phpunit9
-%else
-BuildRequires: phpunit8
-%global phpunit %{_bindir}/phpunit8
-%endif
%endif
# For autoloader
BuildRequires: php-composer(fedora/autoloader)
@@ -93,6 +90,8 @@ Autoloader: %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/autoload.php
%patch0 -p0 -b .rpm
find src -name \*rpm -exec rm {} \;
+%patch1 -p1 -b .php81
+find src -name \*php81 -exec rm {} \;
: Create autoloader
cat <<'AUTOLOAD' | tee src/autoload.php
@@ -150,7 +149,7 @@ EOF
sed -e 's:%{_datadir}/php:%{buildroot}%{_datadir}/php:' -i bin/*query
ret=0
-for cmdarg in "php %{phpunit}" "php72 %{_bindir}/phpunit8" php73 php74 php80; do
+for cmdarg in "php %{phpunit}" php73 php74 php80 php81; do
if which $cmdarg; then
set $cmdarg
$1 ${2:-%{_bindir}/phpunit9} --no-coverage --verbose || ret=1
@@ -191,6 +190,9 @@ exit $ret
%changelog
+* Fri Oct 29 2021 Remi Collet <remi@remirepo.net> - 5.4.2-3
+- add upstream patches for PHP 8.1
+
* Fri Feb 5 2021 Remi Collet <remi@remirepo.net> - 5.4.2-1
- update to 5.4.2