Skip to content

Conversation

@beat
Copy link
Contributor

@beat beat commented Jan 23, 2022

Pull Request for Issue # none

Summary of Changes

Fixes Fixes Deprecated: html_entity_decode(): Passing null to parameter #1 ($string) of type string is deprecated in administrator/components/com_finder/helpers/indexer/query.php on line 733`

Testing Instructions

Code review should be enough.

Look in frontend in PHP 8.1 with all errors on and Joomla debug on, while finder is re-indexing.

Actual result BEFORE applying this Pull Request

Deprecated: html_entity_decode(): Passing null to parameter #1 ($string) of type string is deprecated in administrator/components/com_finder/helpers/indexer/query.php on line 733

Expected result AFTER applying this Pull Request

warning disappeared.

Documentation Changes Required

none.

Fixes `Deprecated: html_entity_decode(): Passing null to parameter #1 ($string) of type string is deprecated in administrator/components/com_finder/helpers/indexer/query.php on line 733`
@alikon alikon added the PHP 8.x PHP 8.x deprecated issues label Jan 23, 2022
@alikon
Copy link
Contributor

alikon commented Jan 23, 2022

I have tested this item ✅ successfully on 834b5af


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36796.

@zero-24
Copy link
Contributor

zero-24 commented Jan 23, 2022

Look in frontend in PHP 8.1 with all errors on and Joomla debug on, while finder is re-indexing.

Do you have a stack trace here so we know where the "null" value is comming from? As the signature clearly says "The query input string."

And can you tell me what re-indexing you mean and how to trigger that in the frontend? Isnt indexing triggerd by the backend? Maybe I'm missing something here?

@beat
Copy link
Contributor Author

beat commented Jan 23, 2022

Look in frontend in PHP 8.1 with all errors on and Joomla debug on, while finder is re-indexing.

Do you have a stack trace here so we know where the "null" value is comming from? As the signature clearly says "The query input string."

Hi @zero-24,
Sure!

Call Stack

