View Issue Details

IDProjectCategoryView StatusLast Update
0002127XdebugTracingpublic2022-12-08 18:51
ReporterLyrkan Assigned Toderick  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version3.1.5 
Fixed in Version3.2.0 
Summary0002127: Tracing does not handle NUL char in anonymous closure scope
Description

Hi there,

While trying to parse a trace file generated by Xdebug 3.1.5 I noticed that levels were not incrementing/decrementing properly.

When looking at the incriminating lines it seems that a newline character is missing on the previous one, for instance after Exception@anonymous in the following sample:

<file>
3 4811 0 0.114192 1026144 Symfony\Component\ErrorHandler\ErrorHandler::register 1 /var/www/html/aaaaaaaaa/aaaaaaaaaaaaaaaaaaa/vendor/symfony/error-handler/Debug.php 39 2 class Symfony\Component\ErrorHandler\ErrorHandler { private $levels = [8192 => 'Deprecated', 16384 => 'User Deprecated', 8 => 'Notice', 1024 => 'User Notice', 2048 => 'Runtime Notice', 2 => 'Warning', 512 => 'User Warning', 128 => 'Compile Warning', 32 => 'Core Warning', 256 => 'User Error', 4096 => 'Catchable Fatal Error', 64 => 'Compile Error', 4 => 'Parse Error', 1 => 'Error', 16 => 'Core Error']; private $loggers = [8192 => [...], 16384 => [...], 8 => [...], 1024 => [...], 2048 => [...], 2 => [...], 512 => [...], 128 => [...], 32 => [...], 256 => [...], 4096 => [...], 64 => [...], 4 => [...], 1 => [...], 16 => [...]]; private $thrownErrors = 8191; private $scopedErrors = 8191; private $tracedErrors = 30715; private $screamedErrors = 85; private $loggedErrors = 32767; private $configureException = class Closure { virtual $closure = "Exception@anonymous4 4812 0 0.114216 1026920 str_repeat 0 /var/www/html/aaaaaaaaa/aaaaaaaaaaaaaaaaaaa/vendor/symfony/error-handler/ErrorHandler.php 114 2 'x' 32768
4 4812 1 0.114224 1063848
</file>

It does not happen if I set xdebug.var_display_max_depth to 0, but I suspect that's only because lines get smaller in this case.

TagsNo tags attached.
Operating System
PHP Version8.1.10-8.1.19

Activities

derick

2022-11-02 11:35

administrator   ~0006423

I can reproduce that with this script:

<?php

class Test
{
    private $configureException;

    function __construct()
    {
        $this->configureException = \Closure::bind(
            static function($a, $b) { return $a * $b; }, 
            null, 
            new class() extends \Exception {} 
        );
    }

    function runException($a, $b)
    {
        $f = $this->configureException;
        $f($a, $b);
    }
}

$t = new Test;
$t->runException(42, 45);
?>

With the following command line:

XDEBUG_TRACE=yes php -dxdebug.trace_format=0 -dxdebug.mode=trace -dxdebug.trace_output_name=bug2127.txt tests/tracing/bug02127.inc && zcat /tmp/bug2127.txt.xt.gz

derick

2022-11-02 15:44

administrator   ~0006424

https://github.com/xdebug/xdebug/pull/866

derick

2022-11-02 16:46

administrator   ~0006430

Fixed in GIT, for RC2 (or final).

Issue History

Date Modified Username Field Change
2022-10-13 13:07 Lyrkan New Issue
2022-11-02 11:35 derick Assigned To => derick
2022-11-02 11:35 derick Status new => assigned
2022-11-02 11:35 derick Note Added: 0006423
2022-11-02 15:44 derick Summary Some line breaks are missing in computerized traces => Tracing does not handle NUL char in anonymous closure scope
2022-11-02 15:44 derick Note Added: 0006424
2022-11-02 16:46 derick Status assigned => closed
2022-11-02 16:46 derick Resolution open => fixed
2022-11-02 16:46 derick Fixed in Version => 3.2dev
2022-11-02 16:46 derick Note Added: 0006430
2022-11-10 09:50 derick Fixed in Version 3.2dev => 3.2.0RC2
2022-12-08 18:51 derick Fixed in Version 3.2.0RC2 => 3.2.0