-
Notifications
You must be signed in to change notification settings - Fork 130
Description
Description of the problem
Simple search is throwing PHP errors when the default search excerpt field is set to the Expresso Store fieldtype.
When creating a new channel, the first field that gets added is set as the default, and in this instance was the Expresso Store fieldtype.
Changing the search excerpt to a text-based field resolves the issue.
Simple search template:
{exp:search:simple_form form_class="header__search-wrapper" channel="assets" search_in="everywhere" where="any" results="12" result_page="search/results" no_result_page="search/no-results"}
{/exp:search:simple_form}
Search Results template:
{exp:search:search_results}
{title} - {url_title}
{/exp:search:search_results}
How To Reproduce
Steps to reproduce the behavior:
- Create a new channel
- Add a single store fieldtype field
- Add entry to new channel
- Use simple search
Error Messages
TypeError Caught
strip_tags(): Argument #1 ($string) must be of type string, array given
ee/ExpressionEngine/Addons/search/mod.search.php:1318
Stack Trace: Please include when reporting this error
#0 ee/ExpressionEngine/Addons/search/mod.search.php(1318): strip_tags()
#1 ee/ExpressionEngine/Addons/channel/mod.channel.php(2539): Search->callback_search_result_row()
#2 ee/legacy/libraries/channel_entries_parser/Parser.php(341): Channel->{closure}()
#3 ee/legacy/libraries/Channel_entries_parser.php(172): EE_Channel_data_parser->parse()
#4 ee/ExpressionEngine/Addons/channel/mod.channel.php(2553): EE_Channel_parser->parse()
#5 ee/ExpressionEngine/Addons/search/mod.search.php(1274): Channel->parse_channel_entries()
#6 ee/legacy/libraries/Template.php(1841): Search->search_results()
#7 ee/legacy/libraries/Template.php(1516): EE_Template->process_tags()
#8 ee/legacy/libraries/Template.php(630): EE_Template->tags()
#9 ee/legacy/libraries/Template.php(248): EE_Template->parse()
#10 ee/legacy/libraries/Template.php(178): EE_Template->fetch_and_parse()
#11 ee/legacy/libraries/Core.php(831): EE_Template->run_template_engine()
#12 ee/legacy/controllers/ee.php(53): EE_Core->generate_page()
#13 [internal function]: EE->index()
#14 ee/ExpressionEngine/Core/Core.php(269): call_user_func_array()
#15 ee/ExpressionEngine/Core/Core.php(125): ExpressionEngine\Core\Core->runController()
#16 ee/ExpressionEngine/Boot/boot.php(184): ExpressionEngine\Core\Core->run()
#17 index.php(164): require_once('...')
#17 index.php(164): require_once('...')
Screenshots / Videos / Template Code
var_dump of from line 1318's strip_tags() content ($row['field_id_' . $row['search_excerpt']]) that expects a string but is an array:
array(37) { ["entry_id"]=> int(7) ["price"]=> string(5) "$0.00" ["weight"]=> NULL ["length"]=> NULL ["width"]=> NULL ["height"]=> NULL ["handling"]=> NULL ["free_shipping"]=> int(0) ["tax_exempt"]=> int(0) ["price_val"]=> float(0) ["regular_price"]=> string(5) "$0.00" ["regular_price_val"]=> float(0) ["sale_price"]=> string(5) "$0.00" ["sale_price_val"]=> float(0) ["you_save"]=> string(5) "$0.00" ["you_save_val"]=> float(0) ["handling_val"]=> float(0) ["price_inc_tax"]=> string(5) "$0.00" ["price_inc_tax_val"]=> float(0) ["regular_price_inc_tax"]=> string(5) "$0.00" ["regular_price_inc_tax_val"]=> float(0) ["sale_price_inc_tax"]=> string(5) "$0.00" ["sale_price_inc_tax_val"]=> float(0) ["you_save_inc_tax"]=> string(5) "$0.00" ["you_save_inc_tax_val"]=> float(0) ["dimension_l"]=> NULL ["dimension_w"]=> NULL ["dimension_h"]=> NULL ["on_sale"]=> bool(false) ["you_save_percent"]=> int(0) ["min_order_qty"]=> int(1) ["total_stock"]=> int(28) ["track_stock"]=> bool(true) ["modifiers"]=> array(1) { [0]=> array(14) { ["product_mod_id"]=> int(2) ["entry_id"]=> int(7) ["mod_type"]=> string(3) "var" ["mod_name"]=> string(4) "Size" ["mod_instructions"]=> string(0) "" ["mod_order"]=> int(0) ["modifier_id"]=> int(2) ["modifier_name"]=> string(4) "Size" ["modifier_input_name"]=> string(11) "modifiers_2" ["modifier_type"]=> string(3) "var" ["modifier_instructions"]=> string(0) "" ["modifier_options"]=> array(5) { [0]=> array(25) { ["product_opt_id"]=> int(6) ["product_mod_id"]=> int(2) ["opt_name"]=> string(5) "Small" ["opt_price_mod"]=> NULL ["opt_order"]=> int(1) ["option_id"]=> int(6) ["option_name"]=> string(5) "Small" ["price_mod"]=> string(5) "$0.00" ["price_inc_mod"]=> string(5) "$0.00" ["regular_price_mod"]=> string(5) "$0.00" ["regular_price_inc_mod"]=> string(5) "$0.00" ["sale_price_mod"]=> string(5) "$0.00" ["sale_price_inc_mod"]=> string(5) "$0.00" ["option_first"]=> bool(true) ["option_last"]=> bool(false) ["price_mod_val"]=> float(0) ["price_inc_mod_val"]=> float(0) ["regular_price_mod_val"]=> float(0) ["regular_price_inc_mod_val"]=> float(0) ["sale_price_mod_val"]=> float(0) ["sale_price_inc_mod_val"]=> float(0) ["option_sku"]=> bool(false) ["option_track_stock"]=> bool(false) ["option_stock_level"]=> bool(false) ["option_min_order_qty"]=> bool(false) } [1]=> array(25) { ["product_opt_id"]=> int(7) ["product_mod_id"]=> int(2) ["opt_name"]=> string(6) "Medium" ["opt_price_mod"]=> NULL ["opt_order"]=> int(2) ["option_id"]=> int(7) ["option_name"]=> string(6) "Medium" ["price_mod"]=> string(5) "$0.00" ["price_inc_mod"]=> string(5) "$0.00" ["regular_price_mod"]=> string(5) "$0.00" ["regular_price_inc_mod"]=> string(5) "$0.00" ["sale_price_mod"]=> string(5) "$0.00" ["sale_price_inc_mod"]=> string(5) "$0.00" ["option_first"]=> bool(false) ["option_last"]=> bool(false) ["price_mod_val"]=> float(0) ["price_inc_mod_val"]=> float(0) ["regular_price_mod_val"]=> float(0) ["regular_price_inc_mod_val"]=> float(0) ["sale_price_mod_val"]=> float(0) ["sale_price_inc_mod_val"]=> float(0) ["option_sku"]=> bool(false) ["option_track_stock"]=> bool(false) ["option_stock_level"]=> bool(false) ["option_min_order_qty"]=> bool(false) } [2]=> array(25) { ["product_opt_id"]=> int(8) ["product_mod_id"]=> int(2) ["opt_name"]=> string(5) "Large" ["opt_price_mod"]=> NULL ["opt_order"]=> int(3) ["option_id"]=> int(8) ["option_name"]=> string(5) "Large" ["price_mod"]=> string(5) "$0.00" ["price_inc_mod"]=> string(5) "$0.00" ["regular_price_mod"]=> string(5) "$0.00" ["regular_price_inc_mod"]=> string(5) "$0.00" ["sale_price_mod"]=> string(5) "$0.00" ["sale_price_inc_mod"]=> string(5) "$0.00" ["option_first"]=> bool(false) ["option_last"]=> bool(false) ["price_mod_val"]=> float(0) ["price_inc_mod_val"]=> float(0) ["regular_price_mod_val"]=> float(0) ["regular_price_inc_mod_val"]=> float(0) ["sale_price_mod_val"]=> float(0) ["sale_price_inc_mod_val"]=> float(0) ["option_sku"]=> bool(false) ["option_track_stock"]=> bool(false) ["option_stock_level"]=> bool(false) ["option_min_order_qty"]=> bool(false) } [3]=> array(25) { ["product_opt_id"]=> int(9) ["product_mod_id"]=> int(2) ["opt_name"]=> string(7) "X-Large" ["opt_price_mod"]=> NULL ["opt_order"]=> int(4) ["option_id"]=> int(9) ["option_name"]=> string(7) "X-Large" ["price_mod"]=> string(5) "$0.00" ["price_inc_mod"]=> string(5) "$0.00" ["regular_price_mod"]=> string(5) "$0.00" ["regular_price_inc_mod"]=> string(5) "$0.00" ["sale_price_mod"]=> string(5) "$0.00" ["sale_price_inc_mod"]=> string(5) "$0.00" ["option_first"]=> bool(false) ["option_last"]=> bool(false) ["price_mod_val"]=> float(0) ["price_inc_mod_val"]=> float(0) ["regular_price_mod_val"]=> float(0) ["regular_price_inc_mod_val"]=> float(0) ["sale_price_mod_val"]=> float(0) ["sale_price_inc_mod_val"]=> float(0) ["option_sku"]=> bool(false) ["option_track_stock"]=> bool(false) ["option_stock_level"]=> bool(false) ["option_min_order_qty"]=> bool(false) } [4]=> array(25) { ["product_opt_id"]=> int(10) ["product_mod_id"]=> int(2) ["opt_name"]=> string(8) "XX-Large" ["opt_price_mod"]=> NULL ["opt_order"]=> int(5) ["option_id"]=> int(10) ["option_name"]=> string(8) "XX-Large" ["price_mod"]=> string(5) "$0.00" ["price_inc_mod"]=> string(5) "$0.00" ["regular_price_mod"]=> string(5) "$0.00" ["regular_price_inc_mod"]=> string(5) "$0.00" ["sale_price_mod"]=> string(5) "$0.00" ["sale_price_inc_mod"]=> string(5) "$0.00" ["option_first"]=> bool(false) ["option_last"]=> bool(true) ["price_mod_val"]=> float(0) ["price_inc_mod_val"]=> float(0) ["regular_price_mod_val"]=> float(0) ["regular_price_inc_mod_val"]=> float(0) ["sale_price_mod_val"]=> float(0) ["sale_price_inc_mod_val"]=> float(0) ["option_sku"]=> bool(false) ["option_track_stock"]=> bool(false) ["option_stock_level"]=> bool(false) ["option_min_order_qty"]=> bool(false) } } ["modifier_select"]=> string(247) "
Small
" ["modifier_input"]=> string(50) "
" } } ["no_modifiers"]=> bool(false) ["sku"]=> string(12) "jacket-small" ["stock_level"]=> int(10) }
Environment Details:
- EE Version: 7.5.16
- Store Version: 6.0.2
- PHP Version 8.2
- MySQL Version 8
- OS: Linux
- Web Server: Nginx
Possible Solution
Store fieldtype really isn't helpful in site search, so it could be disabled from being able to be selected as a search excerpt.