? ? Success
Pull Request for # 9074

User tests: Successful: Unsuccessful:

avatar mbabker
mbabker
1 Mar 2016

Pull Request for Issue #9074.

Summary of Changes

  • JErrorPage::render() did not close the application correctly when rendering error pages
  • The $e variable may not be defined in JErrorPage::render() when echoing a static text message instead of rendering a JDocumentError object
  • PlgSystemRedirect::handleError() cannot be used as both a JError callback handler and a global Exception handler due to signature differences, namely passing references versus values; a new PlgSystemRedirect::handleException() method is added to be used as the global Exception handler and the actual error handling code is moved into a private method in the plugin
  • General JErrorPageTest improvements

Testing Instructions

With the redirect plugin enabled, 404's should still be logged correctly.

To test the Exception handler pre- and post- patch, after this line in JApplicationCms throw an Exception. If running PHP 7, pre-patch you'll get this warning and an uncaught Exception:

Warning: Parameter 1 to PlgSystemRedirect::handleError() expected to be a reference, value given in Unknown on line 0

Post patch, the error page should render correctly. PHP 5 is unaffected.

avatar mbabker mbabker - open - 1 Mar 2016
avatar mbabker mbabker - change - 1 Mar 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 1 Mar 2016
Labels Added: ? ?
avatar brianteeman brianteeman - change - 1 Mar 2016
Rel_Number 0 9074
Relation Type Pull Request for
Labels
avatar brianteeman brianteeman - change - 1 Mar 2016
Category Libraries
avatar andrepereiradasilva
andrepereiradasilva - comment - 1 Mar 2016

if i understand correctly, this should be tested only with php 7, right?

avatar mbabker
mbabker - comment - 1 Mar 2016

No. PHP 5 should be tested as well mainly to make sure nothing changes.

avatar andrepereiradasilva andrepereiradasilva - test_item - 1 Mar 2016 - Tested successfully
avatar andrepereiradasilva
andrepereiradasilva - comment - 1 Mar 2016

I have tested this item :white_check_mark: successfully on 45a8bc2

Using php 5.6.x. Applied the patch and activated redirect plugin and trow a custom error after the line you pointed.

throw new RuntimeException('test', 404);

Tested the frontend and all URI return a 404 and, after removing the line, i checked they appeared in the redirect component list view.

Side note not related to this PR itself but with error pages: i have the debug plugin activated and the debug console does not appear in error pages, also there are some issues with mod_languages (the mod_languages CSS is not loaded in error pages).


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9270.

avatar mbabker
mbabker - comment - 1 Mar 2016

Both known issues.

1) The debug plugin relies on plugin events that won't trigger on the error page to render it.

2) JDocumentError doesn't have the same rendering capabilities as JDocumentHtml, namely the <jdoc> parsers aren't there. Frankly the whole error page rendering system needs to go back to the drawing board because there are more document types than HTML in use today.

avatar andrepereiradasilva
andrepereiradasilva - comment - 1 Mar 2016

ok. understood. thanks for the explanation.

avatar mbabker
mbabker - comment - 4 Mar 2016

@wilsonge This needs to be tested & merged before stable. A combination of the redirect plugin being enabled plus an uncaught Throwable on a PHP 7 environment can result in a WSOD or PHP Fatal Error (depending on error reporting settings) when an error page should be rendered.

avatar wilsonge wilsonge - change - 4 Mar 2016
Labels Added: ?
avatar richard67 richard67 - test_item - 5 Mar 2016 - Tested successfully
avatar richard67
richard67 - comment - 5 Mar 2016

I have tested this item :white_check_mark: successfully on 45a8bc2

Test with PHP 5.6: No change to behavior without patch => success.

Test with PHP 7: Before patch, error page was not redered, after patch it is => success.

New redirect records are added on both PHP versions with exception + this patch => success.

Used same code for generating exception as andrepereiradasilva did.

Sorry it took me a while to setup a PHP 7 environment on my shared host, so I tested not earlier.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9270.

avatar brianteeman brianteeman - change - 5 Mar 2016
Status Pending Ready to Commit
Labels
avatar brianteeman
brianteeman - comment - 5 Mar 2016

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9270.

avatar joomla-cms-bot joomla-cms-bot - change - 5 Mar 2016
Labels Added: ?
avatar wilsonge wilsonge - change - 5 Mar 2016
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2016-03-05 23:44:04
Closed_By wilsonge
avatar wilsonge wilsonge - reference | f61dd3b - 5 Mar 16
avatar wilsonge wilsonge - merge - 5 Mar 2016
avatar wilsonge wilsonge - close - 5 Mar 2016
avatar wilsonge wilsonge - change - 5 Mar 2016
Milestone Added:
avatar wilsonge wilsonge - change - 5 Mar 2016
Labels Removed: ?
avatar wilsonge
wilsonge - comment - 5 Mar 2016

Merged - thanks Michael!

avatar joomla-cms-bot joomla-cms-bot - change - 5 Mar 2016
Labels Removed: ?
avatar mbabker mbabker - head_ref_deleted - 6 Mar 2016

Add a Comment

Login with GitHub to post a comment