|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74712 Now have to redeclare ticks on every file in PHP 7
Submitted: 2017-06-08 16:38 UTC Modified: 2017-06-08 22:27 UTC
From: hello at peterfeatherstone dot com Assigned:
Status: Duplicate Package: Scripting Engine problem
PHP Version: Irrelevant OS: Ubuntu 17.04
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: hello at peterfeatherstone dot com
New email:
PHP Version: OS:


 [2017-06-08 16:38 UTC] hello at peterfeatherstone dot com
In PHP 5.6 it seems that adding declare(ticks=1) and then using register_tick_function() would follow any includes and provide profiling information accordingly.

In PHP 7+ however it now seems I have to add declare(ticks=1) in every file. I use this for profiling every method call on a page load and can't now add this to each PHP file in my system (If they are in libraries etc.).

I can't find anything in the docs about changes that were made to this or an alternative method for profiling every tick in the application.

Test script:
Replication code can be found here -

Expected result:
Running php index.php I would expect to see 7

Actual result:
In PHP 5.6 I see 7 as expected
In PHP 7 I see 5


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-06-08 16:43 UTC]
Please add the repro code on here instead of having to hunt for it on an external site with the possibility of the link going down.
 [2017-06-08 16:49 UTC] hello at peterfeatherstone dot com
Sure, no problem - although your recommendations say to link externally if its pver 20 lines so I couldnt paste it...
 [2017-06-08 16:53 UTC] hello at peterfeatherstone dot com
Replication code:



$count = 0;

function ticker() {
  global $count;

$foo = 'foo';
$bar = 'bar';

include dirname(__FILE__) . '/inc.php';

echo $count;


$baz = "baz";
$qux = "qux";
 [2017-06-08 22:27 UTC]
-Status: Open +Status: Duplicate
 [2017-06-08 22:27 UTC]
Duplicate of bug #71448, which has an explanation by @nikic.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Dec 05 10:01:26 2023 UTC