RE: [PHP-DEV] [RFC] Extension Prepend Files
| From: | François Laupretre | Date: | Sun, 04 Jan 2015 12:36:52 +0000 |
| Subject: | RE: [PHP-DEV] [RFC] Extension Prepend Files | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-80144@lists.php.net to get a copy of this message | ||
> De : Benjamin Eberlei [mailto:kontakt@beberlei.de]
> I want to open discussion on my RFC to strengthen the ability of extensions
> to provide functionality to developers in both C **and** PHP code.
>
> For this extensions can add PHP files to a list of "prepend files" that are
> part of every request execution exactly the same way the INI
> auto_prepend_file functionality works:
>
> https://wiki.php.net/rfc/extension_prepend_files
>
> I propose implementation details in the RFC, but they are completely up to
> discussion. I am even sure there is probably a better way than what I
> proposed, because I am not familiar with the code.
Can you please develop the API changes in your RFC ? You're talking about changes in
zend_execute_scripts(), a new zend_execute_script() function (but the name in the prototype is
wrong), then php_execute_scripts()...
Where are the file handles coming from ? Does it mean that the files to prepend will be kept open ?
Do you register paths to prepend, or will the scripts be loaded in memory during MINIT ?
How will these files be cached by opcode caches (mandatory for such a feature) ?
And, finally, how can an extension determine where a given PHP script it requires has been installed
? It makes sense in php.ini because it is under control of the final user. But an extension is just
a C library, installed anywhere or bundled in the PHP executable. Would it compute the script paths
from PHP installation paths ?
Actually, I don't see how it would work with PHP scripts which would remain separate from the
extension code. What I would imagine for such a feature, would be PHP code embedded in the extension
as a memory buffer, registered during MINIT, and then executed at each RINIT. This would probably
require a stream wrapper because the opcode cache would require paths for this code. We can also
concatenate the scripts but we still need a virtual path. The stream wrapper would just be simpler
to implement.
Regards
François