From f9ef7ea357259bb6bdaea717e285d2b610f19f37 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sat, 15 Aug 2026 23:26:37 +0200 Subject: [PATCH 1/2] Tests/require-missing: clarify skip conditions * As support for PHP < 7.1 has been dropped, we can use `PHP_VERSION_ID` instead of `PHP_VERSION` for the version comparisons. * Using a positive condition instead of a negative one improves the readability of the test code. * Ensure the tests have unique names. --- tests/require-missing-php5.phpt | 6 +++--- tests/require-missing.phpt | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/require-missing-php5.phpt b/tests/require-missing-php5.phpt index 0050579..1d8327c 100644 --- a/tests/require-missing-php5.phpt +++ b/tests/require-missing-php5.phpt @@ -1,12 +1,12 @@ --TEST-- -Include and require of nonexistent files +Include and require of nonexistent files (PHP < 8.0) --SKIPIF-- =")) { + echo "skip PHP 7 version of the test on PHP 8+"; } --FILE-- =")) { - echo "skip PHP 8+ version of the test in PHP <8"; +if (version_compare(PHP_VERSION_ID, "80000", "<")) { + echo "skip PHP 8.0-8.5 version of the test on PHP <8"; } --FILE-- Date: Sat, 15 Aug 2026 23:28:52 +0200 Subject: [PATCH 2/2] PHP 8.6 | Tests: handle change in error message format This update the `require-missing*.phpt` tests by adding a new test file to handle the PHP 8.6+ format of the expected error messages. Ref: https://wiki.php.net/rfc/display_error_function_args --- tests/require-missing-phpgte86.phpt | 49 +++++++++++++++++++++++++++++ tests/require-missing.phpt | 3 ++ 2 files changed, 52 insertions(+) create mode 100644 tests/require-missing-phpgte86.phpt diff --git a/tests/require-missing-phpgte86.phpt b/tests/require-missing-phpgte86.phpt new file mode 100644 index 0000000..db3ced0 --- /dev/null +++ b/tests/require-missing-phpgte86.phpt @@ -0,0 +1,49 @@ +--TEST-- +Include and require of nonexistent files (PHP >= 8.6) + +--SKIPIF-- + +===DONE=== + +--EXPECTF-- +Including missing file... + +Warning: fopen('%s', 'r', true): Failed to open stream: No such file or directory in %s%esrc%eCodeManipulation%eStream.php on line %d + +Warning: include('%s'): Failed to open stream: "Patchwork\CodeManipulation\Stream::stream_open" call failed in %s on line 9 + +Warning: include('%s'): Failed opening '%s/includes/does-not-exist.php' for inclusion (include_path='%s') in %s on line 9 +Good, it did not throw/exit. + +Requiring missing file... + +Warning: fopen('%s', 'r', true): Failed to open stream: No such file or directory in %s%esrc%eCodeManipulation%eStream.php on line %d + +Warning: require('%s'): Failed to open stream: "Patchwork\CodeManipulation\Stream::stream_open" call failed in %s on line 13 + +Fatal error: Uncaught Error: Failed opening required '%s/includes/does-not-exist.php' (include_path='%s') in %s:13 +Stack trace: +#0 {main} + thrown in %s on line 13 diff --git a/tests/require-missing.phpt b/tests/require-missing.phpt index d4d879d..1278e32 100644 --- a/tests/require-missing.phpt +++ b/tests/require-missing.phpt @@ -8,6 +8,9 @@ Include and require of nonexistent files (PHP 8.0-8.5) if (version_compare(PHP_VERSION_ID, "80000", "<")) { echo "skip PHP 8.0-8.5 version of the test on PHP <8"; } +if (version_compare(PHP_VERSION_ID, "80600", ">=")) { + echo "skip PHP 8.0-8.5 version of the test on PHP >=8.6"; +} --FILE--