[php-src] Issue #19275: register_tick_function() not work in external file
| From: | rino1 | Date: | Mon, 28 Jul 2025 12:39:20 +0000 |
| Subject: | [php-src] Issue #19275: register_tick_function() not work in external file | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-250513@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/19275
Author: rino1
### Description
```
+ php main.php | grep f2 || echo "f2 function not appear"
f2 function not appear
```
Why?
Here are some details
````
+ ls -1
f2.php
main.php
+ cat main.php
<?php
declare(ticks=1);
require 'f2.php'; // external file
register_tick_function(
function () {
debug_print_backtrace();
echo "\n";
}
);
function f1() {
f2();
}
f1();+ cat f2.php
<?php
declare(ticks=1);
function f2() {}
+ php main.php
#0 /tmp/tmp.UFjE757TrJ/main.php(9): {closure}()
#0 /tmp/tmp.UFjE757TrJ/main.php(13): {closure}()
#1 /tmp/tmp.UFjE757TrJ/main.php(16): f1()
#0 /tmp/tmp.UFjE757TrJ/main.php(16): {closure}()
````