themosis / framework

The Themosis framework core.
https://framework.themosis.com/
GNU General Public License v2.0
671 stars 121 forks source link

Corrected shutdown event #851

Closed ogorzalka closed 2 years ago

ogorzalka commented 2 years ago

Hi Julien,

I just sent you a fix that allows the WordPress shutdown action to work. It's pretty much used by debug tools (like Query Monitor) or cache extensions. Currently this hook is not active.

Have a good day !

ogorzalka commented 2 years ago

The problem comes from this part:

fastcgi_finish_request();

It break the response before the shutdown hook

Well, I think it could be possible to call the shutdown action before this function no ?

The complete method :

    public function send()
    {
        $this->sendHeaders();
        $this->sendContent();

        if (\function_exists('fastcgi_finish_request')) {
            fastcgi_finish_request();
        } elseif (\function_exists('litespeed_finish_request')) {
            litespeed_finish_request();
        } elseif (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) {
            static::closeOutputBuffers(0, true);
        }

        return $this;
    }
ogorzalka commented 2 years ago

Hi @jlambe ,

Have you taken a look at this?

Do we really need to finish the request ?

If you want to test, install Query Monitor and you can see that on the front office it is not working because of this.

Thanks, have a good day :)

jlambe commented 2 years ago

Hi @ogorzalka,

this is all working fine now 👍 See screenshot below:

themosis_query_monitor