summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--77.patch33
-rw-r--r--87855e941d39fc9ebcee3a84f0f73ce4103d236d.patch167
-rw-r--r--php-pecl-psr.spec17
3 files changed, 215 insertions, 2 deletions
diff --git a/77.patch b/77.patch
new file mode 100644
index 0000000..6426b71
--- /dev/null
+++ b/77.patch
@@ -0,0 +1,33 @@
+From 497db8e1d8a6da4d1005bba07d76de994ae7a82d Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Mon, 24 Aug 2020 11:43:47 +0200
+Subject: [PATCH] fix for upcoming PHP 8
+
+---
+ psr_log.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/psr_log.c b/psr_log.c
+index 182da66..17b3246 100644
+--- a/psr_log.c
++++ b/psr_log.c
+@@ -101,7 +101,6 @@ static void php_psr_PsrLogAbstractLogger_log(const char * level_str, size_t leve
+ zval * _this_zval = getThis();
+ zval * message;
+ zval * context = NULL;
+- zend_class_entry * expected_ce = NULL; // PsrLogAbstractLogger_ce_ptr
+ zval fname = {0};
+ zval fparams[3];
+
+@@ -252,7 +251,11 @@ PHP_METHOD(PsrLogLoggerAwareTrait, setLogger)
+ Z_PARAM_OBJECT_OF_CLASS(logger, PsrLogLoggerInterface_ce_ptr)
+ ZEND_PARSE_PARAMETERS_END();
+
++#if PHP_VERSION_ID < 80000
+ zend_update_property(Z_OBJCE_P(_this_zval), _this_zval, "logger", sizeof("logger")-1, logger);
++#else
++ zend_update_property(Z_OBJCE_P(_this_zval), Z_OBJ_P(_this_zval), "logger", sizeof("logger")-1, logger);
++#endif
+ }
+
+ static zend_function_entry PsrLogLoggerAwareTrait_methods[] = {
diff --git a/87855e941d39fc9ebcee3a84f0f73ce4103d236d.patch b/87855e941d39fc9ebcee3a84f0f73ce4103d236d.patch
new file mode 100644
index 0000000..e4aeeb5
--- /dev/null
+++ b/87855e941d39fc9ebcee3a84f0f73ce4103d236d.patch
@@ -0,0 +1,167 @@
+From 87855e941d39fc9ebcee3a84f0f73ce4103d236d Mon Sep 17 00:00:00 2001
+From: John Boehr <john@johnboehr.is>
+Date: Sat, 27 Jun 2020 21:23:13 -0700
+Subject: [PATCH] Patch tests to pass on latest PHP master (8.0.0alpha1)
+
+---
+ tests/PsrHttpClientClientExceptionInterface.phpt | 7 ++-----
+ tests/PsrHttpClientNetworkExceptionInterface.phpt | 11 ++++-------
+ tests/PsrHttpClientRequestExceptionInterface.phpt | 11 ++++-------
+ tests/PsrHttpMessageStreamInterface.phpt | 10 ++++------
+ tests/PsrHttpMessageUriInterface.phpt | 10 ++++------
+ tests/SampleStream.inc | 1 +
+ 6 files changed, 19 insertions(+), 31 deletions(-)
+
+diff --git a/tests/PsrHttpClientClientExceptionInterface.phpt b/tests/PsrHttpClientClientExceptionInterface.phpt
+index 52a06be..4a01f16 100644
+--- a/tests/PsrHttpClientClientExceptionInterface.phpt
++++ b/tests/PsrHttpClientClientExceptionInterface.phpt
+@@ -5,7 +5,7 @@ Psr\Http\Client\ClientExceptionInterface
+ --FILE--
+ <?php
+ use Psr\Http\Client\ClientExceptionInterface;
+-var_dump(class_implements('Psr\Http\Client\ClientExceptionInterface', false));
++var_dump(is_subclass_of(ClientExceptionInterface::class, Throwable::class));
+ class MyException extends Exception implements ClientExceptionInterface {}
+ $ex = new MyException('test');
+ var_dump($ex instanceof ClientExceptionInterface);
+@@ -17,10 +17,7 @@ try {
+ var_dump($e->getMessage());
+ }
+ --EXPECT--
+-array(1) {
+- ["Throwable"]=>
+- string(9) "Throwable"
+-}
++bool(true)
+ bool(true)
+ bool(true)
+ bool(true)
+diff --git a/tests/PsrHttpClientNetworkExceptionInterface.phpt b/tests/PsrHttpClientNetworkExceptionInterface.phpt
+index 4ad60b7..eb2aafa 100644
+--- a/tests/PsrHttpClientNetworkExceptionInterface.phpt
++++ b/tests/PsrHttpClientNetworkExceptionInterface.phpt
+@@ -8,7 +8,8 @@ use Psr\Http\Message\RequestInterface;
+ use Psr\Http\Client\NetworkExceptionInterface;
+ include __DIR__ . '/SampleMessage.inc';
+ include __DIR__ . '/SampleRequest.inc';
+-var_dump(class_implements('Psr\Http\Client\NetworkExceptionInterface', false));
++var_dump(is_subclass_of(NetworkExceptionInterface::class, Psr\Http\Client\ClientExceptionInterface::class));
++var_dump(is_subclass_of(NetworkExceptionInterface::class, Throwable::class));
+ class MyException extends Exception implements NetworkExceptionInterface {
+ public function getRequest(): RequestInterface {
+ var_dump(__METHOD__);
+@@ -27,12 +28,8 @@ try {
+ var_dump($e->getRequest());
+ }
+ --EXPECTF--
+-array(2) {
+- ["Psr\Http\Client\ClientExceptionInterface"]=>
+- string(40) "Psr\Http\Client\ClientExceptionInterface"
+- ["Throwable"]=>
+- string(9) "Throwable"
+-}
++bool(true)
++bool(true)
+ bool(true)
+ bool(true)
+ bool(true)
+diff --git a/tests/PsrHttpClientRequestExceptionInterface.phpt b/tests/PsrHttpClientRequestExceptionInterface.phpt
+index 248d882..e927ccf 100644
+--- a/tests/PsrHttpClientRequestExceptionInterface.phpt
++++ b/tests/PsrHttpClientRequestExceptionInterface.phpt
+@@ -8,7 +8,8 @@ use Psr\Http\Message\RequestInterface;
+ use Psr\Http\Client\RequestExceptionInterface;
+ include __DIR__ . '/SampleMessage.inc';
+ include __DIR__ . '/SampleRequest.inc';
+-var_dump(class_implements('Psr\Http\Client\RequestExceptionInterface', false));
++var_dump(is_subclass_of(RequestExceptionInterface::class, Psr\Http\Client\ClientExceptionInterface::class));
++var_dump(is_subclass_of(RequestExceptionInterface::class, Throwable::class));
+ class MyException extends Exception implements RequestExceptionInterface {
+ public function getRequest(): RequestInterface {
+ var_dump(__METHOD__);
+@@ -27,12 +28,8 @@ try {
+ var_dump($e->getRequest());
+ }
+ --EXPECTF--
+-array(2) {
+- ["Psr\Http\Client\ClientExceptionInterface"]=>
+- string(40) "Psr\Http\Client\ClientExceptionInterface"
+- ["Throwable"]=>
+- string(9) "Throwable"
+-}
++bool(true)
++bool(true)
+ bool(true)
+ bool(true)
+ bool(true)
+diff --git a/tests/PsrHttpMessageStreamInterface.phpt b/tests/PsrHttpMessageStreamInterface.phpt
+index 3232bfc..62d6b79 100644
+--- a/tests/PsrHttpMessageStreamInterface.phpt
++++ b/tests/PsrHttpMessageStreamInterface.phpt
+@@ -4,9 +4,10 @@ Psr\Http\Message\StreamInterface
+ <?php include('skip.inc'); ?>
+ --FILE--
+ <?php
++use Psr\Http\Message\StreamInterface;
+ include __DIR__ . '/SampleStream.inc';
+-var_dump(interface_exists('\\Psr\\Http\\Message\\StreamInterface', false));
+-var_dump(class_implements('SampleStream', false));
++var_dump(interface_exists(StreamInterface::class, false));
++var_dump(is_subclass_of(SampleStream::class, StreamInterface::class));
+ $stream = new SampleStream();
+ $stream->__toString();
+ $stream->close();
+@@ -25,10 +26,7 @@ $stream->getContents();
+ $stream->getMetadata();
+ --EXPECTF--
+ bool(true)
+-array(1) {
+- ["Psr\Http\Message\StreamInterface"]=>
+- string(32) "Psr\Http\Message\StreamInterface"
+-}
++bool(true)
+ string(24) "SampleStream::__toString"
+ string(19) "SampleStream::close"
+ string(20) "SampleStream::detach"
+diff --git a/tests/PsrHttpMessageUriInterface.phpt b/tests/PsrHttpMessageUriInterface.phpt
+index 8ed65f8..278ed69 100644
+--- a/tests/PsrHttpMessageUriInterface.phpt
++++ b/tests/PsrHttpMessageUriInterface.phpt
+@@ -4,9 +4,10 @@ Psr\Http\Message\UriInterface
+ <?php include('skip.inc'); ?>
+ --FILE--
+ <?php
++use Psr\Http\Message\UriInterface;
+ include __DIR__ . '/SampleUri.inc';
+-var_dump(interface_exists('\\Psr\\Http\\Message\\UriInterface', false));
+-var_dump(class_implements('SampleUri', false));
++var_dump(interface_exists(UriInterface::class, false));
++var_dump(is_subclass_of(SampleUri::class, UriInterface::class));
+ $uri = new SampleUri();
+ $uri->getScheme();
+ $uri->getAuthority();
+@@ -26,10 +27,7 @@ $uri->withFragment('');
+ $uri->__toString();
+ --EXPECT--
+ bool(true)
+-array(1) {
+- ["Psr\Http\Message\UriInterface"]=>
+- string(29) "Psr\Http\Message\UriInterface"
+-}
++bool(true)
+ string(20) "SampleUri::getScheme"
+ string(23) "SampleUri::getAuthority"
+ string(22) "SampleUri::getUserInfo"
+diff --git a/tests/SampleStream.inc b/tests/SampleStream.inc
+index 311236f..96a0bb0 100644
+--- a/tests/SampleStream.inc
++++ b/tests/SampleStream.inc
+@@ -7,6 +7,7 @@ class SampleStream implements StreamInterface
+ public function __toString()
+ {
+ var_dump(__METHOD__);
++ return __METHOD__;
+ }
+
+ public function close()
diff --git a/php-pecl-psr.spec b/php-pecl-psr.spec
index 8b9c286..b0ec68c 100644
--- a/php-pecl-psr.spec
+++ b/php-pecl-psr.spec
@@ -25,11 +25,14 @@
Summary: PSR interfaces
Name: %{?sub_prefix}php-pecl-psr
Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}}
-Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz
License: BSD
URL: https://pecl.php.net/package/psr
+Patch0: https://github.com/jbboehr/php-psr/commit/87855e941d39fc9ebcee3a84f0f73ce4103d236d.patch
+Patch1: https://patch-diff.githubusercontent.com/raw/jbboehr/php-psr/pull/77.patch
+
BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel >= 7.0
BuildRequires: %{?scl_prefix}php-pear
@@ -47,7 +50,7 @@ Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{relea
Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release}
%endif
-%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
+%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
# Other third party repo stuff
%if "%{php_version}" > "7.2"
Obsoletes: php72u-pecl-%{pecl_name} <= %{version}
@@ -61,6 +64,9 @@ Obsoletes: php73w-pecl-%{pecl_name} <= %{version}
Obsoletes: php74-pecl-%{pecl_name} <= %{version}
Obsoletes: php74w-pecl-%{pecl_name} <= %{version}
%endif
+%if "%{php_version}" > "8.0"
+Obsoletes: php80-pecl-%{pecl_name} <= %{version}
+%endif
%endif
%if 0%{?fedora} < 20 && 0%{?rhel} < 7
@@ -100,6 +106,9 @@ mv %{pecl_name}-%{upstream_version}%{?upstream_prever} NTS
%{?_licensedir:sed -e '/LICENSE/s/role="doc"/role="src"/' -i package.xml}
cd NTS
+%patch0 -p1 -b .up
+%patch1 -p1 -b .pr77
+
# Sanity check, really often broken
extver=$(sed -n '/#define PHP_PSR_VERSION/{s/.* "//;s/".*$//;p}' php_psr.h)
if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}"; then
@@ -245,6 +254,10 @@ fi
%changelog
+* Mon Aug 24 2020 Remi Collet <remi@remirepo.net> - 1.0.0-3
+- add patches for PHP 8 from upstream and from
+ https://github.com/jbboehr/php-psr/pull/77
+
* Wed Feb 19 2020 Remi Collet <remi@remirepo.net> - 1.0.0-1
- update to 1.0.0 (no change)