google / site-kit-wp

Site Kit is a one-stop solution for WordPress users to use everything Google has to offer to make them successful on the web.
https://sitekit.withgoogle.com
Apache License 2.0
1.25k stars 292 forks source link

PHP Deprecated Errors and unable to complete plugin setup with PHP 8.2/8.3 & WordPress 6.4.2 #8331

Open adamdunnage opened 8 months ago

adamdunnage commented 8 months ago

Bug Description

Site Kit setup is interrupted and not completed when attempting using a site with PHP 8.2/8.3 & WordPress 6.4.2. After going through OAuth and the setup steps for the plugin, after you click on the Go to my Dashboard button you hit a page full of PHP Deprecated errors as seen in this recording.

After refreshing the page you will be taken to the Dashboard with Unknown Error (code: invalid parameter: 'code') displayed. If you try the Redo the plugin setup button you are taken through OAuth once more and on completion are presented with the page of PHP Deprecated errors once more.

You may also see that Site Kit has now disconnected at this stage and you see the following error: Error connecting Site Kit Unable to receive access token because of an invalid authorization code or refresh token.

Further testing shows that this only happens on PHP 8.2/8.3 with WordPress 6.4.2. I have tested on Site Kit 1.121.0 and 1.120.0 with the same outcome on both. This is preventing users on this particular setup from being able to use Site Kit.

Steps to reproduce

  1. Create a fresh new site with PHP 8.2/8.3 and WordPress 6.4.2.
  2. Start Site Kit setup and go through OAuth and the setup steps.
  3. Once you reach the PHP deprecated errors page, refresh the page.
  4. Attempted the redo setup.
  5. Refresh the PHP deprecated errors page once more.

Screenshots

image

Additional Context


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

Implementation Brief

Test Coverage

QA Brief

Changelog entry

archon810 commented 8 months ago

Same issue here, just updated to PHP 8.2 and now there are tons of deprecated notices. The biggest culprits are:

[23-Mar-2024 07:48:43 UTC] PHP Deprecated:  Creation of dynamic property Google\Site_Kit_Dependencies\Google\Service\AnalyticsData\Row::$dimensionValues is deprecated in public/wp-content/plugins/google-site-kit/third-party/google/apiclient-services/src/AnalyticsData/Row.php on line 32
[23-Mar-2024 07:48:43 UTC] PHP Deprecated:  Creation of dynamic property Google\Site_Kit_Dependencies\Google\Service\AnalyticsData\Row::$metricValues is deprecated in public/wp-content/plugins/google-site-kit/third-party/google/apiclient-services/src/AnalyticsData/Row.php on line 46

Some others:

[23-Mar-2024 07:48:42 UTC] PHP Deprecated:  Creation of dynamic property Google\Site_Kit_Dependencies\Google\Service\AnalyticsData\RunReportResponse::$dimensionHeaders is deprecated in public/wp-content/plugins/google-site-kit/third-party/google/apiclient/src/Model.php on line 104
[23-Mar-2024 07:48:42 UTC] PHP Deprecated:  Creation of dynamic property Google\Site_Kit_Dependencies\Google\Service\AnalyticsData\RunReportResponse::$metricHeaders is deprecated in public/wp-content/plugins/google-site-kit/third-party/google/apiclient/src/Model.php on line 104
[23-Mar-2024 07:48:42 UTC] PHP Deprecated:  Creation of dynamic property Google\Site_Kit_Dependencies\Google\Service\AnalyticsData\RunReportResponse::$totals is deprecated in public/wp-content/plugins/google-site-kit/third-party/google/apiclient/src/Model.php on line 104
[23-Mar-2024 07:48:42 UTC] PHP Deprecated:  Creation of dynamic property Google\Site_Kit_Dependencies\Google\Service\AnalyticsData\RunReportResponse::$maximums is deprecated in public/wp-content/plugins/google-site-kit/third-party/google/apiclient/src/Model.php on line 104
[23-Mar-2024 07:48:42 UTC] PHP Deprecated:  Creation of dynamic property Google\Site_Kit_Dependencies\Google\Service\AnalyticsData\RunReportResponse::$minimums is deprecated in public/wp-content/plugins/google-site-kit/third-party/google/apiclient/src/Model.php on line 104
[23-Mar-2024 07:48:42 UTC] PHP Deprecated:  Creation of dynamic property Google\Site_Kit_Dependencies\Google\Service\AnalyticsData\RunReportResponse::$metadata is deprecated in public/wp-content/plugins/google-site-kit/third-party/google/apiclient/src/Model.php on line 115
[23-Mar-2024 07:48:42 UTC] PHP Deprecated:  Creation of dynamic property Google\Site_Kit_Dependencies\Google\Service\AnalyticsData\RunReportResponse::$rows is deprecated in public/wp-content/plugins/google-site-kit/third-party/google/apiclient-services/src/AnalyticsData/RunReportResponse.php on line 164

[23-Mar-2024 07:48:42 UTC] PHP Deprecated:  Creation of dynamic property Google\Site_Kit_Dependencies\Google\Service\AnalyticsData\Filter::$inListFilter is deprecated in public/wp-content/plugins/google-site-kit/third-party/google/apiclient-services/src/AnalyticsData/Filter.php on line 67
[23-Mar-2024 07:48:42 UTC] PHP Deprecated:  Creation of dynamic property Google\Site_Kit_Dependencies\Google\Service\AnalyticsData\FilterExpression::$filter is deprecated in public/wp-content/plugins/google-site-kit/third-party/google/apiclient-services/src/AnalyticsData/FilterExpression.php on line 49
[23-Mar-2024 07:48:42 UTC] PHP Deprecated:  Creation of dynamic property Google\Site_Kit_Dependencies\Google\Service\AnalyticsData\FilterExpressionList::$expressions is deprecated in public/wp-content/plugins/google-site-kit/third-party/google/apiclient-services/src/AnalyticsData/FilterExpressionList.php on line 30
[23-Mar-2024 07:48:42 UTC] PHP Deprecated:  Creation of dynamic property Google\Site_Kit_Dependencies\Google\Service\AnalyticsData\FilterExpression::$andGroup is deprecated in public/wp-content/plugins/google-site-kit/third-party/google/apiclient-services/src/AnalyticsData/FilterExpression.php on line 35

[23-Mar-2024 07:48:42 UTC] PHP Deprecated:  Creation of dynamic property Google\Site_Kit_Dependencies\Google\Service\GoogleAnalyticsAdmin::$serviceName is deprecated in public/wp-content/plugins/google-site-kit/third-party/google/apiclient-services/src/GoogleAnalyticsAdmin.php on line 64
[23-Mar-2024 07:48:42 UTC] PHP Deprecated:  Creation of dynamic property Google\Site_Kit_Dependencies\Google\Service\AnalyticsData::$serviceName is deprecated in public/wp-content/plugins/google-site-kit/third-party/google/apiclient-services/src/AnalyticsData.php on line 55
[23-Mar-2024 07:48:42 UTC] PHP Deprecated:  Creation of dynamic property Google\Site_Kit\Modules\Analytics_4\GoogleAnalyticsAdmin\AccountProvisioningService::$serviceName is deprecated in public/wp-content/plugins/google-site-kit/third-party/google/apiclient-services/src/GoogleAnalyticsAdmin.php on line 64
[23-Mar-2024 07:48:42 UTC] PHP Deprecated:  Creation of dynamic property Google\Site_Kit\Modules\Analytics_4\GoogleAnalyticsAdmin\PropertiesEnhancedMeasurementService::$serviceName is deprecated in public/wp-content/plugins/google-site-kit/third-party/google/apiclient-services/src/GoogleAnalyticsAdmin.php on line 64
[23-Mar-2024 07:48:42 UTC] PHP Deprecated:  Creation of dynamic property Google\Site_Kit\Modules\Analytics_4\GoogleAnalyticsAdmin\PropertiesAudiencesService::$serviceName is deprecated in public/wp-content/plugins/google-site-kit/third-party/google/apiclient-services/src/GoogleAnalyticsAdmin.php on line 64
[23-Mar-2024 07:48:42 UTC] PHP Deprecated:  Creation of dynamic property Google\Site_Kit\Modules\Analytics_4\GoogleAnalyticsAdmin\PropertiesAdSenseLinksService::$serviceName is deprecated in public/wp-content/plugins/google-site-kit/third-party/google/apiclient-services/src/GoogleAnalyticsAdmin.php on line 64

