Bug->Doc #77901 [Opn->Ver]: declare tick is now local for each PHP file

From: Date: Mon, 15 Apr 2019 16:46:47 +0000
Subject: Bug->Doc #77901 [Opn->Ver]: declare tick is now local for each PHP file
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-16574@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: requinix@php.net Reported by: lyrixx at lyrixx dot info Summary: declare tick is now local for each PHP file -Status: Open +Status: Verified -Type: Bug +Type: Documentation Problem Package: *General Issues Operating System: all -PHP Version: 7.1.28 +PHP Version: 7.0 Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.doc.bugs (#16574) next »