Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trim warnings and deprecations from output when invoking PHP in PhpBinaryPath #158

Merged
merged 2 commits into from
Dec 23, 2024

Conversation

alexandre-daubois
Copy link
Contributor

@alexandre-daubois alexandre-daubois commented Dec 18, 2024

Fix #146

Adds a way to trim Deprecated: and Warning: from output. This is not only limited to assertValidLookingPhpBinary, but to all PHP subprocess invocation.

Unfortunately, warning messages are sent to stdout, not stderr.

The cleaning only happens during some setup/validation step of the current env, and the deprecations and warnings are still being displayed to the user when compiling the extension. This way, there's no "sneaky hiding" of error:

image

I added a parameter to the Process::run() method, but if we don't want to add it, the output could also be directly cleaned in the PhpBinaryPath. Indeed, I'm not 100% happy of this parameter, which is really "PHP-subprocess-related" in a class that is not limited to PHP subprocesses.

src/Util/Process.php Outdated Show resolved Hide resolved
src/Util/Process.php Outdated Show resolved Hide resolved
@asgrim asgrim added the bug Something isn't working label Dec 20, 2024
@asgrim
Copy link
Collaborator

asgrim commented Dec 20, 2024

Unfortunately, warning messages are sent to stdout, not stderr.

Dang! That's frustrating, but yeah the approach you've taken is fine given that 👍 thank you @alexandre-daubois :)

@alexandre-daubois alexandre-daubois force-pushed the trim-warning-deprecated branch 2 times, most recently from 7162e1b to b3e6c16 Compare December 20, 2024 11:48
@asgrim asgrim self-assigned this Dec 23, 2024
@asgrim asgrim added this to the 0.3.0 milestone Dec 23, 2024
@asgrim asgrim merged commit 40c3f43 into php:main Dec 23, 2024
19 checks passed
@asgrim
Copy link
Collaborator

asgrim commented Dec 23, 2024

Nice one, thanks @alexandre-daubois !

@alexandre-daubois alexandre-daubois deleted the trim-warning-deprecated branch December 23, 2024 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PHP startup warnings in target PHP result in InvalidPhpBinaryPath exception
2 participants