Skip to content

Commit 90d6d18

Browse files
authored
Merge pull request #476 from asgrim/475-fix-invalid-php-binary-again
Ensure whitespace is trimmed from PHP binary output
2 parents d41c81a + fc7359c commit 90d6d18

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Platform/TargetPhp/PhpBinaryPath.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,12 +422,12 @@ private static function guessWithPhpConfig(self $phpBinaryPath): self
422422
private static function cleanWarningAndDeprecationsFromOutput(string $testOutput): string
423423
{
424424
// Note: xdebug can prefix `PHP ` onto warnings/deprecations, so filter them out too
425-
return implode(
425+
return trim(implode(
426426
"\n",
427427
array_filter(
428428
explode("\n", $testOutput),
429429
static fn (string $line) => ! preg_match('/^(Deprecated|Warning|PHP Warning|PHP Deprecated):/', $line),
430430
),
431-
);
431+
));
432432
}
433433
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
# These should be implicitly filtered out by PIE
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"
5+
echo "" # add some newlines...
56
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"
7+
echo " " # add some whitespace...
68
echo "Deprecated: Function unsafe_function() is deprecated since 1.5, use safe_replacement() instead in example.php on line 9"
79
echo "Deprecated: PHP Startup: session.sid_length INI setting is deprecated in Unknown on line 0"
810
echo "PHP Deprecated: PHP Startup: session.sid_length INI setting is deprecated in Unknown on line 0"

0 commit comments

Comments
 (0)