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
545 stars 103 forks source link

Fatal error #1395

Closed sviluppomania closed 4 months ago

sviluppomania commented 4 months ago

Hi, I got this fatal error, does anyone have a solution?

PHP Fatal error:  Uncaught TypeError: QTX_Module_Slugs::home_url(): Argument #2 ($path) must be of type string, null given, called in wp-includes/class-wp-hook.php on line 324 and defined in wp-content/plugins/qtranslate-xt/src/modules/slugs/slugs.php:536
Stack trace:
#0  wp-includes/class-wp-hook.php(324): QTX_Module_Slugs->home_url()
#1  wp-includes/plugin.php(205): WP_Hook->apply_filters()
#2  wp-includes/link-template.php(3463): apply_filters()
#3  wp-includes/link-template.php(3409): get_home_url()
#4  plugins/oauth2-provider/library/class-wo-api.php(44): home_url()
#5  wp-content/plugins/oauth2-provider/wp-oauth-server.php(112): include_once('...')
#6  wp-includes/class-wp-hook.php(324): wpoauth_server_template_redirect_intercept()
#7  wp-includes/plugin.php(205): WP_Hook->apply_filters()
#8  wp-includes/template-loader.php(104): apply_filters()
#9  wp-blog-header.php(19): require_once('...')
#10 index.php(17): require('...')
#11 {main}
  thrown in /plugins/qtranslate-xt/src/modules/slugs/slugs.php on line 536
sviluppomania commented 4 months ago

@spleen1981

spleen1981 commented 4 months ago

It looks like this oauth2-provider plugin is calling home_url() with 2nd parameter null, while it should be empty string of they do not want to pass any value, ref here. It's not related to slugs module, if you turn it off you should get errors elsewhere. Filter defined in slugs module is in compliance with WP spec.

sviluppomania commented 4 months ago

@spleen1981 Strange, because if I deactivate the Slugs integration/module I don't receive any other errors and the integrated login through OAuth within my App works correctly.

spleen1981 commented 4 months ago

That is probably because you don't have any other filter for home_url, or the other filters do not check function parameters type, as WP function get_home_url does not check types as well, while slugs filter does. You can suggest to fix this oauth2-provider plugin behaviour to its developers or fix locally adding your own filter in priority over slugs filter to turn the null into "".

spleen1981 commented 4 months ago

closing this as not a qtx issue