php-debugbar icon indicating copy to clipboard operation
php-debugbar copied to clipboard

The php-debugbar shows messages in random order

Open ovidiugabriel opened this issue 9 years ago • 5 comments

Hello,

The php-debugbar shows messages in random order. I can see in the browser the following logs

[3] 21.535 Report: Running ...:
[0] 21.535 Report: skipped
[2] 21.535 Report: Replaced ...
[1] 21.535 Report: Limit has been set 
[5] 21.598 Report: Setting limit
[4] 21.598 Report: Query returned data

While the index in square brackets is incremented and on the server I can see in logs which is how I expect the debugbar to behave also:

[0] 21.535 Report: skipped
[1] 21.535 Report: Limit has been set 
[2] 21.535 Report: Replaced ...
[3] 21.535 Report: Running ...:
[4] 21.598 Report: Query returned data
[5] 21.598 Report: Setting limit

ovidiugabriel avatar Oct 11 '16 20:10 ovidiugabriel

Are you using the default MessageCollector? It should sort the array on time when sending to the debugbar. Otherwise we could perhaps sort the messages on time in the widget?

barryvdh avatar Oct 12 '16 08:10 barryvdh

how Fix it ? image

` $debugbar = new StandardDebugBar(); $debugbarRenderer = $debugbar ->getJavascriptRenderer(); $debugbar->addCollector(new MessagesCollector('Files')); $files = get_included_files();

foreach ($files as $key => $filename)
{
        $sort += 1;
        $debugbar["Files"]->addMessage($sort. ' :' . $filename , 'File');
    
}

`

goodwe1l avatar Dec 09 '16 06:12 goodwe1l

echo $debugbarRenderer->renderHead() echo $debugbarRenderer->render()

goodwe1l avatar Dec 09 '16 06:12 goodwe1l

Why the final array needs resorting since messages are appended already in order using addMessage() ?

ovidiugabriel avatar Feb 13 '17 13:02 ovidiugabriel

Do we have any fix for this issue?

ovidiugabriel avatar Mar 28 '17 08:03 ovidiugabriel