Doc #77901 [Ver->Csd]: declare tick is now local for each PHP file
| From: | cmb@php.net | Date: | Wed, 17 Apr 2019 10:14:09 +0000 |
| Subject: | Doc #77901 [Ver->Csd]: declare tick is now local for each PHP file | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-16594@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77901&edit=1
ID: 77901
Updated by: cmb@php.net
Reported by: lyrixx at lyrixx dot info
Summary: declare tick is now local for each PHP file
-Status: Verified
+Status: Closed
Type: Documentation Problem
Package: *General Issues
Operating System: all
PHP Version: 7.0
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2019-04-17 10:13:48] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=347260
Log: Fix #77901: declare tick is now local for each PHP file
------------------------------------------------------------------------
[2019-04-15 16:46:47] requinix@php.net
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-15 16:26:39] lyrixx at lyrixx dot info
Description:
------------
Hello,
I'm usually using https://gist.github.com/lyrixx/17074868cdfabd4c783e
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 https://www.php.net/manual/en/migration70.php
But I could not find any mention to this BC breack.
Test script:
---------------
------------------
<?php
// 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);
});
declare(ticks=1);
function foobar()
{
$c = 1;
}
require __DIR__.'/b.php';
foobar();
------------------
<?php
// File b.php:
function bingo()
{
$e = 1;
}
bingo();
------------------
Then
* 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77901&edit=1