Fatal Error on search
-
Hello,
I’m using WooCommerce with LearnPress plugin. When performing a search with default Search Block I got a fatal error
Fatal error: Uncaught Error: Path cannot be empty in /Users/macUser/Local Sites/custom-theme/app/public/wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/Utils/BlockTemplateUtils.php on line 203 Call stack: file_get_contents() wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/Utils/BlockTemplateUtils.php:203 Automattic\W\B\U\BlockTemplateUtils::build_template_result_from_file() wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/BlockTemplatesController.php:392 Automattic\W\B\BlockTemplatesController::add_block_templates() wp-includes/class-wp-hook.php:324 WP_Hook::apply_filters() wp-includes/plugin.php:205 apply_filters() wp-includes/block-template-utils.php:1030 get_block_templates() wp-includes/block-template.php:140 resolve_block_template() wp-includes/block-template.php:66 locate_block_template() wp-includes/template.php:66 get_query_template() wp-includes/template.php:515 get_search_template() wp-content/plugins/query-monitor/collectors/theme.php:242 QM_Collector_Theme::action_template_redirect() wp-includes/class-wp-hook.php:324 WP_Hook::apply_filters() wp-includes/class-wp-hook.php:348 WP_Hook::do_action() wp-includes/plugin.php:517 do_action() wp-includes/template-loader.php:13 require_once() wp-blog-header.php:19 require() index.php:17
I’m using default Twenty Twenty-Four theme.
Best Regards!
Ramzesimus
-
Hey there 👋,
Thanks for reaching out!
It looks like performing a search in the default search block is resulting in the above fatal error, correct?
This is not something I am able to replicate on my test site which uses the latest available version of WooCommerce core (
8.4
) and the default Storefront theme:Does this occur when all plugins are deactivated except for WooCommerce? This can help us narrow down if a conflicting plugin is leading to the fatal error being triggered.
If you do not want to test on your live site, you can use the free Health Check plugin which will allow you to deactivate plugins while you’re still logged in, without affecting normal visitors to your site.
I’d also like to take a closer look at your sites current environment, can you please share a copy of your sites System Status Report. You can find this via WooCommerce → Status.
Select
Get system report
and thenDownload for Support
. This will download a TXT file that has the contents of the SSR which you can then share with us here.Cheers!
Hey @beautyofcode,
Thanks for your reply!
You’re right, the fatal error appears on default search. Actually, you only need to add
your-site.com/?s=test
What I found out that the issue appears if both WooCommerce and LearnPress plugins are active. I’m sending you the system report
` WordPress Environment WordPress address (URL): http://search-test.local<br>Site address (URL): http://search-test.local<br>WC Version: 8.5.1<br>REST API Version: ✔ 8.5.1<br>WC Blocks Version: ✔ 11.8.0-dev<br>Action Scheduler Version: ✔ 3.7.1<br>Log Directory Writable: ✔<br>WP Version: 6.4.2<br>WP Multisite: –<br>WP Memory Limit: 256 MB<br>WP Debug Mode: –<br>WP Cron: ✔<br>Language: en_US<br>External object cache: – Server Environment Server Info: nginx/1.16.0<br>PHP Version: 8.1.23<br>PHP Post Max Size: 1,000 MB<br>PHP Time Limit: 1200<br>PHP Max Input Vars: 4000<br>cURL Version: 8.4.0<br>(SecureTransport) LibreSSL/3.3.6 SUHOSIN Installed: –<br>MySQL Version: 8.0.16<br>Max Upload Size: 300 MB<br>Default Timezone is UTC: ✔<br>fsockopen/cURL: ✔<br>SoapClient: ✔<br>DOMDocument: ✔<br>GZip: ✔<br>Multibyte String: ✔<br>Remote Post: ✔<br>Remote Get: ✔ Database WC Database Version: 8.5.1<br>WC Database Prefix: wp_<br>Total Database Size: 28.88MB<br>Database Data Size: 23.22MB<br>Database Index Size: 5.66MB<br>wp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB<br>wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_woocommerce_order_itemmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB<br>wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_actionscheduler_actions: Data: 0.02MB + Index: 0.11MB + Engine InnoDB<br>wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_actionscheduler_logs: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_comments: Data: 0.06MB + Index: 0.09MB + Engine InnoDB<br>wp_learnpress_files: Data: 0.02MB + Index: 0.05MB + Engine InnoDB<br>wp_learnpress_order_itemmeta: Data: 0.02MB + Index: 0.05MB + Engine InnoDB<br>wp_learnpress_order_items: Data: 0.02MB + Index: 0.05MB + Engine InnoDB<br>wp_learnpress_question_answermeta: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_learnpress_question_answers: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_learnpress_quiz_questions: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_learnpress_section_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_learnpress_sections: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_learnpress_sessions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_learnpress_user_item_results: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_learnpress_user_itemmeta: Data: 0.02MB + Index: 0.05MB + Engine InnoDB<br>wp_learnpress_user_items: Data: 0.02MB + Index: 0.11MB + Engine InnoDB<br>wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_options: Data: 2.48MB + Index: 0.06MB + Engine InnoDB<br>wp_postmeta: Data: 4.52MB + Index: 3.02MB + Engine InnoDB<br>wp_posts: Data: 14.52MB + Index: 0.28MB + Engine InnoDB<br>wp_term_relationships: Data: 0.19MB + Index: 0.09MB + Engine InnoDB<br>wp_term_taxonomy: Data: 0.08MB + Index: 0.11MB + Engine InnoDB<br>wp_termmeta: Data: 0.08MB + Index: 0.09MB + Engine InnoDB<br>wp_terms: Data: 0.09MB + Index: 0.09MB + Engine InnoDB<br>wp_thim_cache: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_usermeta: Data: 0.05MB + Index: 0.03MB + Engine InnoDB<br>wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB<br>wp_wc_admin_note_actions: Data: 0.05MB + Index: 0.02MB + Engine InnoDB<br>wp_wc_admin_notes: Data: 0.06MB + Index: 0.00MB + Engine InnoDB<br>wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_wc_order_addresses: Data: 0.02MB + Index: 0.06MB + Engine InnoDB<br>wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_wc_order_operational_data: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB<br>wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB<br>wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_wc_orders: Data: 0.02MB + Index: 0.11MB + Engine InnoDB<br>wp_wc_orders_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_wc_product_attributes_lookup: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB<br>wp_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB Post Type Counts attachment: 1<br>custom_css: 3<br>nav_menu_item: 101<br>page: 209<br>post: 593<br>product: 178<br>wp_block: 13<br>wp_global_styles: 2<br>wp_navigation: 3<br>wp_template: 6<br>wp_template_part: 2 Security Secure connection (HTTPS): ❌<br>Your store is not using HTTPS. Learn more about HTTPS and SSL Certificates.<br>Hide errors from visitors: ✔ Active Plugins (3) LearnPress: by ThimPress – 4.2.5.9<br>WooCommerce: by Automattic – 8.5.1<br>WordPress Importer: by wordpressdotorg – 0.8.2 Inactive Plugins (0) Settings API Enabled: –<br>Force SSL: –<br>Currency: EUR (€)<br>Currency Position: right_space<br>Thousand Separator: .<br>Decimal Separator: ,<br>Number of Decimals: 2<br>Taxonomies: Product Types: external (external)<br>grouped (grouped)<br>simple (simple)<br>variable (variable) Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)<br>exclude-from-search (exclude-from-search)<br>featured (featured)<br>outofstock (outofstock)<br>rated-1 (rated-1)<br>rated-2 (rated-2)<br>rated-3 (rated-3)<br>rated-4 (rated-4)<br>rated-5 (rated-5) Connected to Woo.com: –<br>Enforce Approved Product Download Directories: ✔<br>HPOS feature screen enabled: ✔<br>HPOS feature enabled: ✔<br>Order datastore: Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore<br>HPOS data sync enabled: – WC Pages Shop base: #6 - /shop/<br>Cart: #7 - /cart/<br>Checkout: #8 - /checkout/<br>My account: #9 - /my-account/<br>Terms and conditions: ❌ Page not set Theme Name: Twenty Twenty-Four<br>Version: 1.0<br>Author URL: https://wordpress.org<br>Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme<br>WooCommerce Support: ❌ Not declared Templates Overrides: – Admin Enabled Features: activity-panels<br>analytics<br>product-block-editor<br>coupons<br>core-profiler<br>customer-effort-score-tracks<br>import-products-task<br>experimental-fashion-sample-products<br>shipping-smart-defaults<br>shipping-setting-tour<br>homescreen<br>marketing<br>mobile-app-banner<br>navigation<br>onboarding<br>onboarding-tasks<br>product-variation-management<br>product-virtual-downloadable<br>product-external-affiliate<br>product-grouped<br>remote-inbox-notifications<br>remote-free-extensions<br>payment-gateway-suggestions<br>shipping-label-banner<br>subscriptions<br>store-alerts<br>transient-notices<br>woo-mobile-welcome<br>wc-pay-promotion<br>wc-pay-welcome-page Disabled Features: customize-store<br>minified-js<br>new-product-management-experience<br>product-linked<br>settings<br>async-product-editor-category-field Daily Cron: ✔ Next scheduled: 2024-01-20 16:14:43 +00:00<br>Options: ✔<br>Notes: 63<br>Onboarding: completed Action Scheduler Complete: 3<br>Oldest: 2024-01-19 16:15:47 +0000<br>Newest: 2024-01-19 16:15:47 +0000 Failed: 1<br>Oldest: 2024-01-19 16:16:10 +0000<br>Newest: 2024-01-19 16:16:10 +0000 Pending: 1<br>Oldest: 2024-01-20 16:15:47 +0000<br>Newest: 2024-01-20 16:15:47 +0000 Status report information Generated at: 2024-01-19 16:19:07 +00:00<br>`
Best Regards!
RamzesimusAn additional info.
- The issue appears only with a block theme. Tried with Twenty Twenty-Four and Twenty Twenty-Three. It doesn’t appear with a classic theme including the Storefront.
- The search result shouldn’t be empty. In other words, use a keyword that is present in on your post.
Let me know if you need any additional info.
Hello ramzesimus
Thank you for your reply and for detailing the issue you’re encountering with the default Search Block resulting in a fatal error when WooCommerce and LearnPress plugins are both active on your site.
I’ve attempted to reproduce this error by following the steps you provided, including navigating to http://your-site.com/?s=test, but I was unable to encounter the same fatal error on my end.
Since the problem seems specific to the combination of WooCommerce and LearnPress, it would be beneficial to bring this to the LearnPress support team’s attention for further troubleshooting. They may have more insights into conflicts between their plugin and the default search functionality.
Additionally, if you’re currently testing this on a local environment, it could be helpful to try replicating this issue on a live server, if possible. This could help clarify whether the issue is isolated to the local setup or if it persists in a live environment. Sometimes local environments have unique configurations that do not reflect a live server’s conditions.
Once you have more information or if the error continues on a live server, please feel free to get back in touch with us and we can continue to work on this together.
Thank you for your patience and cooperation as we work to resolve this matter. 🙂
Best regards.
Hey @doublezed2
Thanks for your reply!
I’ll contact the LearnPress support as well. Hope they won’t redirect me to WooCommerce support because the fatal error refers to WooCommerce plugin 🙂
I prepared a fresh install with Twenty Twenty-Four theme, WooCommerce, and LearnPress. Please check it out https://woo.dan-fisher.dev
To see the error enter “test” keyword in the search form in the header or go directly to https://woo.dan-fisher.dev/?s=test which is a search result page.Best Regards!
RamzesimusBtw, we were able to narrowed the error down. It appears if the search keyword matches an existing product category. For example, you enter “search” as a keyword and you have “Test” product category.
Best Regards!
RamzesimusHey, @ramzesimus!
Thanks for sharing the extra information about the issue.
I checked https://woo.dan-fisher.dev and got a fatal error, so I was not able to test it like you asked.
Were you able to talk with LearnPress support? Were they able to asssit you?
Please let us know if there’s anything else we can do to help.
Have a wonderful day!
Hi @carolm29,
Thanks for your reply!
My apologize, we performed some tests but now we reverted the changes so you can check it out https://woo.dan-fisher.dev
I opened a new topic on LearnPress support site less then a day ago, so we didn’t receive reply so far https://wordpress.org/support/topic/fatal-error-on-search-4/
Best Regards!
RamzesimusA quick update after doing some tests. The error appears on PHP 8.2+
Best Regards!
RamzesimusHey, @ramzesimus!
A quick update after doing some tests. The error appears on PHP 8.2+
I’m glad you were able to find the issue!
Just to confirm, everything works normally if you use a different version of PHP, correct?
So I’ll mark this issue as solved, okay?
Thank you for sharing the cause and contributing to the WooCommerce community. This might help other users in the future.
Have a wonderful day!
Hey @carolm29,
I’m not sure if I got you correctly. I just noted that the error appears on PHP 8.2+
However, if you use PHP 7.4 you got warnings, not errors. See screenshot https://share.cleanshot.com/2CNdFkhRSo, we can say that the issue exists on both PHP 7.4 and PHP 8.2+
I just thought that it would help you to recreate the error on your side. As you can see the issue is not solved. Would you mind to unmark the resolved status?
Best Regards!
RamzesimusI just update the topic status to “not resolved”. Thanks!
Hope for your help.
Best Regards!
RamzesimusHi there @ramzesimus 👋
From what I gather, the errors appear with PHP version 8.2+.
I prepared a fresh install with Twenty Twenty-Four theme, WooCommerce, and LearnPress. Please check it out https://woo.dan-fisher.dev
Just to clarify, based on this message from earlier, did you already have a chance to test with having only the TT4 theme, and the WooCommerce plugin activated, and see if the errors persists, or otherwise?
When performing tests, with a test installation of mine, it all is error-free when having PHP version 7.4.x to 8.2.x selected.
Looking forward to hearing from you!
Hi @anastas10s,
Sorry for not being clear enough.
Yes, I tested on PHP 7.4, PHP 8.1, PHP 8.2, and PHP 8.3. The only difference is that in PHP 7.4 only a warning appears. There is an error when PHP 8.1+ is used.I tested with different block themes including TT4 and TT3. The issue appears if you’re using any block theme. Everything is ok if a classic theme is used.
Best Regards!
RamzesimusHello ramzesimus
Thank you for your reply.
I wanted to replicate this issue on my test site so I have set up a new site with the default TT4 theme. I have also installed WooCommerce and LearnPress plugins. My server is on PHP 8.1.
However, I am unable to reproduce the error you are seeing.
Could you please tell me if there are any other specific configurations I need to set up? I appreciate your continuous help in identifying this issue and finding its solution.
Best regards.
- The topic ‘Fatal Error on search’ is closed to new replies.