PHP7 register_tick_function / declare affects only the file it is declared in? I used to profile in php 5.6< using register_tick_function/declare("ticks"), but inside PHP7 I always get ticks only for the lines I explicitly mentioned declare construction file in, which doesn't allow me to profile the whole application as php5.6 and lower allowed me.
I tried to tamper with op_cache but didn't help to any avail.
inspiration: https://kpayne.me/2013/12/24/write-your-own-code-profiler-in-php/
It appears that the implementation of declare
was a little buggy before PHP 7.0. The declare statement is only supposed to affect the file it is in, and therefore you must add declare(ticks=1)
on each file. The existing usage was buggy and was "fixed" in PHP 7.0.
After some research, it looks like there's a comment on this in the register_tick_function
documentation