qtranslate / qtranslate-xt

qTranslate-XT (eXTended) - reviving qTranslate-X multilingual plugin for WordPress. A new community-driven plugin soon. Built-in modules for WooCommerce, ACF, slugs and others.
GNU General Public License v2.0
553 stars 104 forks source link

Fatal Error on the Woocommerce Shop Page when using product filters #1377

Closed charroma closed 7 months ago

charroma commented 1 year ago

qtranslate-xt: Version 3.15.2 (latest) Woocommerce: Version 8.1.1 (latest) _PHP Fatal error: Uncaught TypeError: QTX_Module_Slugs::get_page_by_path(): Argument #1 ($pagepath) must be of type string, null given, called in /qtranslate-xt/src/modules/slugs/slugs.php on line 438 and defined in /qtranslate-xt/src/modules/slugs/slugs.php:1039

This happens on a Woocommerce Shop page (special product archive page) when the product filter is used and add parameters to the url. ex: store/?orderby=popularity&paged=1 $query['product'] doesn't exist in this specific case on line 437.

I see the code was changed last week, but not released yet. https://github.com/qtranslate/qtranslate-xt/pull/1363 The change will prevent the fatal error, but still leave a warning.

Warning: Undefined array key "product" in /qtranslate-xt/src/modules/slugs/slugs.php on line 441 441: $page_slug = $query['name'] ?? $query[ $query['post_type'] ];

adding another null check would fix the problem for the future release 441: $page_slug = $query['name'] ?? $query[ $query['post_type'] ] ?? null;

spleen1981 commented 1 year ago

Agree, feel free to submit a PR for that.

charroma commented 1 year ago

@spleen1981 I never submitted a PR before. I assumed it was easier to let the people already working on the project make the necessary change if they thought it was necessary.

spleen1981 commented 1 year ago

Of course it's easier. This project is community driven, anyone's contribution is welcome.

spleen1981 commented 7 months ago

this is closed, isn't it?