[go: up one dir, main page]

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

Could not open input file: should be sent to stderr #11141

Closed
mvorisek opened this issue Apr 27, 2023 · 2 comments · Fixed by ThePHPF/thephp.foundation#90
Closed

Could not open input file: should be sent to stderr #11141

mvorisek opened this issue Apr 27, 2023 · 2 comments · Fixed by ThePHPF/thephp.foundation#90

Comments

@mvorisek
Copy link
Contributor

Description

Repro command: php non-existent.php

Currently the output (Could not open input file: non-existent.php) is sent to stdout but it should be sent to stderr instead.

I have discovered when using php for interprocess communication where the stdout might be consumed as regular data causing protocol failure hard to understand, as in my case, only the first 4 bytes were consumed (and from Coul it was hard to identify the problem). Simply said, stdout should never contain any other data then data printed by a valid script.

@NattyNarwhal
Copy link
Member

Looks like php_printf is used a bit in main/ and SAPIs for this - and if we're counting sundry diagnostic information, even more in extensions and Zend/. It probably shouldn't.

@iluuu1994
Copy link
Member

Switching to STDERR should be fine. U fortunately, the error messages seem to be quite inconsistent with where they are printed.

nielsdos added a commit to nielsdos/php-src that referenced this issue Apr 29, 2023
I grepped for php_printf cases in main/ and sapi/ and converted the
cases which clearly indicate errors to fprintf(stderr, ...), like
suggested in the linked issue.
nielsdos added a commit to nielsdos/php-src that referenced this issue Apr 29, 2023
I grepped for php_printf cases in main/ and sapi/ and converted the
cases which clearly indicate errors to fprintf(stderr, ...), like
suggested in the linked issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants