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

STDOUT/STDERR IO streams do not exist in process isolation #1366

Merged
merged 2 commits into from
Jul 30, 2014

Conversation

sun
Copy link
Contributor

@sun sun commented Jul 29, 2014

The PHP CLI SAPI does not auto-register the standard IO streams when a script is piped into STDIN (which is the case in process isolation); cf.

When a test is executed without process isolation, then the STDOUT and STDERR streams are available. But if the test is executed in a separate process, then attempting to access the streams triggers a PHP Notice (undefined constant), followed by a PHP Warning (fopen).

A prominent example of affected code is e.g. vfsStream, which is an officially recommended/endorsed library for PHPUnit.

The PHP CLI SAPI does not auto-register the standard IO streams when a script is piped into STDIN (which is the case in process isolation); cf.

- https://bugs.php.net/bug.php?id=43283
- http://php.net/manual/en/features.commandline.io-streams.php
- https://gist.github.com/sun/d02c242514c8f34bccdb
@sun
Copy link
Contributor Author

sun commented Jul 30, 2014

So apparently, HHVM does define IO streams on CLI even when a script is injected via STDIN…

In other words, they seem to have resolved PHP core bug #43283.

The test result on HHVM is the expected output if STDOUT was defined. It shows a different problem in that we're not able to cleanly identify and extract the serialized string in the output, but that's a different issue.
(FWIW, I played with using a custom file descriptor already, but sadly that didn't work on Windows.)

So the test needs to be skipped on HHVM. — But how do I skip a PHPT test?

@sebastianbergmann
Copy link
Owner

Add a SKIPIF section.

@sun
Copy link
Contributor Author

sun commented Jul 30, 2014

Oh thanks! Learn something new every day :) Added a SKIPIF section.

@whatthejeff
Copy link
Contributor

Thanks, @sun!

whatthejeff added a commit that referenced this pull request Jul 30, 2014
STDOUT/STDERR IO streams do not exist in process isolation
@whatthejeff whatthejeff merged commit 30a6b8e into sebastianbergmann:master Jul 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants