Skip to content

tests/streams_7.phpt fails on PHP 8.6: stream errors no longer include the path #103

Description

@andypost

tests/streams_7.phpt fails on PHP 8.6 because stream error messages no longer include the path.

Seen while building php86-pecl-zstd 0.17.0 against PHP 8.6.0alpha3 in Alpine Linux CI.

Failure

TEST 63/65 [tests/streams_7.phpt]
========DIFF========
     Warning: readfile(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in %s

003- Warning: readfile(https://github.com/kjdev/php-ext-zstd/raw/master/tests/streaming.zst): %sailed to open stream: no suitable wrapper could be found in %s
003+ Warning: readfile(): Failed to open stream: no suitable wrapper could be found in /builds/.../tests/streams_7.php on line 2

005- Warning: readfile(compress.zstd://https://github.com/kjdev/php-ext-zstd/raw/master/tests/streaming.zst): %sailed to open stream: operation failed in %s
005+ Warning: readfile(): Failed to open stream: operation failed in /builds/.../tests/streams_7.php on line 2

     ===Done===
========DONE========
FAIL compress.zstd read online stream denied [tests/streams_7.phpt]

Cause

Not a regression in this extension. PHP 8.6 removed the path parameter from the stream error functions in php/php-src#22792 ("stream: remove path parameter in stream error functions", merged 2026-07-19 as 34c686a5b4e), so warnings are now emitted as readfile(): Failed to open stream… instead of readfile(<path>): Failed to open stream….

This is intentional — the same PR updated 30 of php-src's own .phpt files the same way, for example in ext/standard/tests/file/fopen_variation14-win32.phpt:

-Warning: fopen(file://fopen14.tmpDir\fopen_variation14.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(): Failed to open stream: no suitable wrapper could be found in %s on line %d

It is related to the removal of php_error_docref1() / php_error_docref2() listed under "Removed" in UPGRADING.INTERNALS. Note that setting error_include_args=1 does not restore the old text: it fills the parentheses with zend_trace_current_function_args_string(), which renders quoted backtrace-style arguments rather than the bare path.

tests/streams_7.phpt is the only test in the suite that embeds a path inside an expected warning, so it is the only one affected.

Suggested fix

Using %S ([^\r\n]* in run-tests.php, i.e. zero or more non-newline characters) inside the parentheses makes the expectation match both the pre-8.6 and 8.6+ output, so the test keeps working on all supported PHP versions rather than needing a version-specific variant:

--- a/tests/streams_7.phpt
+++ b/tests/streams_7.phpt
@@ -15,8 +15,8 @@
 --EXPECTF--
 Warning: readfile(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in %s
 
-Warning: readfile(https://github.com/kjdev/php-ext-zstd/raw/master/tests/streaming.zst): %sailed to open stream: no suitable wrapper could be found in %s
+Warning: readfile(%S): %sailed to open stream: no suitable wrapper could be found in %s
 
-Warning: readfile(compress.zstd://https://github.com/kjdev/php-ext-zstd/raw/master/tests/streaming.zst): %sailed to open stream: operation failed in %s
+Warning: readfile(%S): %sailed to open stream: operation failed in %s
 
 ===Done===

With this applied, make test on PHP 8.6.0alpha3 gives 0 failures and tests/streams_7.phpt passes (verified that it runs rather than skips — tests/streams_6.phpt is the one skipped as an online test).

Happy to send this as a PR if you prefer.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions