Closed jamesozzie closed 1 year ago
@aaemnnosttv Here was @eugene-manuilov's suggestion on a fix via Slack:
What we can do on our side: Remove the current approach of finding the base path for products Implement the new approach that will query one random product from the database and use it to detect the product base path Found path will be cached for X minutes (probably something between 1-5 mins) to avoid querying the database for every request.
Just FYI, the exact issue occurred on my web server with PHP 8.1.21
Thanks, @robertstaddon! As you can see, we're working to address this on our side, but WPML has also notified us that they're planning to release a fix in their own update next week. You can follow along with them here: https://wpml.org/errata/site-kit-by-google-uncaught-typeerror-illegal-offset-type-in-isset-or-empty-in/.
Hi, I am Pierre from WPML and indeed we've included one more check on our side to prevent this kind of error. This will go out with WPML 4.6.5 scheduled for next Monday.
That said, I strongly support the idea of a better (less random) approach to discover the product URL format. As suggested by @eugene-manuilov, trying to fetch an existing product from the DB would probably be a more robust solution.
Thanks @strategio, that's great to hear 👍 We'll use this issue to fix the problem people are experiencing now and we'll iterate on our implementation to be more robust in another as this is part of a future feature that isn't available yet.
Our next release is scheduled for the following Monday the 14th.
IB ✔️
Verified:
Userinput
feature flag enabled and disabled. There are some PHP errors on 8.2 but not linked to this issue. We have reported these here. I also ran through on PHP 7.4 just for peace of mind. Nice work! Thank you all.
Bug Description
As reported in the support forums, some WPML users are unable to access their WP admin or encounter fatal errors after upgrading to Site Kit 1.106.0.
One workaround that seemed to work for one user was the following:
For impacted users who may be severely impacted with the above workaround not resolving this issue, you can install Site Kit 1.105.0 where this should no longer occur. If you're having trouble deactivating and deleting Site Kit 1.106.0 please open a support topic.
We performed some internal testing on this and we were able to initially encounter errors, which required some database changes. After doing so we didn't encounter any errors specifically between Site Kit and WPML although we do see some PHP warnings relating to WPML (only with PHP 8.2.8 and not older versions)
Console errors with error reporting (and display) enabled, with only WPML active and SK disabled
``` Deprecated: Creation of dynamic property Whip_RequirementsChecker::$configuration is deprecated in /var/www/vhosts/plastiskip.com/httpdocs/wp-content/plugins/sitepress-multilingual-cms/vendor/yoast/whip/src/Whip_RequirementsChecker.php on line 37 Deprecated: Creation of dynamic property Whip_RequirementsChecker::$messageManager is deprecated in /var/www/vhosts/plastiskip.com/httpdocs/wp-content/plugins/sitepress-multilingual-cms/vendor/yoast/whip/src/Whip_RequirementsChecker.php on line 38 ``` ![image](https://github.com/google/site-kit-wp/assets/41326532/f3cbbad4-da38-40a9-9d6d-7df90219fc07)Notes from team discussion
> Currently, we create a fake product and try to get a permalink for it. It works fine on sites where there is nothing else that tries to modify the permalink. > In the reported site, WPLM tries to create a localised version of the permalink for non existing product and fails. > What we can do on our side: > Remove the current approach of finding the base path for products > Implement the new approach that will query one random product from the database and use it to detect the product base path > Found path will be cached for X minutes (probably something between 1-5 mins) to avoid querying the database for every request. >Second stack trace
``` Stack trace: #0 /opt/bitnami/wordpress/wp-content/plugins/sitepress-multilingual-cms/classes/translations/class-wpml-post-element.php(54): SitePress->is_display_as_translated_post_type() #1 /opt/bitnami/wordpress/wp-content/plugins/sitepress-multilingual-cms/classes/url-handling/wpml-url-filters.class.php(445): WPML_Post_Element->is_display_as_translated() #2 /opt/bitnami/wordpress/wp-content/plugins/sitepress-multilingual-cms/classes/url-handling/wpml-url-filters.class.php(238): WPML_URL_Filters->is_display_as_translated_mode() #3 /opt/bitnami/wordpress/wp-includes/class-wp-hook.php(310): WPML_URL_Filters->permalink_filter() #4 /opt/bitnami/wordpress/wp-includes/plugin.php(205): WP_Hook->apply_filters() #5 /opt/bitnami/wordpress/wp-includes/link-template.php(371): apply_filters() #6 /opt/bitnami/wordpress/wp-includes/link-template.php(201): get_post_permalink() #7 /opt/bitnami/wordpress/wp-content/plugins/google-site-kit/includes/Core/Assets/Assets.php(1099): get_permalink() #8 /opt/bitnami/wordpress/wp-content/plugins/google-site-kit/includes/Core/Assets/Assets.php(728): Google\Site_Kit\Core\Assets\Assets->get_product_base_paths() #9 /opt/bitnami/wordpress/wp-content/plugins/google-site-kit/includes/Core/Assets/Assets.php(357): Google\Site_Kit\Core\Assets\Assets->get_inline_base_data() #10 [internal function]: Google\Site_Kit\Core\Assets\Assets->Google\Site_Kit\Core\Assets\{closure}() #11 /opt/bitnami/wordpress/wp-content/plugins/google-site-kit/includes/Core/Assets/Script_Data.php(51): call_user_func() #12 [internal function]: Google\Site_Kit\Core\Assets\Script_Data->Google\Site_Kit\Core\Assets\{closure}() #13 /opt/bitnami/wordpress/wp-content/plugins/google-site-kit/includes/Core/Assets/Asset.php(129): call_user_func() #14 /opt/bitnami/wordpress/wp-content/plugins/google-site-kit/includes/Core/Assets/Assets.php(1017): Google\Site_Kit\Core\Assets\Asset->before_print() #15 /opt/bitnami/wordpress/wp-content/plugins/google-site-kit/includes/Core/Assets/Assets.php(1026): Google\Site_Kit\Core\Assets\Assets->run_before_print_callbacks() #16 /opt/bitnami/wordpress/wp-content/plugins/google-site-kit/includes/Core/Assets/Assets.php(1026): Google\Site_Kit\Core\Assets\Assets->run_before_print_callbacks() #17 /opt/bitnami/wordpress/wp-content/plugins/google-site-kit/includes/Core/Assets/Assets.php(1026): Google\Site_Kit\Core\Assets\Assets->run_before_print_callbacks() #18 /opt/bitnami/wordpress/wp-content/plugins/google-site-kit/includes/Core/Assets/Assets.php(156): Google\Site_Kit\Core\Assets\Assets->run_before_print_callbacks() #19 /opt/bitnami/wordpress/wp-includes/class-wp-hook.php(308): Google\Site_Kit\Core\Assets\Assets->Google\Site_Kit\Core\Assets\{closure}() #20 /opt/bitnami/wordpress/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters() #21 /opt/bitnami/wordpress/wp-includes/plugin.php(517): WP_Hook->do_action() #22 /opt/bitnami/wordpress/wp-admin/admin-header.php(146): do_action() #23 /opt/bitnami/wordpress/wp-admin/index.php(137): require_once('...') #24 {main} thrown in /opt/bitnami/wordpress/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php on line 3937 ```Steps to reproduce
(note that during testing I couldn't consistently reproduce this on different sites)
Screenshots
Related support topics
Additional Context
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
userInput
feature is enabledImplementation Brief
Assets::get_product_base_paths
ifuserInput
is not enabled as the first checkTest Coverage
AssetsTest
accordinglyQA Brief
userInput
enabledChangelog entry
1.106.0
on a site with aproduct
post type.