php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #20859 request: declare(ticks) should carry over into functions
Submitted: 2002-12-06 09:31 UTC Modified: 2010-12-22 15:15 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: mitja at doticni dot net Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.3.0RC2 OS: any
Private report: No CVE-ID: None
 [2002-12-06 09:31 UTC] mitja at doticni dot net
When using declare(ticks=xx), the ticking doesn't work in any functions that are called from within this block. It would be really helpful (to me, anyway :), if this worked:

$endtime=time()+10;
$abort=false;
function setabort()
{
   global $endtime, $abort;
   if (time()>=$endtime)
      $abort=true;
}

function SomeFunc()
{
   global $abort;
   while (!$abort) {
      // do stuff
      // call func()s
      // do some more stuff
   }
}

declare(ticks=1000) {
   SomeFunc();
}

--

now, currently this works if I put declare() blocks in SomeFunc() and all functions it calls, but it seems a lot of work for something simple. It would be nice if one could just turn ticks on and off without changing every function in a script... (checking time() each iteration is slow)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-06 09:33 UTC] mitja at doticni dot net
in the above example, there should be a register_tick_function, of course :)
 [2010-12-22 15:15 UTC] johannes@php.net
-Status: Open +Status: Bogus -Package: Feature/Change Request +Package: *General Issues
 [2010-12-22 15:15 UTC] johannes@php.net
declare(ticks) is no more.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 18:01:33 2024 UTC