Req #61693 [Com]: unregister_tick in registered function
| From: | martin dot keckeis1 at gmail dot com | Date: | Mon, 12 Oct 2015 09:20:05 +0000 |
| Subject: | Req #61693 [Com]: unregister_tick in registered function | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-196544@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61693&edit=1
ID: 61693
Comment by: martin dot keckeis1 at gmail dot com
Reported by: hugosmail at gmail dot com
Summary: unregister_tick in registered function
Status: Wont fix
Type: Feature/Change Request
Package: Unknown/Other Function
Operating System: Windows
PHP Version: 5.4.0
Block user comment: N
Private report: N
New Comment:
I also run into this issue.
What i wanted to accomplish? Since i had some "out of memory" errors i wanted to debug
some script and log a debug message then 80% of the memory is reached, that i can log some more
things.
But when 80% is first time triggered, i wanted to unregister the function, since its not need
anymore.
Previous Comments:
------------------------------------------------------------------------
[2012-04-11 14:52:59] laruence@php.net
there is a list to reservers user tick functions, when doing tick call, php will
call user tick functions iteratively via go through that list.
if you delete the element which is calling, then the iterator will be messed .
of course, technically, it can be implemented, but the pay will be expensive.
and, I think you can do it like:
register_tick_function();
tick,
tick,
unregister_tick_functiono()
------------------------------------------------------------------------
[2012-04-11 12:46:05] hugosmail at gmail dot com
Description:
------------
Hi, while I'm trying call unregister_tick_function() in function executed by
register_tick_function(), I get a "Warning: unregister_tick_function(): Unable to delete tick
function executed at the moment"
I don't know, if this is a bug, but it may be very useful to call unregister like this.
Test script:
---------------
<?php
declare(ticks = 1);
function a() {
echo "a";
unregister_tick_function("a");
}
register_tick_function("a");
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61693&edit=1