php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #61693 unregister_tick in registered function
Submitted: 2012-04-11 12:46 UTC Modified: 2012-04-11 15:07 UTC
From: hugosmail at gmail dot com Assigned:
Status: Wont fix Package: Unknown/Other Function
PHP Version: 5.4.0 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: hugosmail at gmail dot com
New email:
PHP Version: OS:

 

 [2012-04-11 12:46 UTC] 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");



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-04-11 14:52 UTC] 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 15:07 UTC] laruence@php.net
-Status: Open +Status: Wont fix
 [2015-10-12 09:20 UTC] martin dot keckeis1 at gmail dot com
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 06:01:29 2024 UTC