Skip to content

Commit d4f2cf5

Browse files
committed
Filter 'PHP ' prefixed notices from output
1 parent e90a99e commit d4f2cf5

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Platform/TargetPhp/PhpBinaryPath.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,11 +375,12 @@ public static function fromCurrentProcess(): self
375375

376376
private static function cleanWarningAndDeprecationsFromOutput(string $testOutput): string
377377
{
378+
// Note: xdebug can prefix `PHP ` onto warnings/deprecations, so filter them out too
378379
return implode(
379380
"\n",
380381
array_filter(
381382
explode("\n", $testOutput),
382-
static fn (string $line) => ! preg_match('/^(Deprecated|Warning|PHP Warning):/', $line),
383+
static fn (string $line) => ! preg_match('/^(Deprecated|Warning|PHP Warning|PHP Deprecated):/', $line),
383384
),
384385
);
385386
}

test/assets/valid-php-with-warnings.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
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"
55
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"
66
echo "Deprecated: Function unsafe_function() is deprecated since 1.5, use safe_replacement() instead in example.php on line 9"
7+
echo "Deprecated: PHP Startup: session.sid_length INI setting is deprecated in Unknown on line 0"
8+
echo "PHP Deprecated: PHP Startup: session.sid_length INI setting is deprecated in Unknown on line 0"
79

810
# This is the expected output of PIE:
911
echo "PHP";

0 commit comments

Comments
 (0)