diff options
| author | Remi Collet <remi@remirepo.net> | 2021-04-07 16:29:25 +0200 | 
|---|---|---|
| committer | Remi Collet <remi@remirepo.net> | 2021-04-07 16:29:25 +0200 | 
| commit | 8c9dfa70a939020cfa5b7f9b17e4bd14e4b59f54 (patch) | |
| tree | 55e856d5290a3756526527b394b99d0e25fb8e41 | |
| parent | 0dab4a961881056290ff61af9603344437784293 (diff) | |
fix FTBFS with PHP 8
| -rw-r--r-- | php-react-stream-php8.patch | 34 | ||||
| -rw-r--r-- | php-react-stream.spec | 12 | 
2 files changed, 43 insertions, 3 deletions
| diff --git a/php-react-stream-php8.patch b/php-react-stream-php8.patch new file mode 100644 index 0000000..b973488 --- /dev/null +++ b/php-react-stream-php8.patch @@ -0,0 +1,34 @@ +diff -up ./src/WritableResourceStream.php.php8 ./src/WritableResourceStream.php +--- ./src/WritableResourceStream.php.php8	2021-04-07 16:22:09.048553209 +0200 ++++ ./src/WritableResourceStream.php	2021-04-07 16:22:14.797526978 +0200 +@@ -117,10 +117,15 @@ final class WritableResourceStream exten +             $error = $errstr; +         }); +  +-        if ($this->writeChunkSize === -1) { +-            $sent = \fwrite($this->stream, $this->data); ++        if (is_resource($this->stream)) { ++           if ($this->writeChunkSize === -1) { ++               $sent = \fwrite($this->stream, $this->data); ++           } else { ++               $sent = \fwrite($this->stream, $this->data, $this->writeChunkSize); ++           } +         } else { +-            $sent = \fwrite($this->stream, $this->data, $this->writeChunkSize); ++           $sent = 0; ++           $error = 'this is not a valid stream resource'; +         } +  +         \restore_error_handler(); +diff -up ./tests/WritableStreamResourceTest.php.php8 ./tests/WritableStreamResourceTest.php +--- ./tests/WritableStreamResourceTest.php.php8	2021-04-07 16:18:25.234574523 +0200 ++++ ./tests/WritableStreamResourceTest.php	2021-04-07 16:18:44.985484393 +0200 +@@ -508,7 +508,7 @@ class WritableResourceStreamTest extends +         $buffer->handleWrite(); +  +         $this->assertInstanceOf('Exception', $error); +-        $this->assertSame('Unable to write to stream: fwrite(): send of 3 bytes failed with errno=32 Broken pipe', $error->getMessage()); ++        $this->assertEqualsIgnoringCase('Unable to write to stream: fwrite(): send of 3 bytes failed with errno=32 Broken pipe', $error->getMessage()); +     } +  +     private function createWriteableLoopMock() diff --git a/php-react-stream.spec b/php-react-stream.spec index ed89440..26dbd64 100644 --- a/php-react-stream.spec +++ b/php-react-stream.spec @@ -2,7 +2,7 @@  #  # Fedora spec file for php-react-stream  # -# Copyright (c) 2017-2020 Shawn Iwinski <shawn@iwin.ski> +# Copyright (c) 2017-2021 Shawn Iwinski <shawn@iwin.ski>  #  # License: MIT  # http://opensource.org/licenses/MIT @@ -44,7 +44,7 @@  Name:          php-%{composer_vendor}-%{composer_project}  Version:       %{github_version} -Release:       2%{?github_release}%{?dist} +Release:       5%{?github_release}%{?dist}  Summary:       Basic readable and writable stream interfaces that support piping  License:       MIT @@ -55,6 +55,8 @@ URL:           https://reactphp.org/stream/  Source0:       %{name}-%{github_version}-%{github_commit}.tar.gz  Source1:       %{name}-get-source.sh +Patch0:        %{name}-php8.patch +  BuildArch:     noarch  # Tests  %if %{with_tests} @@ -116,6 +118,7 @@ Autoloader: %{phpdir}/React/Stream/autoload.php  %prep  %setup -qn %{github_name}-%{github_commit} +%patch0 -p1  %build @@ -162,7 +165,7 @@ rm -f tests/FunctionalInternetTest.php  : Upstream tests  RETURN_CODE=0  PHPUNIT=$(which phpunit7) -for PHP_EXEC in "" php72 php73 php74 php80; do +for PHP_EXEC in "" php73 php74 php80; do      if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then          $PHP_EXEC $PHPUNIT --verbose --bootstrap bootstrap.php \              || RETURN_CODE=1 @@ -183,6 +186,9 @@ exit $RETURN_CODE  %changelog +* Wed Apr  7 2021 Remi Collet <remi@remirepo.net> - 1.1.1-5 +- fix FTBFS with PHP 8 +  * Sat Jun 06 2020 Shawn Iwinski <shawn@iwin.ski> - 1.1.1-1  - Update to 1.1.1 (RHBZ #1830919)  - Use PHPUnit 7 | 
