php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61615 repeated register_tick_function
Submitted: 2012-04-04 03:02 UTC Modified: 2012-04-04 04:30 UTC
From: quirenbach at moe dot de Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.3.10 OS:
Private report: No CVE-ID: None
 [2012-04-04 03:02 UTC] quirenbach at moe dot de
Description:
------------
you can repeated register a same tick_function. but can not remove them once.

Test script:
---------------
<?php
function a () {
    echo 2;
}
register_tick_function("a");
register_tick_function("a");
unregister_tick_function("a");
declare(ticks=1);

echo 1;
echo 1;

Expected result:
----------------
11

Actual result:
--------------
221212

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-04-04 03:03 UTC] quirenbach at moe dot de
change affected php version
 [2012-04-04 03:03 UTC] quirenbach at moe dot de
-PHP Version: 5.4.1RC1 +PHP Version: 5.3.10
 [2012-04-04 03:08 UTC] aharvey@php.net
Calling unregister_tick_function() twice removes both tick functions, so I'd say 
this is behaving as expected. Example:

<?php
declare(ticks=1);
function a() { echo "tick\n"; }

echo "Registering...\n";
register_tick_function('a');
register_tick_function('a');
foreach (range(0, 5) as $i) {}
unregister_tick_function('a');
unregister_tick_function('a');
echo "Unregistered.\n";
foreach (range(0, 5) as $i) {}
?>

Only outputs "tick" between "Registering..." and "Unregistered.".
 [2012-04-04 03:08 UTC] aharvey@php.net
-Status: Open +Status: Not a bug
 [2012-04-04 04:30 UTC] laruence@php.net
@aharvey actually, IMO, this one is dup to #61605(zend_llist didn't remove all 
match elements). 

I will fix them all.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC