View Issue Details

IDProjectCategoryView StatusLast Update
0001676XdebugUncategorizedpublic2019-08-26 12:37
Reportercyrus.and Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
OSLinuxOS VersionDebian GNU/Linux 
Target Version2.8.0devFixed in Version2.8.0beta2 
Summary0001676: xdebugtrace* deinit and write_footer not called for shutdown functions
Description

Trace files footers are sometimes missing when PHP shutdown functions are being traced. It seems that the above callbacks are just fired once, while the *_init callback, for example, is called multiple times (one per registered shutdown function?).

Side question: is having multiple trace files in this case even the expected behavior?

Steps To Reproduce

index.php:

<?php

function shutdown() {
    var_dump("shutdown\n");
}

register_shutdown_function('shutdown');
var_dump('foo');

Relevant php.ini bits:

xdebug.auto_trace=1

If I request the page (once) I obtain:

root@b5d1f1f7af9d:/var/www/html# cat /tmp/trace.2373089536.xt
TRACE START [2019-06-12 18:34:53]
    0.0005     392080   -> {main}() /var/www/html/index.php:0
    0.0006     392080     -> register_shutdown_function() /var/www/html/index.php:7
    0.0006     392488     -> var_dump() /var/www/html/index.php:9

root@b5d1f1f7af9d:/var/www/html# cat /tmp/trace.2373089536.02ac99.xt
TRACE START [2019-06-12 18:34:53]
    0.0008     391712   -> shutdown() /var/www/html/index.php:0
    0.0009     391712     -> var_dump() /var/www/html/index.php:4
    0.0009     322544
TRACE END   [2019-06-12 18:34:53]

As you can see, TRACE END does not appear in the first trace file. Further investigation led me to understand that _deinit and _write_footer functions are simply not called in that case.

TagsNo tags attached.
Operating System
PHP Version7.3.2-7.3.4

Activities

There are no notes attached to this issue.