Success

User tests: Successful: Unsuccessful:

avatar richard67
richard67
2 Oct 2023

Pull Request for Issue #42011 .

Summary of Changes

You shall not bind multiple times with different values to the same bind variable in prepared SQL statements.

The :template bind variable is used 2 times in the getListQuery method of the StylesModel:

  1. Here when the filter by the template is used: https://github.com/joomla/joomla-cms/blob/4.4-dev/administrator/components/com_templates/src/Model/StylesModel.php#L185-L189
  2. Here when the search box is used with a text search (i.e. not an ID search with id:):
    https://github.com/joomla/joomla-cms/blob/4.4-dev/administrator/components/com_templates/src/Model/StylesModel.php#L243

If both is used, the search box and the template filter, the same :template variable is bound 2 times with different values.

This PR here fixes that by using different bind variables.

Testing Instructions

In either the admin or site template styles conduct a search that has no results
Then select a value in the "Template" filter.

Actual result BEFORE applying this Pull Request

SQL error "The number of variables must match the number of parameters in the prepared statement".

The only way to make the Template Styles view work again is to clear the session cookie.

Expected result AFTER applying this Pull Request

Still see the no matching results message

Link to documentations

Please select:

  • No documentation changes for docs.joomla.org needed

  • No documentation changes for manual.joomla.org needed

avatar richard67 richard67 - open - 2 Oct 2023
avatar laoneo laoneo - close - 3 Oct 2023
avatar laoneo laoneo - merge - 3 Oct 2023
avatar laoneo
laoneo - comment - 3 Oct 2023

Thanks!

Add a Comment

Login with GitHub to post a comment