You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Profiling an intermediate hook is sometimes empty #126
PHP 7.1 supports async signals, see https://wiki.php.net/rfc/async_signals. It looks like pcntl_async_signals() is not documented yet. This allows handling signals without using ticks.
Maybe this issue can be resolved by recoding how intermediate hooks work with PHP7.1?
Reacted by Luca Castellone, Leho Kraav and Philipp
Yeah, after running into this now, and going through the PHP bug discussion - it actually was a bug in PHP5, and PHP7 fixed the leak.
Looks like profile intermediate hooks won't work at all on PHP 7.0, and the only way forward for PHP 7.1+ is to modernize our approach here like upstream has noted (via @austinginder).
However, bear in mind that the patch by @danielbachhuber isn't complete and there are missing parts. Specifically, the FileStreamWrapper class in the patch does not fully implement streamWrapper.
For example, WordPress when loading the translation files (load_textdomain function), uses the fseek operation which is not implemented in the patch and so the command breaks:
Warning: fseek(): Stream does not support seeking in /home/user/public_html/wp-includes/pomo/streams.php on line 197
Also, this leaves *_file.php files behind, which you can easily cleanup:
Activity
danielbachhuber commentedon Jan 3, 2017
This is a bug in PHP 7 https://bugs.php.net/bug.php?id=72966
Related thread from another profiling plugin khromov/wp-performance-profiler#1
Disable these tests on PHP 7, which aren't functional
This test also needs to be disabled for PHP 7
austinginder commentedon Nov 28, 2017
One of the comments in https://bugs.php.net/bug.php?id=71448 mentioned the following:
Maybe this issue can be resolved by recoding how intermediate hooks work with PHP7.1?
lkraav commentedon Mar 21, 2018
Yeah, after running into this now, and going through the PHP bug discussion - it actually was a bug in PHP5, and PHP7 fixed the leak.
Looks like
profileintermediate hooks won't work at all on PHP 7.0, and the only way forward for PHP 7.1+ is to modernize our approach here like upstream has noted (via @austinginder).uprise10 commentedon Jun 20, 2018
Is there another way to profile the (for example)
wp_head:beforehook? Or is switching back to PHP 5.6 the only option for now?danielbachhuber commentedon Jun 20, 2018
PHP 5.6 is the only option.
pcfreak30 commentedon Apr 26, 2020
See #160 @danielbachhuber @uprise10 @lkraav @austinginder
ehausen commentedon Jun 7, 2022
So currently this won't work on PHP 7.1+ either, correct?
(But could be made to work?)
Disable these tests on PHP 7, which aren't functional
This test also needs to be disabled for PHP 7
tobias992 commentedon Feb 21, 2023
Hello,
i am not a professional on github. Sorry for my question if it's stupid. For this bug here looks like there is a fix (https://gist.github.com/danielbachhuber/6bc4276ce559ddaa8b809a17c5ad6cd5) - there is a way to download this wp-cli profile package including this fix?
tdiam commentedon Apr 4, 2023
Assuming you have WP-CLI and the profile command installed, you can apply the patch with the following one-liner:
However, bear in mind that the patch by @danielbachhuber isn't complete and there are missing parts. Specifically, the
FileStreamWrapperclass in the patch does not fully implementstreamWrapper.For example, WordPress when loading the translation files (
load_textdomainfunction), uses thefseekoperation which is not implemented in the patch and so the command breaks:Also, this leaves
*_file.phpfiles behind, which you can easily cleanup: