? Pending

User tests: Successful: Unsuccessful:

avatar ReLater
ReLater
13 Feb 2023

Pull Request for Issue #39789.

Summary of Changes

Define $this->currentUpdate if needed in code afterwards.

Testing Instructions

See #39789 (comment)

Code review. Check that $this->currentUpdate is not defined in switch case default: before first usage.

Actual result BEFORE applying this Pull Request

under certain circumstances: Error: Attempt to assign property "name" on null. File: .../libraries/src/Updater/Adapter/ExtensionAdapter.php:70

Expected result AFTER applying this Pull Request

No error.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar joomla-cms-bot joomla-cms-bot - change - 13 Feb 2023
Category Libraries
avatar ReLater ReLater - open - 13 Feb 2023
avatar ReLater ReLater - change - 13 Feb 2023
Status New Pending
avatar ReLater ReLater - change - 13 Feb 2023
The description was changed
avatar ReLater ReLater - edited - 13 Feb 2023
avatar ReLater ReLater - change - 13 Feb 2023
The description was changed
avatar ReLater ReLater - edited - 13 Feb 2023
avatar joomdonation
joomdonation - comment - 13 Feb 2023

I haven't tested but I'm certain the change here is not right. The code in the class parse XML from a update server to find update information, for example https://joomdonation.com/updates/eventsbooking.xml.

The code in method _startElement method (which you modified) is called each time the xml parser found a starting tag from the xml document. As you can see from the code, when it found UPDATE tag, it initializes $currentUpdate property of the class with stores some information to that object.

The default case in that code blocks is called when the xml parser found any other tags (excludes Update/Update tags). So with your change, the data stored in $currentUpdate property before will be lost/reset and surely, it will cause unexpected behaviors.

For the issue you are having, It happens because there are some installed extensions have wrong xml definition for their update server. You need to identify the extension has this issue and ask the developer of the extension to correct it.

For this case, If we really want to fix, we should log the error and display a warning like this https://github.com/joomla/joomla-cms/blob/4.2-dev/libraries/src/Updater/Adapter/ExtensionAdapter.php#L292-L294 if $currentUpdate properly has not initialized yet when we come to that default case.

avatar ReLater ReLater - change - 13 Feb 2023
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2023-02-13 19:28:04
Closed_By ReLater
Labels Added: ?
avatar ReLater ReLater - close - 13 Feb 2023

Add a Comment

Login with GitHub to post a comment