From d4f2cf53796b57ff4adbfaec6faade0906350e7f Mon Sep 17 00:00:00 2001 From: James Titcumb Date: Mon, 18 Aug 2025 11:05:30 +0100 Subject: [PATCH] Filter 'PHP ' prefixed notices from output --- src/Platform/TargetPhp/PhpBinaryPath.php | 3 ++- test/assets/valid-php-with-warnings.sh | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Platform/TargetPhp/PhpBinaryPath.php b/src/Platform/TargetPhp/PhpBinaryPath.php index a878046f..8baf4a80 100644 --- a/src/Platform/TargetPhp/PhpBinaryPath.php +++ b/src/Platform/TargetPhp/PhpBinaryPath.php @@ -375,11 +375,12 @@ public static function fromCurrentProcess(): self private static function cleanWarningAndDeprecationsFromOutput(string $testOutput): string { + // Note: xdebug can prefix `PHP ` onto warnings/deprecations, so filter them out too return implode( "\n", array_filter( explode("\n", $testOutput), - static fn (string $line) => ! preg_match('/^(Deprecated|Warning|PHP Warning):/', $line), + static fn (string $line) => ! preg_match('/^(Deprecated|Warning|PHP Warning|PHP Deprecated):/', $line), ), ); } diff --git a/test/assets/valid-php-with-warnings.sh b/test/assets/valid-php-with-warnings.sh index ee3eaf89..9289f248 100755 --- a/test/assets/valid-php-with-warnings.sh +++ b/test/assets/valid-php-with-warnings.sh @@ -4,6 +4,8 @@ echo "PHP Warning: PHP Startup: Unable to load dynamic library 'redis' (tried: /path/to/redis (dlopen(/path/to/redis, 0x0009): [...] in Unknown on line 0" echo "Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: /path/to/pdo_mysql (/path/to/pdo_mysql: cannot open shared object file: No such file or directory), /path/to/pdo_mysql.so (/path/to/pdo_mysql.so: undefined symbol: mysqlnd_debug_std_no_trace_funcs)) in Unknown on line 0" echo "Deprecated: Function unsafe_function() is deprecated since 1.5, use safe_replacement() instead in example.php on line 9" +echo "Deprecated: PHP Startup: session.sid_length INI setting is deprecated in Unknown on line 0" +echo "PHP Deprecated: PHP Startup: session.sid_length INI setting is deprecated in Unknown on line 0" # This is the expected output of PIE: echo "PHP";