• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Debug Toolbar above of the head tag

#1
I've just try using CI 4 and working on development mode, but I found the debug toolbar script above of the head tag not inside the head:

Code:
<!-- DEBUG-VIEW START 1 APPPATH/Config/../Views/templates/header.php -->
<!doctype html>
<html>


<script type="text/javascript" id="debugbar_loader" data-time="1581796564" src="http://dapp.arnezt.web/?debugbar"></script><script type="text/javascript" id="debugbar_dynamic_script"></script><style type="text/css" id="debugbar_dynamic_style"></style>
<head>...</head>




The debug toolbar did not injected properly into the head block tag and blocked by browser.
vendor/codeigniter4/framework/system/Debug/Toolbar.php

PHP Code:
if (strpos($response->getBody(), '<head>') !== false)
{
    $response->setBody(
        str_replace('<head>'$script '<head>'$response->getBody())
    );
    return;


How to corrected this? Thank you.
Reply

#2
Hi, this bug have been reported on GitHub with a suggested solution:
https://github.com/codeigniter4/CodeIgni...ssues/2545

PHP Code:
if (strpos($response->getBody(), '<head>') !== false)
{
    
$response->setBody(
        
str_replace('<head>''<head>' $script$response->getBody())
    );
    return;

Reply

#3
(02-16-2020, 05:17 AM)jreklund Wrote: Hi, this bug have been reported on GitHub with a suggested solution:
https://github.com/codeigniter4/CodeIgni...ssues/2545

PHP Code:
if (strpos($response->getBody(), '<head>') !== false)
{
    $response->setBody(
        str_replace('<head>''<head>' $script$response->getBody())
    );
    return;



Thank you very much for the reference. Actually I've try to tricky with add <head> before <script> tag and remove after $script variable. But your reference more make sense. Smile

`
PHP Code:
$script '<head>' PHP_EOL
                
'<script .....';

str_replace('<head>'$script ''$response->getBody()); 
Reply

#4
This fix went out yesterday!
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.