Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning: Undefined array key 1 #516

Closed
PavelJurasek opened this issue Nov 4, 2021 · 1 comment
Closed

Warning: Undefined array key 1 #516

PavelJurasek opened this issue Nov 4, 2021 · 1 comment

Comments

@PavelJurasek
Copy link

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 ?

@PavelJurasek PavelJurasek changed the title Possible Warning: Undefined array key 1 Nov 4, 2021
@dg
Copy link
Member

dg commented Nov 8, 2021

I don't understand at all under what circumstances it can generate a corrupt html file.

@dg dg closed this as completed in e4db695 Nov 8, 2021
dg added a commit that referenced this issue Nov 8, 2021
dg added a commit that referenced this issue Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants