?
Referenced as Pull Request for: # 7279
avatar stAn47
stAn47
19 Jan 2015

Steps to reproduce the issue

System - Debug does not work if any 3rd party extension uses php's function register_shutdown_function

i had recently wrote a plugin to send an email upon php's fatal error. it uses a code:

if (function_exists('register_shutdown_function'))
register_shutdown_function( "fatal_error_catcher" );

this code registers a shutdown function which is trigerred after php code is executed, but it also means that destructors are called once the output buffer is not possible to modify (connection to the client may be already closed).

i do not think that is's a proper event to load joomla's plugins on it's desctructor, but rather the core joomla should use it's own events to handle the plugin's output. (onAfterRender or other)

we find the php's register_shutdown_function function very useful especially on fastcgi/fpm php server where the connection can be closed (further with fastcgi_finish_request) and thus site speed is much better when we move time intensive work to this function:

  • DNS calls to send emails
  • writing files
  • updating large tables

if you'd like to use our "fatal catcher plugin" you may download it here (it's completely free for any use):

http://www.rupostel.com/free-virtuemart-extensions/extensions/fatal-catcher-plugin

Expected result

No debug output is shown

Actual result

System information (as much as possible)

tested on php5.3 to php5.6
and joomla 1.5, 2.5 and 3.3.6

Additional comments

Follow the Joomla event mechanism instead of trying to catch the destructor event, especially if it's not triggered by user code - there is no unset within the dispatcher.

avatar stAn47 stAn47 - open - 19 Jan 2015
avatar brianteeman brianteeman - change - 23 Jan 2015
Labels Added: ?
avatar Bakual
Bakual - comment - 27 Jun 2015

Closing as we have a PR.

avatar Bakual Bakual - change - 27 Jun 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-06-27 21:09:36
Closed_By Bakual
Build 3.3.6 staging
avatar Bakual Bakual - close - 27 Jun 2015

Add a Comment

Login with GitHub to post a comment