Skip to content

[RFC] Improve compatibility with legacy versions #29

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

Merged
merged 2 commits into from
Mar 12, 2017

Conversation

clue
Copy link
Member

@clue clue commented Mar 10, 2017

Because why not… :-)

Now more seriously: This project is a low level lib that is used as a building block for quite a few higher level abstractions on top of it. As such, compatibility (even with significantly outdated versions) is a major concern to me.

Note that I'm not suggesting putting significant amount of work into this. The patch is already here and, personally, I see little harm in supporting this.

Also note that I'm not suggesting we need to keep support indefinitely. Should this ever turn out to be a burden in the future, e.g. because we actually require any new language features or some external lib, then I'm all for dropping support again.

@clue
Copy link
Member Author

clue commented Mar 10, 2017

Rebased now that #27 is in :shipit:

@clue
Copy link
Member Author

clue commented Mar 10, 2017

Rebased now that #26 is in :shipit:

@WyriHaximus
Copy link
Member

Test are segfaulting on 5.3 it seems

@clue
Copy link
Member Author

clue commented Mar 11, 2017

I've traced down the SEGFAULT on legacy PHP < 5.4 to this gist:

$s = popen('echo test', 'r');

stream_set_blocking($s, 0);
stream_set_read_buffer($s, 0);

$data = stream_get_contents($s, 8000);
var_dump($data);

Apparently, this reads beyond the resource limits and returns a corrupted string value where strlen($data) === -1.

I've added a very simple workaround to re-enable stream buffers on affected versions only and I have yet to observe any side effects. In other words: This fixed version works without known limitations currently.

As it turns out, this is actually an issue in the underlying stream component for ALL pipes and is not limited to process pipes. The very same issue can also be reproduced by using $s = STDIN; in the above example. This has been introduced as a side-effect of reactphp/stream#20. I'll make sure to file an issue in the stream component for this and link back here.

@clue
Copy link
Member Author

clue commented Mar 11, 2017

TL;DR: Updated to fix all issues :shipit:

@clue clue merged commit a73ab0d into reactphp:master Mar 12, 2017
@clue clue deleted the compat branch March 12, 2017 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy