Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Conflict with Wordpress (register_shutdown_function)
  • Hi, i've coupled Wordpress with FuelPHP. But i've an issue with flash messages class from fuel-depot. 

    The flash message container is never reset. But in wordpress, if i remove this line :
    register_shutdown_function( 'shutdown_action_hook' );

    It's work great. But i don't want to edit the Wordpress core file. What i can do with the message class ?
  • HarroHarro
    Accepted Answer
    From a PHP point of view, it is no problem registering multiple shutdown functions. So it must be something special Wordpress does, that prevents Fuel's shutdown function to kick in.

    And that is a bad thing, because there is a lot happening there. If that doesn't work, sessions will not be written (and this causes your messages issue), file downloads won't start, there will be no cleanup, the finder file cache will not be created, etc.

    A quick peek in the Wordpress code shows that it's shutdown code calls the 'shutdown' hook, which processes shutdown events from installed plugins, and it calls wp_cache_close(), which since WP 2.5 is a noop. But again plugins can implement it.

    So it looks like one of your Wordpress plugins is doing something very nasty...
  • Thanks for your answer.

    I've look, in shutdown event, wordpress execute the function "wp_ob_end_flush_all" which contains this code :
    function wp_ob_end_flush_all() {
    $levels = ob_get_level();
    for ($i=0; $i<$levels; $i++)
    ob_end_flush();
    }

    If i comment it, it's work great. I think this is the only solution ?
  • It's strange because i've this bug (flash messages) only on localhost. But on my 1and1 server no
  • Weird indeed.

    I also don't see how flushing all buffered output could influence sessions.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion