? Pending

User tests: Successful: Unsuccessful:

avatar PhilETaylor
PhilETaylor
12 Jan 2021

Summary of Changes

ob_end_clean raises a notice if the included layout file did something stupid (like running ob_get_clean() !!!)

Notice: ob_end_clean(): failed to delete buffer. No buffer to delete in
/home/path/public_html/libraries/src/Layout/FileLayout.php

Battle tested code should check if a buffer exists before attempting to clear it, if by blindly clearing a non-existent buffer then raises a PHP Notice/Error/Warning/Fatal.

Testing Instructions

Install JEvents 3.6.12 on Joomla 4 beta 6

Visit https://example.com/administrator/index.php?option=com_jevents&task=params.edit

note that the file administrator/components/com_jevents/layouts/joomla/system/message.php is included by include $path; and message.php runs a ob_get_clean() within in.

This is probably a bug in JEvents because the ob_get_clean should be two lines higher so it doesn't get run in Joomla 4 - but still Joomla should handle cleaning of output buffers better and never show Notices to the screen.

Actual result BEFORE applying this Pull Request

Notice: ob_end_clean(): failed to delete buffer. No buffer to delete in
/home/path/public_html/libraries/src/Layout/FileLayout.php

Expected result AFTER applying this Pull Request

No errors

Documentation Changes Required

// @GeraintEdwards

avatar PhilETaylor PhilETaylor - open - 12 Jan 2021
avatar PhilETaylor PhilETaylor - change - 12 Jan 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 12 Jan 2021
Category Libraries
avatar PhilETaylor PhilETaylor - change - 12 Jan 2021
Title
[4] ob_end_clean needs something to clean if the include did not output anything
[4] ob_end_clean raises a notice if the included layout file did something stupid
avatar PhilETaylor PhilETaylor - edited - 12 Jan 2021
avatar PhilETaylor PhilETaylor - change - 12 Jan 2021
The description was changed
avatar PhilETaylor PhilETaylor - edited - 12 Jan 2021
bededd8 12 Jan 2021 avatar PhilETaylor cs
avatar PhilETaylor PhilETaylor - change - 12 Jan 2021
Labels Added: ?
avatar GeraintEdwards
GeraintEdwards - comment - 13 Jan 2021

Thanks @PhilETaylor for highlighting the miss-placed ob_get_clean() call in JEvents. Fixed for the next release

Your proposed change in Joomla 4 is a no-brainer, though it will probably be very rarely needed once Joomla 4 is released and extensions have been more widely tested.

avatar ceford
ceford - comment - 25 Jan 2021

I tried a different test: added ob_get_clean(); at the end of com_media/layouts/toolbar/create-folder.php. That makes the toolbar button disappear. But stepping through with the debugger does not trigger any error when getting to ob_end_clean in the calling function. This with Beta7 pre Bootstrap 5. There is nothing in the error log. Sorry, can't test with Beta6.


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

avatar richard67
richard67 - comment - 12 Feb 2021

System test always failing at the same place when trying to open Global Configuration for making changes. Not sure if related to this PR.

avatar PhilETaylor
PhilETaylor - comment - 25 Feb 2021

Closing as no interest. Lets hope its limited to one extension and not a bigger issue once Joomla 4 is released.

avatar PhilETaylor PhilETaylor - change - 25 Feb 2021
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2021-02-25 14:28:48
Closed_By PhilETaylor
avatar PhilETaylor PhilETaylor - close - 25 Feb 2021

Add a Comment

Login with GitHub to post a comment