LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   How to create a new stream type for php (the interpreter itself) (http://www.linuxquestions.org/questions/programming-9/how-to-create-a-new-stream-type-for-php-the-interpreter-itself-4175418995/)

eantoranz 07-27-2012 03:34 PM

How to create a new stream type for php (the interpreter itself)
 
Hi!

I guess I could rename this thread to something like: How to create your own php_stream custom reader (like a plugin)?

Suppose (well, don't suppose, it'd be rather more correct to say: know) I want to hack php to be able to get/interpret php files from a new source that's not supported in mainline php.

What would be the right "hooks" to hack in order to do it?

I'm working on php 5.2 (I'll move to later versions when I get this right) and at the time I'm able to "tell" that I want to use an alternate method inside _php_stream_fopen_with_path. This function has to return a php_stream. Now, I think I could create my own php_stream structure where I would set my own methods in order to handle I/O for the file I want to read so that it's read correctly.... but I'd love not to have to learn everything from scratch. Perhaps someone has experience doing this kind of trick? Is it documented somewhere?

Thanks in advance.


All times are GMT -5. The time now is 06:20 PM.