User tests: Successful: Unsuccessful:
Pull Request for Issue #41929.
This pull request addresses a critical issue in the CMSApplication::login
method where the $authorisations
variable is assumed to always be an array. If this assumption is violated (e.g., due to a plugin returning invalid data), it can cause runtime errors during iteration. Additionally, invalid authorisation
objects were not being handled gracefully, leading to potential application crashes.
The following changes have been implemented:
$authorisations
: Added a check to ensure $authorisations
is an array before iterating over it. If it is not, a warning is logged, and $authorisations
is set to an empty array to prevent further issues.authorisation
objects: Added a check to ensure each authorisation
object has the required status
property. If the object is invalid, a warning is logged.These changes improve the robustness of the login process and prevent runtime errors caused by invalid data.
Setup a Test Environment:
CMSApplication
class is being used in the application.Simulate Login Scenarios:
$authorisations
is not an array (e.g., by mocking the Authentication::authorise
method to return invalid data).Check Logs:
logs/joomla.log.php
) when $authorisations
is invalid or when an invalid authorisation
object is encountered.$authorisations
is not an array.authorisation
objects are not handled gracefully, leading to potential application crashes.$authorisations
gracefully by logging warnings and defaulting to an empty array.authorisation
objects are skipped, and warnings are logged for debugging purposes.Please select:
Pull Request Link: #41929: Prevent HTML warnings in Joomla API response
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Title |
|
This pull request has been automatically rebased to 5.3-dev.
Title |
|
@srikishore5727 Please change in the title "Fix #41929:" to "[5.2]".