codeigniter4 / CodeIgniter4

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
5.4k stars 1.9k forks source link

Bug: Dev Toolbar Load heavily and Hang Browser #7058

Closed ChibuezeAgwuDennis closed 1 year ago

ChibuezeAgwuDennis commented 1 year ago

PHP Version

7.4

CodeIgniter4 Version

4.2.11

CodeIgniter4 Installation Method

Manual (zip or tar.gz)

Which operating systems have you tested for this bug?

Windows

Which server did you use?

cli

Database

No response

What happened?

When I am on development mood my script load normal and after the developer toolbar load the browser will start to hang or responds slowly.

Another bug

When I switch to production mood, the developer toolbar still show.

Steps to Reproduce

I try debugging to see where this error is coming from

I try editing the Toolbar Class on


   /**
     * Inject debug toolbar into the response.
     *
     * @codeCoverageIgnore
     */
    public function respond()
    {
        if (ENVIRONMENT === 'testing') {
            return;
        }

        $request = Services::request();

To this to see if my script will load fine and it does


 /**
     * Inject debug toolbar into the response.
     *
     * @codeCoverageIgnore
     */
    public function respond()
    {
        if (ENVIRONMENT === 'testing' || ENVIRONMENT === 'production') {
            return;
        }

        $request = Services::request();

Expected Output

...

Anything else?

No response

kenjis commented 1 year ago

Cannot reproduce. Please show us minimum steps to reproduce.

kenjis commented 1 year ago

When I switch to production mood, the developer toolbar still show.

https://github.com/codeigniter4/CodeIgniter4/blob/d8d52757b38c16a836e5296c331ecf9a6e9f324d/app/Config/Events.php#L44-L47 If CI_DEBUG is not true, Services::toolbar()->respond() is not called.

ChibuezeAgwuDennis commented 1 year ago

When I switch to production mood, the developer toolbar still show.

https://github.com/codeigniter4/CodeIgniter4/blob/d8d52757b38c16a836e5296c331ecf9a6e9f324d/app/Config/Events.php#L44-L47

If CI_DEBUG is not true, Services::toolbar()->respond() is not called.

I am checking on what you said

ChibuezeAgwuDennis commented 1 year ago

When I switch to production mood, the developer toolbar still show.

https://github.com/codeigniter4/CodeIgniter4/blob/d8d52757b38c16a836e5296c331ecf9a6e9f324d/app/Config/Events.php#L44-L47

If CI_DEBUG is not true, Services::toolbar()->respond() is not called.

I am checking on what you said

image

in production it is returning

image

ChibuezeAgwuDennis commented 1 year ago

When I switch to production mood, the developer toolbar still show.

https://github.com/codeigniter4/CodeIgniter4/blob/d8d52757b38c16a836e5296c331ecf9a6e9f324d/app/Config/Events.php#L44-L47

If CI_DEBUG is not true, Services::toolbar()->respond() is not called.

I am checking on what you said

image

in production it is returning

image

I have fixed this CI_ENVIRONMENT = production displaying true but what of the hanging on browser

kenjis commented 1 year ago

CI_DEBUG is set to false in https://github.com/codeigniter4/CodeIgniter4/blob/d8d52757b38c16a836e5296c331ecf9a6e9f324d/app/Config/Boot/production.php#L21 unless you define it before the code above.

ChibuezeAgwuDennis commented 1 year ago

I have fixed the always true issue. But what of the slow loading or hanging of browser when on development mood. or is it conflicting anything or heavy loading

paulbalandan commented 1 year ago

But what of the slow loading or hanging of browser when on development mood.

Please provide minimum steps to reproduce the slow loading or hanging browser. Without the steps, we can only assume it's a problem with your code and not of the framework.