From dcf30d8b446cda539d085ccf98cf3c0827ae5366 Mon Sep 17 00:00:00 2001 From: tijmen Date: Mon, 27 Jul 2026 10:14:24 +0200 Subject: [PATCH 1/6] fix php 8 test --- test/unit/TinyImageSizeTest.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/unit/TinyImageSizeTest.php b/test/unit/TinyImageSizeTest.php index c77213ad..5db46931 100644 --- a/test/unit/TinyImageSizeTest.php +++ b/test/unit/TinyImageSizeTest.php @@ -194,8 +194,12 @@ public function test_resized_should_return_false_if_meta_have_output_and_not_res } public function test_will_read_mimetype_from_file() { - // because files in the virtual file system are not really files but empty strings, it is a text/plain. - $this->assertEquals( $this->original->mimetype(), 'text/plain'); + // vfs files are empty buffers + // empty buffers on php < 8 returns 'text/plain', > 8 is 'application/octet-stream' + $this->assertContains( + $this->original->mimetype(), + array( 'text/plain', 'application/octet-stream' ) + ); } /** From 5e24b3846931ce3f10c002f635daafce9e86f27d Mon Sep 17 00:00:00 2001 From: tijmen Date: Sat, 15 Aug 2026 21:48:01 +0200 Subject: [PATCH 2/6] added 71/85 removed 63/80, 67/82, 69/83 --- .github/workflows/integration-tests.yml | 5 ++--- config/wp-version.conf | 6 ++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index b328f2b6..4c8ee720 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -17,11 +17,10 @@ jobs: include: - { wp: 46, php: 56 } - { wp: 46, php: 70 } + - { wp: 57, php: 73 } - { wp: 60, php: 74 } - - { wp: 63, php: 80 } - - { wp: 67, php: 82 } - - { wp: 69, php: 83 } - { wp: 70, php: 84 } + - { wp: 71, php: 85 } steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/config/wp-version.conf b/config/wp-version.conf index ef585951..be899af4 100644 --- a/config/wp-version.conf +++ b/config/wp-version.conf @@ -3,7 +3,5 @@ 46_70=wordpress:4.6-php7.0-apache 57_73=wordpress:5.7-php7.3-apache 60_74=wordpress:6.0-php7.4-apache -63_80=wordpress:6.3-php8.0-apache -67_82=wordpress:6.7-php8.2-apache -69_83=wordpress:6.9-php8.3-apache -70_84=wordpress:beta-7.0-RC2-php8.4-apache \ No newline at end of file +70_84=wordpress:7.0-php8.4-apache +71_85=wordpress:beta-7.1-php8.5-apache \ No newline at end of file From 5fe526c5931e935e0363d03902924b305ac5619f Mon Sep 17 00:00:00 2001 From: tijmen Date: Sat, 15 Aug 2026 21:51:46 +0200 Subject: [PATCH 3/6] setAccessible is deprecated --- src/class-tiny-compress-client.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/class-tiny-compress-client.php b/src/class-tiny-compress-client.php index 4dd8304b..8998bc11 100644 --- a/src/class-tiny-compress-client.php +++ b/src/class-tiny-compress-client.php @@ -197,7 +197,13 @@ private function set_request_options( $client ) { The client does not let us override cURL properties yet, so we have to use a reflection property. */ $property = new ReflectionProperty( $client, 'options' ); - $property->setAccessible( true ); + if ( PHP_VERSION_ID < 80100 ) { + /** + * No effect since PHP 8.1 and deprecated since PHP 8.5 + * https://www.php.net/manual/en/reflectionproperty.setaccessible.php + */ + $property->setAccessible( true ); + } $options = $property->getValue( $client ); // Set API request timeout to prevent indefinite hanging From 3bca20c5c4edda306b035f9cd1ff92037bcb6fd0 Mon Sep 17 00:00:00 2001 From: tijmen Date: Sat, 15 Aug 2026 21:52:18 +0200 Subject: [PATCH 4/6] curl_close deprecated on 8.5 --- test/fixtures/Client.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/test/fixtures/Client.php b/test/fixtures/Client.php index cca4e3ef..80bdf2cb 100644 --- a/test/fixtures/Client.php +++ b/test/fixtures/Client.php @@ -53,7 +53,7 @@ function request( $method, $url, $body = null, $header = array() ) { if ( is_string( $response ) ) { $status = curl_getinfo( $request, CURLINFO_HTTP_CODE ); $headerSize = curl_getinfo( $request, CURLINFO_HEADER_SIZE ); - curl_close( $request ); + self::closeRequest( $request ); $headers = self::parseHeaders( substr( $response, 0, $headerSize ) ); $body = substr( $response, $headerSize ); @@ -107,11 +107,22 @@ function request( $method, $url, $body = null, $header = array() ) { ); } else { $message = sprintf( '%s (#%d)', curl_error( $request ), curl_errno( $request ) ); - curl_close( $request ); + self::closeRequest( $request ); throw new ConnectionException( 'Error while connecting: ' . $message ); }// End if(). } + /** + * curl_close() is deprecated in >8.5, does nothing in >8.0 + * + * @param \Tinify\CurlMock $request + */ + protected static function closeRequest( $request ) { + if ( PHP_VERSION_ID < 80000 ) { + curl_close( $request ); + } + } + protected static function parseHeaders( $headers ) { if ( ! is_array( $headers ) ) { $headers = explode( "\r\n", $headers ); From 8e4ba49f44bbf6978a6ec0ff4420c2168841b049 Mon Sep 17 00:00:00 2001 From: tijmen Date: Sat, 15 Aug 2026 21:55:08 +0200 Subject: [PATCH 5/6] tested up to 7.1 --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 54d3eb43..6654259d 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: TinyPNG Donate link: https://tinypng.com/ Tags: compress images, compression, image size, page speed, performance Requires at least: 4.0 -Tested up to: 7.0 +Tested up to: 7.1 Stable tag: 3.7.0 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html From a7d918b63f8740f6dc8c9fb8d088f0c3b3c631ac Mon Sep 17 00:00:00 2001 From: tijmen Date: Sat, 15 Aug 2026 22:24:23 +0200 Subject: [PATCH 6/6] close mock requests --- test/fixtures/Client.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/fixtures/Client.php b/test/fixtures/Client.php index 80bdf2cb..fb78b1e6 100644 --- a/test/fixtures/Client.php +++ b/test/fixtures/Client.php @@ -120,6 +120,11 @@ function request( $method, $url, $body = null, $header = array() ) { protected static function closeRequest( $request ) { if ( PHP_VERSION_ID < 80000 ) { curl_close( $request ); + } elseif ( + is_object($request) && + method_exists($request, 'close') + ) { + $request->close(); } }