Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Configuration.php #1594

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

PromInc
Copy link
Contributor

@PromInc PromInc commented Aug 27, 2024

Summary

If the search results page (/catalogsearch/result) is requested and the q query parameter is not present the page will error. The code errors when generating the algoliaConfig JS variable which means that Algolia can not be instantiated. This means no products show on the page - the expected result is that a blank search query would be performed and thus a set of products would be displayed.

Result

Visit /catalogsearch/result and observe that this error is thrown in the Magento var/log/system.log log file.

Exception: Deprecated Functionality: html_entity_decode(): Passing null to parameter #1 ($string) of type string is deprecated in vendor/algolia/algoliasearch-magento-2/Block/Configuration.php on line 272 in vendor/magento/framework/App/ErrorHandler.php:62

This results in a broken page.
image

With this change implemented, the page loads products and no error is thrown.
image

Explanation
typecast the $query variable to comply with the PHP 8 standards of html_entity_decode

Tested On

  • PHP 7.4.3
  • PHP 8.1.2

typecast the $query variable to comply with the PHP 8 standards of [html_entity_decode](https://www.php.net/manual/en/function.html-entity-decode.php)

If the search results page (`/catalogsearch/result`) is requested and the `q` query parameter is not present the page will error.  The code errors when generating the `algoliaConfig` JS variable which means that Algolia can not be instantiated.  This means no products show on the page - the expected result is that a blank search query would be performed and thus a set of products would be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant