Skip to content

Warning: Undefined array key 1 #516

@PavelJurasek

Description

@PavelJurasek

Version: 2.8.7

Bug Description

Under certain conditions, it is possible that Tracy outputs corrupt html file. Opening that html file results in UnknownEntityException in console, collapsibles are not working. It occurs when http process spawns a CLI process using symfony/process.
What is going on:

  • Helpers:: getSource provides source based on presence of $_SERVER['REQUEST_URI']. Processes spawned via symfony/process indeed contain REQUEST_URI (see steps to reproduce)
  • content.html does usual PHP_SAPI check. These two checks are therefore inconsistent. In this block "Warning: Undefined array key 1" occurs.

Steps To Reproduce

Verify that symfony/process passes $_SERVER contents into spawned process:

<?php

// http.php

require __DIR__ . '/vendor/autoload.php';

$proc = new \Symfony\Component\Process\Process([
    'php',
    './cli.php', // replace with lines below to see that sf/process indeed passes SERVER data to child process
//    '-r',
//    'var_export($_SERVER); var_export(PHP_SAPI);',
]);

$proc->run();

echo '<pre>'.($proc->getOutput()) . '</pre>';
<?php

// cli.php

$container = require __DIR__ . '/bootstrap.php'; // setup tracy etc.

var_export($_SERVER); var_export(PHP_SAPI);

throw new \Exception('E');

Access http.php via browser.

Expected Behavior

Tracy should consistently detect CLI and should not throw warning.

Possible Solution

Prolly fix in Helpers:: getSource ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions