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

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

Closed
charroma opened this issue Oct 2, 2023 · 4 comments
Closed
Labels
maybe bug Potential bug, to be investigated module: slugs

Comments

@charroma
Copy link
Contributor

charroma commented Oct 2, 2023

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 ($page_path) 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. #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;

@charroma charroma added the maybe bug Potential bug, to be investigated label Oct 2, 2023
@spleen1981
Copy link
Contributor

Agree, feel free to submit a PR for that.

@charroma
Copy link
Contributor Author

charroma commented Oct 2, 2023

@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
Copy link
Contributor

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

@spleen1981
Copy link
Contributor

this is closed, isn't it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maybe bug Potential bug, to be investigated module: slugs
Projects
None yet
Development

No branches or pull requests

2 participants