|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-04-25 01:19 UTC] nathan dot renniewaldock at gmail dot com
[2016-05-14 16:26 UTC] hamid dot a85 at gmail dot com
[2016-05-14 17:22 UTC] nikic@php.net
-Status: Open
+Status: Wont fix
[2016-05-14 17:22 UTC] nikic@php.net
[2017-03-14 13:03 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 16:00:02 2025 UTC |
Description: ------------ Not sure if this is intended behaviour or fallout from other declare directives intending to be scoped to a particular file. The manual states: The declare construct can also be used in the global scope, affecting all code following it (however if the file with declare was included then it does not affect the parent file). I've attached a script that tries to show what I'm trying to do automatically, but you can remove the forking and just try and ctrl-c from your terminal. Test script: --------------- <?php declare(ticks=1); $start = time(); pcntl_signal(SIGINT, function() use ($start) { $diff = time() - $start; echo "SIGINT received after $diff seconds\n"; exit; }); $id = posix_getpid(); $child = pcntl_fork(); if ($child) { include 'inc.php'; } else { posix_kill($id, SIGINT); } ## inc.php <?php $a = 0; $start = time(); while(time() < $start + 5) { $a = $a + 2; # something tickable } Expected result: ---------------- SIGINT received after 0 seconds Actual result: -------------- SIGINT received after 5 seconds