Closed pcfreak30 closed 1 year ago
Thanks for the PR, @pcfreak30 !
I do fear that such a custom stream wrapper might interfere with some hosting solutions, so we'll have to get feedback first. I think that some hosting providers use custom stream wrappers to move the filesystem from the web server serving the site to a separate NAS or similar.
I'll ask in #hosting-community channel on MakeWP Slack to see if I get some feedback on this.
Link to Slack discussion: https://wordpress.slack.com/archives/C3D6T7F8Q/p1588739563086800
New RFC to watch: https://wiki.php.net/rfc/deprecate_ticks
I recently worked on trying to make this PR production-ready, in the hopes of having intermediate hook profiling working again and then bundling this command. If the above RFC passes, however, this will be the death blow to intermediate hooks profiling. Until then, I don't see a point in investing more time into this, and once the RFC is passed (which I expect is going to happen eventually), I'll rip out all traces of intermediate hooks profiling and bundle the command without it.
New RFC to watch: https://wiki.php.net/rfc/deprecate_ticks
I recently worked on trying to make this PR production-ready, in the hopes of having intermediate hook profiling working again and then bundling this command. If the above RFC passes, however, this will be the death blow to intermediate hooks profiling. Until then, I don't see a point in investing more time into this, and once the RFC is passed (which I expect is going to happen eventually), I'll rip out all traces of intermediate hooks profiling and bundle the command without it.
It seems that the RFC is withdrawn so there is still hope for intermediate hook profiling I assume? 🙏
Proceeding with https://github.com/wp-cli/wp-cli/issues/5594 for this repository. I've captured this PR to https://gist.github.com/danielbachhuber/6bc4276ce559ddaa8b809a17c5ad6cd5 in case this PR is auto-closed or broken in some way.
I believe I have created a solution for the tick profiling issue in PHP7.
The core problem I have found with the stream wrappers is you cannot actually change the length of the stream without it crashing, even with "stream filters".
So the workaround is to create a new file beside the original with a suffix, only if it has a PHP opening tag, then use that as the file resource.
Lastly, a shutdown callback is added to clean up the file, and the suffix is removed before rendering the traces.
This is not stored elsewhere as
__DIR__
and__FILE__
will get changed, potentially breaking location-aware scripts.Testing this so far seems promising. I don't consider this production-ready, so no unit tests or anything, but providing it as a foundational point to get this working again.
Thanks :)