[23-Mar-2024 07:48:42 UTC] PHP Deprecated:  strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in public/wp-content/plugins/google-site-kit/includes/Modules/Analytics_4/Report.php on line 112

There are probably more. Really loads of them.

mxbclang commented 8 months ago

@archon810 I see your comments on several issues and PRs about this. :) We're aware of the notices that occur with PHP 8.2. These don’t impact any Site Kit functionality and are related to some of the dependency libraries used by Site Kit and can be disregarded.

We're working to update these libraries, but it will take some time as it will require updating PHP compatibility for Site Kit, which requires giving our users on older versions ample time to upgrade so that they don't lose functionality.

We anticipate updating Site Kit's PHP minimum required version in the next month or so and then updating the libraries from there, so hopefully this should be resolved soon. In the meantime, while I know it's frustrating to have this many errors in your error log, you can continue to ignore those messages. Thanks!

archon810 commented 8 months ago

Thank you for the update. The thing about the logs is there are so many notices, they would quickly overwhelm Sentry and would push us over our quota, let alone introduce a delay to each request because of Sentry pings. Log storage requirements would increase dramatically too.

archon810 commented 2 months ago

Checking in here. Any chance PHP 8.2/8.3 will be officially supported anytime soon?

Arman-FS commented 2 months ago

Same issue here: Using PHP v8.3, Sitekit Version 1.135.0, Wordpress Version 6.6.2

