? bug PR-4.3-dev ? Pending

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
18 Jul 2023

Summary of Changes

In some cases the error page is rendered incorrectly, when exception happen while rendering.

Testing Instructions

Applly patch.
Add an error throw new \Exception('That an error'); in to layouts/joomla/content/info_block/hits.php
On the site open the article detail view.

Also can try to add an error in to the text field layout layouts/joomla/form/field/text.php
And try to edit the Article.

Actual result BEFORE applying this Pull Request

You get broken page:
Half article are rendered,
And then an error is rendered

Expected result AFTER applying this Pull Request

Only error is rendered

Link to documentations

Please select:

  • No documentation changes for docs.joomla.org needed
  • No documentation changes for manual.joomla.org needed
avatar joomla-cms-bot joomla-cms-bot - change - 18 Jul 2023
Category Libraries
avatar Fedik Fedik - open - 18 Jul 2023
avatar Fedik Fedik - change - 18 Jul 2023
Status New Pending
avatar Fedik Fedik - change - 18 Jul 2023
Title
Fix error rendering with unclosed Output buffers
Fix error page rendering with unclosed Output buffers
avatar Fedik Fedik - edited - 18 Jul 2023
avatar wilsonge
wilsonge - comment - 20 Jul 2023

I think it would be good in core for us to close the buffers using the finally keyword. So run a try/finally (you don't actually need to have a catch) and putting this in the Layout, HtmlView classes (does Document use it too when we include the template?) would also be a smart idea I guess.

I mean I'm not against this but this should be a method of last resort rather than the go to thing.

avatar Fedik
Fedik - comment - 20 Jul 2023

@wilsonge I not sure that it is possible, we do not have try blocks everywhere,
it can require more work, to review every possible place.

avatar Fedik
Fedik - comment - 20 Jul 2023

Or maybe :neckbeard:
I will try, will mark it as draft for now

avatar Fedik
Fedik - comment - 21 Jul 2023

Okay, I will keep it as it is. There 100+ places where we use output buffering, some are in the layouts file.
It is more practical to close all at once before error rendering.

avatar richard67 richard67 - test_item - 23 Jul 2023 - Tested successfully
avatar richard67
richard67 - comment - 23 Jul 2023

I have tested this item successfully on 52d1b94


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

avatar viocassel viocassel - test_item - 23 Jul 2023 - Tested successfully
avatar viocassel
viocassel - comment - 23 Jul 2023

I have tested this item successfully on 52d1b94


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

avatar richard67 richard67 - change - 23 Jul 2023
Status Pending Ready to Commit
Labels Added: bug PR-4.3-dev ?
avatar richard67
richard67 - comment - 23 Jul 2023

RTC


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

avatar Quy Quy - change - 23 Jul 2023
Labels Added: ?
avatar obuisard obuisard - close - 24 Jul 2023
avatar obuisard obuisard - merge - 24 Jul 2023
avatar obuisard obuisard - change - 24 Jul 2023
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2023-07-24 20:43:53
Closed_By obuisard
avatar obuisard
obuisard - comment - 24 Jul 2023

Thank you Fefir @Fedik for the PR

Add a Comment

Login with GitHub to post a comment