Skip to content

register_tick_function() not work in external file #19275

@rino1

Description

@rino1
+ 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}()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions