Skip to content
This repository has been archived by the owner on Dec 16, 2019. It is now read-only.

Streams support #911

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Streams support #911

wants to merge 4 commits into from

Conversation

sirsnyder
Copy link
Collaborator

This is a thread-safe port of the php streams layer, including wrappers, transports and filters. Resources were replaced by objects and the following new classes introduced.

  • Streams
  • File
  • Stream
  • StreamContext
  • StreamWrapper
  • StreamFilter
  • StreamBucket
  • StreamBucketBrigade
  • pthreads_user_filter
  • FileStream
  • SocketStream

See stub.php. A File class definition in global scope will be a huge BC break though. Maybe we will find another name or introduce a namespace, whatever that looks like.

Predefined wrappers

  • php
    • temp
    • memory
    • output
    • stdin
    • stdout
    • stderr
    • fd/
    • filter/
  • file
  • glob
  • data
  • ftp
  • http

Predefined filters

  • string.rot13
  • string.toupper
  • string.tolower

Todo

  • I've no idea why travis fails. Maybe you have an idea.
  • Tests
  • more Tests
  • Windows build and testing

What's next? Removal of Todos for sure. I would like to publish this in a timely manner as prerelease in a separate branch to get audience and feedback. Possibly with other BC breaking changes like #906 and the behavior of static members initialization.

On top of this PR a port of the openssl "ssl" wrapper will follow.

@tpunt @dktapps Thoughts, questions?

Big thanks to the team behind php-src!

@tpunt
Copy link
Collaborator

tpunt commented Jan 1, 2019

Great work @sirsnyder! I'll try to get around to reviewing the code some time soon, as well as give some feedback on the API exposed.

@dktapps
Copy link
Contributor

dktapps commented Jan 13, 2019

This looks interesting for sure, but I'm doubtful about the merits of replicating half of PHP into pthreads. As far as I knew, php-src are planning to kill off resources anyway.

I haven't looked closely at the diff yet, so please excuse me if I said something wrong.

@sirsnyder
Copy link
Collaborator Author

I understand the concerns, it will be a lot more code to care about. Nevertheless it is a great opportunity for pthreads, we can build many things up on streams. I heard two years ago for the first time, that resources should be replaced. To be honest, I think that will never happen and end like php 6 in the distant future. That task is huge, it's massive. Beside the core, API, every bundled and external extension dealing with resources have to replace them too. The db extensions are no fun, really. Even if I'm wrong, which would be great, implementation and data handling must be thread-safe. Objects only are not enough.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants