? Information Required Pending

User tests: Successful: Unsuccessful:

avatar boddunan
boddunan
30 Oct 2021

Pull Request for Issue #35941 .
When a third-party component does not use the help buttons on the categories page (or in other words do not have /components/$component/forms/$name.xml file), there are a bunch of PHP warning messages caused by uninitialized variables.

$ref_key & $url variables are initialized only when the file is available.

Summary of Changes

Added checks for empty variables so that they do not generate PHP warning messages

Testing Instructions

Create a component and add categories support. Go to the categories dashboard page of the component.

Actual result BEFORE applying this Pull Request

There were following PHP errors
Warning: Undefined variable $ref_key in /root../administrator/components/com_categories/src/View/Categories/HtmlView.php on line 302
Warning: Undefined variable $url in /root../administrator/components/com_categories/src/View/Categories/HtmlView.php on line 318
Warning: Undefined variable $url in /root../administrator/components/com_categories/src/View/Categories/HtmlView.php on line 328

Expected result AFTER applying this Pull Request

No errors

Documentation Changes Required

None

avatar boddunan boddunan - open - 30 Oct 2021
avatar boddunan boddunan - change - 30 Oct 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 30 Oct 2021
Category Administration com_categories
avatar boddunan boddunan - change - 30 Oct 2021
Labels Added: ?
avatar joomdonation
joomdonation - comment - 5 Nov 2021

@boddunan Do you have a component which we can use to test this PR ? From what I see, these variables are already initialized at https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/components/com_categories/src/View/Categories/HtmlView.php#L290-L291 , so not sure how the warnings you mentioned could happen.

avatar kochinc
kochinc - comment - 10 Nov 2021

I just upgraded a Joomla! 3 test site to 4, and saw these exact warnings when visited Components->Web Links->Categories.


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

avatar boddunan
boddunan - comment - 11 Nov 2021

@boddunan Do you have a component which we can use to test this PR ? From what I see, these variables are already initialized at https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/components/com_categories/src/View/Categories/HtmlView.php#L290-L291 , so not sure how the warnings you mentioned could happen.

The code that you mentioned was added by the below commit (after opening this PR).
28c346d#diff-4262b0c8c876600659b8ed9230945998d173ccda31afb27fdc1fd45412d0189f

However, the code is still not fixed in 4.1 dev branch.

avatar Quy
Quy - comment - 11 Nov 2021

Closing as this is fixed in 4.0.5 with #35662. Please test with the nightly builds: https://developer.joomla.org/nightly-builds.html

Changes in 4.0 will be ported to 4.1.

Thank you for your contribution.

avatar Quy Quy - close - 11 Nov 2021
avatar Quy Quy - change - 11 Nov 2021
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2021-11-11 16:43:23
Closed_By Quy
Labels Added: Information Required

Add a Comment

Login with GitHub to post a comment