?
avatar infograf768
infograf768
8 Feb 2021

Steps to reproduce the issue

Enable debug in back-end
Log as admin in frontend
Enter a fake url in frontend

Expected result

Error page is loaded.
Debug should display at bottom of page

Actual result

Debug does not display although we do have
<jdoc:include type="modules" name="debug" style="none" />
in error.php

avatar infograf768 infograf768 - open - 8 Feb 2021
avatar joomla-cms-bot joomla-cms-bot - change - 8 Feb 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 8 Feb 2021
avatar dgrammatiko
dgrammatiko - comment - 8 Feb 2021

Debug is NOT using the template position

echo str_replace('</body>', implode('', $html) . '</body>', $contents);
Also requires a logged in Admin user

avatar infograf768
infograf768 - comment - 8 Feb 2021

I am logged as Admin.

How to solve this?

avatar infograf768
infograf768 - comment - 8 Feb 2021

code is in line 346
echo str_replace('</body>', $debugBarRenderer->renderHead() . $debugBarRenderer->render() . '</body>', $contents);

and the whole code is present before </body> in page source.

avatar infograf768 infograf768 - change - 8 Feb 2021
The description was changed
avatar infograf768 infograf768 - edited - 8 Feb 2021
avatar dgrammatiko
dgrammatiko - comment - 8 Feb 2021

Do you have any errors in the browser's console?

avatar infograf768
infograf768 - comment - 8 Feb 2021

Many

Uncaught ReferenceError: jQuery is not defined
    <anonymous> http://localhost:8888/newfolder/joomla40/media/vendor/debugbar/debugbar.js:4
debugbar.js:4:5
10:55:18.428
Uncaught TypeError: PhpDebugBar.utils is undefined
    <anonymous> http://localhost:8888/newfolder/joomla40/media/vendor/debugbar/widgets.js:14
    <anonymous> http://localhost:8888/newfolder/joomla40/media/vendor/debugbar/widgets.js:583
widgets.js:14:18
10:55:18.428
Uncaught TypeError: PhpDebugBar.Widget is undefined
    <anonymous> http://localhost:8888/newfolder/joomla40/media/vendor/debugbar/openhandler.js:13
    <anonymous> http://localhost:8888/newfolder/joomla40/media/vendor/debugbar/openhandler.js:202
openhandler.js:13:5
10:55:18.428
Uncaught TypeError: PhpDebugBar.utils is undefined
    <anonymous> http://localhost:8888/newfolder/joomla40/media/plg_system_debug/widgets/info/widget.min.js:1
    <anonymous> http://localhost:8888/newfolder/joomla40/media/plg_system_debug/widgets/info/widget.min.js:1
widget.min.js:1:20
10:55:18.428
Uncaught TypeError: PhpDebugBar.utils is undefined
    <anonymous> http://localhost:8888/newfolder/joomla40/media/plg_system_debug/widgets/sqlqueries/widget.min.js:1
    <anonymous> http://localhost:8888/newfolder/joomla40/media/plg_system_debug/widgets/sqlqueries/widget.min.js:1
widget.min.js:1:20

etc.
avatar dgrammatiko
dgrammatiko - comment - 8 Feb 2021

jQuery is not defined

There you go. Add before

JHtml::_('bootstrap.tooltip');

JHtml::_('jquery.framework');
avatar infograf768
infograf768 - comment - 8 Feb 2021

You are quoting staging.
I am speaking of 4.0

avatar infograf768
infograf768 - comment - 8 Feb 2021

If I add HTMLHelper::_('jquery.framework'); on top of error.php, then it works.

avatar dgrammatiko
dgrammatiko - comment - 8 Feb 2021

Weird the jQuery is defined as dependency here:

Do you have a js file loaded in the browser with path media/plg_system_debug/js/debug.min.js ?

avatar infograf768
infograf768 - comment - 8 Feb 2021

No, in index.php (where it works) as well as error.php
I have at bottom of page
<script type="text/javascript" src="/newfolder/joomla40/media/vendor/debugbar/debugbar.js" defer></script>

EDIT: In fact I have them in index.php, not in error.php

avatar Fedik
Fedik - comment - 8 Feb 2021

It worked for me yesterday, without errors. Today not tested.
Any changes in 4.0-dev branch happen recently? :)

avatar infograf768
infograf768 - comment - 8 Feb 2021

@Fedik, have you tested with error.php?

avatar Fedik
Fedik - comment - 8 Feb 2021

ahh, I misunderstood, sorry,
yeah it broken on 404 page

avatar Fedik
Fedik - comment - 8 Feb 2021

okay I see,
That because it is DocumentError and it a different Document instance from initial.
debug.js attached to original DocuemtHtml, but "on error" the error handler proceed DocumentError

I will try to look later, how to fix that.

avatar infograf768
infograf768 - comment - 8 Feb 2021

You mean
* @todo Change this renderer to use JDocumentHtml instead of JDocumentError, the latter is only used for B/C at this time
in
/libraries/src/Error/Renderer/HtmlRenderer.php

?

avatar Fedik
Fedik - comment - 8 Feb 2021

hm, or maybe Yes
well, it confusing 😄

avatar Fedik
Fedik - comment - 8 Feb 2021

but the document instance changes in

// Reset the document object in the factory, this gives us a clean slate and lets everything render properly
Factory::$document = $renderer->getDocument();
Factory::getApplication()->loadDocument(Factory::$document);

need to change how the plugin attach the script

avatar infograf768
infograf768 - comment - 8 Feb 2021

OK

avatar Fedik
Fedik - comment - 8 Feb 2021

please test #32358

avatar Quy Quy - change - 8 Feb 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-02-08 18:32:56
Closed_By Quy
avatar Quy Quy - close - 8 Feb 2021

Add a Comment

Login with GitHub to post a comment