Bug #77901 [NEW]: declare tick is now local for each PHP file

From: Date: Mon, 15 Apr 2019 16:26:39 +0000
Subject: Bug #77901 [NEW]: declare tick is now local for each PHP file
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-220468@lists.php.net to get a copy of this message
From:             lyrixx at lyrixx dot info
Operating system: all
PHP version:      7.1.28
Package:          *General Issues
Bug Type:         Bug
Bug description:declare tick is now local for each PHP file

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 bug report at https://bugs.php.net/bug.php?id=77901&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=77901&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=77901&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=77901&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=77901&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=77901&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=77901&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=77901&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=77901&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=77901&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=77901&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=77901&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=77901&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=77901&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77901&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=77901&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=77901&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=77901&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77901&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=77901&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=77901&r=mysqlcfg



Thread (1 message)

  • lyrixx at lyrixx dot info
« previous php.bugs (#220468) next »