User tests: Successful: Unsuccessful:
Pull Request for Issue #39789.
Define $this->currentUpdate
if needed in code afterwards.
See #39789 (comment)
Code review. Check that $this->currentUpdate
is not defined in switch case default:
before first usage.
under certain circumstances: Error: Attempt to assign property "name" on null. File: .../libraries/src/Updater/Adapter/ExtensionAdapter.php:70
No error.
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
Category | ⇒ | Libraries |
Status | New | ⇒ | Pending |
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-02-13 19:28:04 |
Closed_By | ⇒ | ReLater | |
Labels |
Added:
?
|
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.