Skip to content

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

Merged
whatthejeff merged 2 commits into
sebastianbergmann:masterfrom
sun:cli-io-streams
Jul 30, 2014
Merged

STDOUT/STDERR IO streams do not exist in process isolation#1366
whatthejeff merged 2 commits into
sebastianbergmann:masterfrom
sun:cli-io-streams

Conversation

@sun

@sun sun commented Jul 29, 2014

Copy link
Copy Markdown
Contributor

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

sun commented Jul 30, 2014

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Owner

Add a SKIPIF section.

@sun

sun commented Jul 30, 2014

Copy link
Copy Markdown
Contributor Author

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

@whatthejeff

Copy link
Copy Markdown
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