[17-Sep-2024 08:14:12 UTC] PHP Deprecated: Creation of dynamic property Google\Site_Kit\Modules\Ads\Web_Tag::$home_domain is deprecated in /home/orbano/public_html/wp-content/plugins/google-site-kit/includes/Modules/Ads/Web_Tag.php on line 37 [17-Sep-2024 08:14:24 UTC] PHP Deprecated: Creation of dynamic property Google\Site_Kit\Modules\Ads\Web_Tag::$home_domain is deprecated in /home/orbano/public_html/wp-content/plugins/google-site-kit/includes/Modules/Ads/Web_Tag.php on line 37 [17-Sep-2024 08:14:44 UTC] PHP Deprecated: Creation of dynamic property Google\Site_Kit\Modules\Ads\Web_Tag::$home_domain is deprecated in /home/orbano/public_html/wp-content/plugins/google-site-kit/includes/Modules/Ads/Web_Tag.php on line 37 [17-Sep-2024 08:14:46 UTC] PHP Deprecated: Creation of dynamic property Google\Site_Kit\Modules\Ads\Web_Tag::$home_domain is deprecated in /home/orbano/public_html/wp-content/plugins/google-site-kit/includes/Modules/Ads/Web_Tag.php on line 37 [17-Sep-2024 08:15:09 UTC] PHP Deprecated: Creation of dynamic property Google\Site_Kit\Modules\Ads\Web_Tag::$home_domain is deprecated in /home/orbano/public_html/wp-content/plugins/google-site-kit/includes/Modules/Ads/Web_Tag.php on line 37 [17-Sep-2024 08:15:10 UTC] PHP Deprecated: Creation of dynamic property Google\Site_Kit\Modules\Ads\Web_Tag::$home_domain is deprecated in /home/orbano/public_html/wp-content/plugins/google-site-kit/includes/Modules/Ads/Web_Tag.php on line 37 [17-Sep-2024 08:15:20 UTC] PHP Deprecated: Creation of dynamic property Google\Site_Kit\Modules\Ads\Web_Tag::$home_domain is deprecated in /home/orbano/public_html/wp-content/plugins/google-site-kit/includes/Modules/Ads/Web_Tag.php on line 37 [17-Sep-2024 08:15:23 UTC] PHP Deprecated: Creation of dynamic property Google\Site_Kit\Modules\Ads\Web_Tag::$home_domain is deprecated in /home/orbano/public_html/wp-content/plugins/google-site-kit/includes/Modules/Ads/Web_Tag.php on line 37 [17-Sep-2024 08:15:30 UTC] PHP Deprecated: Creation of dynamic property Google\Site_Kit\Modules\Ads\Web_Tag::$home_domain is deprecated in /home/orbano/public_html/wp-content/plugins/google-site-kit/includes/Modules/Ads/Web_Tag.php on line 37 [17-Sep-2024 08:15:31 UTC] PHP Deprecated: Creation of dynamic property Google\Site_Kit\Modules\Ads\Web_Tag::$home_domain is deprecated in /home/orbano/public_html/wp-content/plugins/google-site-kit/includes/Modules/Ads/Web_Tag.php on line 37 [17-Sep-2024 08:15:45 UTC] PHP Deprecated: Creation of dynamic property Google\Site_Kit\Modules\Ads\Web_Tag::$home_domain is deprecated in /home/orbano/public_html/wp-content/plugins/google-site-kit/includes/Modules/Ads/Web_Tag.php on line 37 [17-Sep-2024 08:16:05 UTC] PHP Deprecated: Creation of dynamic property Google\Site_Kit\Modules\Ads\Web_Tag::$home_domain is deprecated in /home/orbano/public_html/wp-content/plugins/google-site-kit/includes/Modules/Ads/Web_Tag.php on line 37 [17-Sep-2024 08:16:13 UTC] PHP Deprecated: Creation of dynamic property Google\Site_Kit\Modules\Ads\Web_Tag::$home_domain is deprecated in /home/orbano/public_html/wp-content/plugins/google-site-kit/includes/Modules/Ads/Web_Tag.php on line 37 [17-Sep-2024 08:16:28 UTC] PHP Deprecated: Creation of dynamic property Google\Site_Kit\Modules\Ads\Web_Tag::$home_domain is deprecated in /home/orbano/public_html/wp-content/plugins/google-site-kit/includes/Modules/Ads/Web_Tag.php on line 37 [17-Sep-2024 08:16:36 UTC] PHP Deprecated: Creation of dynamic property Google\Site_Kit\Modules\Ads\Web_Tag::$home_domain is deprecated in /home/orbano/public_html/wp-content/plugins/google-site-kit/includes/Modules/Ads/Web_Tag.php on line 37 [17-Sep-2024 08:16:52 UTC] PHP Deprecated: Creation of dynamic property Google\Site_Kit\Modules\Ads\Web_Tag::$home_domain is deprecated in /home/orbano/public_html/wp-content/plugins/google-site-kit/includes/Modules/Ads/Web_Tag.php on line 37 [17-Sep-2024 08:17:00 UTC] PHP Deprecated: Creation of dynamic property Google\Site_Kit\Modules\Ads\Web_Tag::$home_domain is deprecated in /home/orbano/public_html/wp-content/plugins/google-site-kit/includes/Modules/Ads/Web_Tag.php on line 37 [17-Sep-2024 08:17:14 UTC] PHP Deprecated: Creation of dynamic property Google\Site_Kit\Modules\Ads\Web_Tag::$home_domain is deprecated in /home/orbano/public_html/wp-content/plugins/google-site-kit/includes/Modules/Ads/Web_Tag.php on line 37 [17-Sep-2024 08:17:25 UTC] PHP Deprecated: Creation of dynamic property Google\Site_Kit\Modules\Ads\Web_Tag::$home_domain is deprecated in /home/orbano/public_html/wp-content/plugins/google-site-kit/includes/Modules/Ads/Web_Tag.php on line 37 [17-Sep-2024 08:17:32 UTC] PHP Deprecated: Creation of dynamic property Google\Site_Kit\Modules\Ads\Web_Tag::$home_domain is deprecated in /home/orbano/public_html/wp-content/plugins/google-site-kit/includes/Modules/Ads/Web_Tag.php on line 37

jamesozzie commented 1 month ago

Another user impacted by a deprecation error as per this support topic. PHP 8.2.24, Google Ads related.

maciejmackowiak commented 1 month ago

We anticipate updating Site Kit's PHP minimum required version in the next month or so and then updating the libraries from there, so hopefully this should be resolved soon.

@mxbclang I guess a month has passed, any updates?

adamdunnage commented 3 weeks ago

Another report of this in the support forum which can be found here: https://wordpress.org/support/topic/google-site-kit-error-18/

Pradeep-practicebuzz commented 3 weeks ago

Can you at least suppress the error reporting by using this code before the lines as // Your existing error suppression code $original_error_reporting = error_reporting();

// Set error reporting to only fatal errors and parse errors error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR);

and after the actions and code as // Restore the original error reporting level if needed error_reporting($original_error_reporting);