|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #77901 declare tick is now local for each PHP file
Submitted: 2019-04-15 16:26 UTC Modified: 2019-04-17 10:14 UTC
From: lyrixx at lyrixx dot info Assigned: cmb (profile)
Status: Closed Package: *General Issues
PHP Version: 7.0 OS: all
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: lyrixx at lyrixx dot info
New email:
PHP Version: OS:


 [2019-04-15 16:26 UTC] lyrixx at lyrixx dot info

I'm usually using
to find segfault, or line that hang.

But, as of PHP 7.0 this does not work anymore because it seems declare tick is now local for each PHP file.

I check in But I could not find any mention to this BC breack.

Test script:
// File a.php:
register_tick_function(function() {
    $bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
    $last = reset($bt);
    $info = sprintf("%s +%d\n", $last['file'], $last['line']);
    file_put_contents('php://output', $info, FILE_APPEND);


function foobar()
    $c = 1;

require __DIR__.'/b.php';

// File b.php:
function bingo()
    $e = 1;


* docker run -it --rm -v $(pwd):/app  php:5.6 php /app/a.php
* docker run -it --rm -v $(pwd):/app  php:7.0 php /app/a.php

Expected result:
The same output for PHP 5.6 and PHP 7.0:

/app/a.php +9
/app/a.php +14
/app/b.php +6
/app/b.php +5
/app/b.php +8
/app/a.php +16
/app/a.php +13
/app/a.php +18

Actual result:
/app/a.php +9
/app/a.php +14
/app/a.php +16
/app/a.php +13
/app/a.php +18


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-04-15 16:46 UTC]
-Status: Open +Status: Verified -Type: Bug +Type: Documentation Problem -PHP Version: 7.1.28 +PHP Version: 7.0
 [2019-04-15 16:46 UTC]
declare(ticks); was never supposed to affect other files than the one the directive is used in. See bug #71448.

The declare docs and migration guide should mention the change.
 [2019-04-17 10:13 UTC]
Automatic comment from SVN on behalf of cmb
Log: Fix #77901: declare tick is now local for each PHP file
 [2019-04-17 10:14 UTC]
-Status: Verified +Status: Closed -Assigned To: +Assigned To: cmb
 [2019-04-17 10:14 UTC]
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 [2019-04-17 10:15 UTC]
Automatic comment on behalf of cmb
Log: Fix #77901: declare tick is now local for each PHP file
 [2020-02-07 06:05 UTC]
Automatic comment on behalf of cmb
Log: Fix #77901: declare tick is now local for each PHP file
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Feb 05 21:03:38 2023 UTC