1 | 0.0001 | 364872 | {main}(  ) | .../index.php:0
2 | 0.0150 | 938704 | Joomla\CMS\Application\CMSApplication->execute(  ) | .../index.php:49
3 | 0.1223 | 3580104 | Joomla\CMS\Application\SiteApplication->render(  ) | .../CMSApplication.php:231
4 | 0.1224 | 3580208 | Joomla\CMS\Application\CMSApplication->render(  ) | .../SiteApplication.php:778
5 | 0.1275 | 3640504 | Joomla\CMS\Document\HtmlDocument->render( $caching = FALSE, $params = ['template'  => 'protostar', 'file' => 'index.php', 'params' => class  Joomla\Registry\Registry { protected $data = class stdClass { ... };  protected $initialized = TRUE; public $separator = '.' }, 'directory'  => '/home/beat/www/j/templates'] ) | .../CMSApplication.php:1140
6 | 0.1275 | 3640504 | Joomla\CMS\Document\HtmlDocument->_renderTemplate(  ) | .../HtmlDocument.php:577
7 | 0.1281 | 3642808 | Joomla\CMS\Document\HtmlDocument->getBuffer( $type = 'modules', $name = 'position-7', $attribs = ['name' => 'position-7', 'style' => 'well'] ) | .../HtmlDocument.php:803
8 | 0.1281 | 3642888 | Joomla\CMS\Document\Renderer\Html\ModulesRenderer->render( $position = 'position-7', $params = ['name' => 'position-7', 'style' => 'well'], $content = NULL ) | .../HtmlDocument.php:511
9 | 0.3278 | 6192000 | Joomla\CMS\Document\Renderer\Html\ModuleRenderer->render( $module = class  stdClass { public $id = '84'; public $title = 'Smart Search Module';  public $module = 'mod_finder'; public $position = 'position-7'; public  $content = ''; public $showtitle = '1'; public $params =  '{"searchfilter":"","show_autosuggest":"1","show_advanced":"0","field_size":20,"show_label":"0","label_pos":"top","alt_label":"","show_button":"0","button_pos":"right","opensearch":"1","opensearch_title":"","set_itemid":"0","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}';  public $menuid = '0'; public $name = 'finder'; public $style = NULL }, $attribs = ['name' => 'position-7', 'style' => 'well'], $content = NULL ) | .../ModulesRenderer.php:47
10 | 0.3278 | 6194656 | Joomla\CMS\Helper\ModuleHelper::renderModule( $module = class  stdClass { public $id = '84'; public $title = 'Smart Search Module';  public $module = 'mod_finder'; public $position = 'position-7'; public  $content = ''; public $showtitle = '1'; public $params =  '{"searchfilter":"","show_autosuggest":"1","show_advanced":"0","field_size":20,"show_label":"0","label_pos":"top","alt_label":"","show_button":"0","button_pos":"right","opensearch":"1","opensearch_title":"","set_itemid":"0","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}';  public $menuid = '0'; public $name = 'finder'; public $style = NULL }, $attribs = ['name' => 'position-7', 'style' => 'well'] ) | .../ModuleRenderer.php:98
11 | 0.3281 | 6221760 | include( '/home/beat/www/j/modules/mod_finder/mod_finder.php ) | .../ModuleHelper.php:200
12 | 0.3318 | 6246464 | ModFinderHelper::getQuery( $params = class  Joomla\Registry\Registry { protected $data = class stdClass { public  $searchfilter = ''; public $show_autosuggest = '1'; public  $show_advanced = '0'; public $field_size = 20; public $show_label = '0';  public $label_pos = 'top'; public $alt_label = ''; public $show_button =  '0'; public $button_pos = 'right'; public $opensearch = '1'; public  $opensearch_title = ''; public $set_itemid = '0'; public $layout =  '_:default'; public $moduleclass_sfx = ''; public $module_tag = 'div';  public $bootstrap_size = '0'; public $header_tag = 'h3'; public  $header_class = ''; public $style = '0' }; protected $initialized =  TRUE; public $separator = '.' } ) | .../mod_finder.php:54
13 | 0.3398 | 6249616 | FinderIndexerQuery->__construct( $options = ['filter' => 0, 'filters' => [0 => 0]] ) | .../helper.php:84
14 | 0.3399 | 6253064 | FinderIndexerQuery->processString( $input = NULL, $lang = 'en', $mode = 'AND' ) | .../query.php:236
15 | 0.3399 | 6253064 | html_entity_decode( $string = NULL, $flags = 3, $encoding = 'UTF-8' )

And can you tell me what re-indexing you mean and how to trigger that in the frontend? Isnt indexing triggerd by the backend? Maybe I'm missing something here?

The error appears in the Smart Search module like this:

image

@zero-24
Copy link
Contributor

zero-24 commented Jan 23, 2022

Please check: https://github.com/joomla/joomla-cms/blob/3.10-dev/administrator/components/com_finder/helpers/indexer/query.php#L175

and update it to $this->input = isset($options['input']) ? $options['input'] : '';

That should do the trick too.

@beat
Copy link
Contributor Author

beat commented Jan 23, 2022

Please check: https://github.com/joomla/joomla-cms/blob/3.10-dev/administrator/components/com_finder/helpers/indexer/query.php#L175

and update it to $this->input = isset($options['input']) ? $options['input'] : '';

That should do the trick too.

Yes, it fixes it too, and as it's better typed, it's a better fix too. Thank you! Updated the PR, with mention in the commit message..

@zero-24
Copy link
Contributor

zero-24 commented Jan 23, 2022

Thanks merging it here :)

@zero-24 zero-24 merged commit 5ed8cdd into joomla:3.10-dev Jan 23, 2022
@zero-24 zero-24 added this to the Joomla 3.10.6 milestone Jan 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PHP 8.x PHP 8.x deprecated issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants