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.22k stars 274 forks source link

Review PHP deprecation notices with PHP 8.1+ #8589

Open jamesozzie opened 1 month ago

jamesozzie commented 1 month ago

Bug Description

As reported by one user in the forums, there are deprecation notices stemming from the plugin, and not part of any third party dependency. These can be seem below:

E_DEPRECATED htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in file /wp-content/plugins/google-site-kit/includes/Core/Authentication/Clients/OAuth_Client.php on line 403

E_DEPRECATED strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in file /wp-content/plugins/google-site-kit/includes/Modules/Analytics_4/Report.php on line 112

E_DEPRECATED htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in file /wp-content/plugins/google-site-kit/includes/Core/Authentication/Setup.php on line 234

Testing underway, with more insights and log files to be provided.


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

jansudek commented 1 month ago

last time there is only one that error: E_DEPRECATED strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in file /wp-content/plugins/google-site-kit/includes/Modules/Analytics_4/Report.php on line 112 other e_deprecated is not seen anyway.. PHP 8.1 and newer still in Site Kit by Google v1.125.0 error showed for example at /wp-admin/ (Dashboard) Site Kit Summary

jansudek commented 1 month ago

there is NO 'compareStartDate' and 'compareEndDate' in keys :

1) Google\Site_Kit\Core\REST_API\Data_Request::__set_state(array( 'method' => 'GET', 'type' => 'modules', 'identifier' => 'analytics-4', 'datapoint' => 'report', 'data' => array ( 'slug' => 'analytics-4', 'datapoint' => 'report', 'metrics' => array ( 0 => array ( 'name' => 'screenPageViews', ), ), 'dimensions' => array ( 0 => array ( 'name' => 'pagePath', ), ), 'startDate' => '2024-03-26', 'endDate' => '2024-04-22', 'orderby' => array ( 0 => array ( 'metric' => array ( 'metricName' => 'screenPageViews', ), 'desc' => 'true', ), ), 'limit' => '5', '_locale' => 'user', ), 'key' => NULL, ))

2) Google\Site_Kit\Core\REST_API\Data_Request::__set_state(array( 'method' => 'GET', 'type' => 'modules', 'identifier' => 'analytics-4', 'datapoint' => 'report', 'data' => array ( 'slug' => 'analytics-4', 'datapoint' => 'report', 'metrics' => array ( 0 => array ( 'name' => 'screenPageViews', ), ), 'dimensions' => array ( 0 => array ( 'name' => 'pagePath', ), 1 => array ( 'name' => 'pageTitle', ), ), 'startDate' => '2024-03-26', 'endDate' => '2024-04-22', 'dimensionFilters' => array ( 'pagePath' => array ( 0 => '/', 1 => '/tym/2016/pardubicka-rota/', 2 => '/tym/2018/alfa-skvadra-tym-dynamickejch-cuprstar-sekacskejch-vlkousu/', 3 => '/tym/2022/', 4 => '/tym/2022/konska-hlava-na-skrini-2/', ), ), 'orderby' => array ( 0 => array ( 'metric' => array ( 'metricName' => 'screenPageViews', ), 'desc' => 'true', ), ), 'limit' => '25', '_locale' => 'user', ), 'key' => NULL, ))

jansudek commented 1 month ago

some debug backtrace:

  1. https://www.krizemkrazem.net/wp-content/backtrace/2024-05-01t1258220000.log
  2. https://www.krizemkrazem.net/wp-content/backtrace/2024-05-01t1258220000-1.log
jamesozzie commented 1 day ago

I do have a similar error that only appears when Site Kit is active, and the error doesn't reference any Site Kit files: Deprecated: ltrim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/vhosts/plastiskip.com/httpdocs/wp-includes/formatting.php on line 4494

This is on a test site and it occurs with only SK active.

Recording of my experience.

In order to create this error, I had to enable Dashboard Sharing with an editor profile. The error only occurs for this editor. The error also exists with only SC active. Happy to share a login for test purposes.

SH info ``` ### wp-core ### version: 6.5.3 site_language: en_US user_language: en_US timezone: +00:00 permalink: /%postname%/ https_status: true multisite: false user_registration: 0 blog_public: 1 default_comment_status: undefined environment_type: production user_count: 12 dotorg_communication: true ### wp-paths-sizes ### wordpress_path: /var/www/vhosts/plastiskip.com/httpdocs wordpress_size: 103.60 MB (108631880 bytes) uploads_path: /var/www/vhosts/plastiskip.com/httpdocs/wp-content/uploads uploads_size: 6.06 MB (6358276 bytes) themes_path: /var/www/vhosts/plastiskip.com/httpdocs/wp-content/themes themes_size: 20.52 MB (21513999 bytes) plugins_path: /var/www/vhosts/plastiskip.com/httpdocs/wp-content/plugins plugins_size: 77.68 MB (81454694 bytes) database_size: 65.45 MB (68624596 bytes) total_size: 273.31 MB (286583445 bytes) ### wp-dropins (1) ### maintenance.php: true ### wp-active-theme ### name: Twenty Twenty (twentytwenty) version: 2.6 author: the WordPress team author_website: https://wordpress.org/ parent_theme: none theme_features: core-block-patterns, widgets-block-editor, automatic-feed-links, custom-background, post-thumbnails, custom-logo, title-tag, html5, align-wide, responsive-embeds, customize-selective-refresh-widgets, editor-color-palette, editor-font-sizes, editor-styles, widgets, menus, editor-style theme_path: /var/www/vhosts/plastiskip.com/httpdocs/wp-content/themes/twentytwenty auto_update: Disabled ### wp-themes-inactive (1) ### AMPFace: version: 1.6.0, author: James Ozzie Osborne, Auto-updates disabled ### wp-mu-plugins (1) ### Health Check Troubleshooting Mode: author: (undefined), version: 1.9.1 ### wp-plugins-active (1) ### Site Kit by Google: version: 1.127.0, author: Google, Auto-updates enabled ### wp-plugins-inactive (11) ### AMP: version: 2.5.3, author: AMP Project Contributors, Auto-updates enabled Elementor Pro: version: 3.8.2, author: Elementor.com, Auto-updates disabled Health Check & Troubleshooting: version: 1.7.0, author: The WordPress.org community, Auto-updates enabled Microsoft Azure Storage for WordPress: version: 4.4.1, author: 10up, Microsoft Open Technologies (latest version: 4.4.2), Auto-updates disabled Modern Image Formats: version: 1.1.0, author: WordPress Performance Team (latest version: 1.1.1), Auto-updates disabled Performance Lab: version: 3.1.0, author: WordPress Performance Team, Auto-updates enabled Plugin Check (PCP): version: 1.0.1, author: WordPress Performance Team and Plugin Review Team, Auto-updates disabled Query Monitor: version: 3.16.3, author: John Blackbourn, Auto-updates enabled Site Kit by Google Tester: version: 1.11.0, author: Google, Auto-updates enabled Site Kit by Google – IPv6 Support Helper: version: 0.2, author: Evan Mattson, Auto-updates disabled SQLite Database Integration: version: 2.1.9, author: The WordPress Team (latest version: 2.1.11), Auto-updates disabled ### wp-media ### image_editor: WP_Image_Editor_Imagick imagick_module_version: 1690 imagemagick_version: ImageMagick 6.9.10-68 Q16 x86_64 2024-01-12 https://imagemagick.org imagick_version: 3.7.0 file_uploads: 1 post_max_size: 16M upload_max_filesize: 16M max_effective_size: 16 MB max_file_uploads: 20 imagick_limits: imagick::RESOURCETYPE_AREA: 11 GB imagick::RESOURCETYPE_DISK: 9.2233720368548E+18 imagick::RESOURCETYPE_FILE: 6144 imagick::RESOURCETYPE_MAP: 11 GB imagick::RESOURCETYPE_MEMORY: 6 GB imagick::RESOURCETYPE_THREAD: 1 imagick::RESOURCETYPE_TIME: 9.2233720368548E+18 imagemagick_file_formats: 3FR, 3G2, 3GP, AAI, AI, ART, ARW, AVI, AVS, BGR, BGRA, BGRO, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CRW, CUR, CUT, DATA, DCM, DCR, DCX, DDS, DFONT, DNG, DOT, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FAX, FILE, FITS, FRACTAL, FTP, FTS, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP4, GV, H, HALD, HDR, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, J2C, J2K, JNG, JNX, JP2, JPC, JPE, JPEG, JPG, JPM, JPS, JPT, JSON, K25, KDC, LABEL, M2V, M4V, MAC, MAGICK, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, PPM, PREVIEW, PS, PS2, PS3, PSB, PSD, PTIF, PWP, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIFF, VIPS, VST, WBMP, WMF, WMV, WMZ, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, YCbCr, YCbCrA, YUV gd_version: bundled (2.1.0 compatible) gd_formats: GIF, JPEG, PNG, WebP, BMP, XPM ghostscript_version: 9.25 ### wp-server ### server_architecture: Linux 3.10.0-957.5.1.el7.x86_64 x86_64 httpd_software: nginx/1.26.0 php_version: 8.1.28 64bit php_sapi: fpm-fcgi max_input_variables: 1000 time_limit: 60 memory_limit: 128M admin_memory_limit: 256M max_input_time: 60 upload_max_filesize: 16M php_post_max_size: 16M curl_version: 7.29.0 NSS/3.90 suhosin: false imagick_availability: true pretty_permalinks: true htaccess_extra_rules: true current: 2024-05-31T15:13:24+00:00 utc-time: Friday, 31-May-24 15:13:24 UTC server-time: 2024-05-31T15:13:22+00:00 ### wp-database ### extension: mysqli server_version: 10.5.25-MariaDB client_version: mysqlnd 8.1.28 max_allowed_packet: 16777216 max_connections: 151 ### wp-constants ### WP_HOME: undefined WP_SITEURL: undefined WP_CONTENT_DIR: /var/www/vhosts/plastiskip.com/httpdocs/wp-content WP_PLUGIN_DIR: /var/www/vhosts/plastiskip.com/httpdocs/wp-content/plugins WP_MEMORY_LIMIT: 40M WP_MAX_MEMORY_LIMIT: 256M WP_DEBUG: true WP_DEBUG_DISPLAY: true WP_DEBUG_LOG: true SCRIPT_DEBUG: true WP_CACHE: false CONCATENATE_SCRIPTS: undefined COMPRESS_SCRIPTS: undefined COMPRESS_CSS: undefined WP_ENVIRONMENT_TYPE: Undefined WP_DEVELOPMENT_MODE: undefined DB_CHARSET: utf8mb4 DB_COLLATE: undefined ### wp-filesystem ### wordpress: writable wp-content: writable uploads: writable plugins: writable themes: writable mu-plugins: writable ### google-site-kit ### version: 1.127.0 php_version: 8.1.28 wp_version: 6.5.3 reference_url: https://plastiskip.com amp_mode: no site_status: connected-site user_status: authenticated verification_status: verified-file connected_user_count: 1 active_modules: site-verification, search-console, pagespeed-insights recoverable_modules: none required_scopes: openid: ✅ https://www.googleapis.com/auth/userinfo.profile: ✅ https://www.googleapis.com/auth/userinfo.email: ✅ https://www.googleapis.com/auth/siteverification: ✅ https://www.googleapis.com/auth/webmasters: ✅ capabilities: googlesitekit_authenticate: ✅ googlesitekit_setup: ✅ googlesitekit_view_posts_insights: ✅ googlesitekit_view_dashboard: ✅ googlesitekit_manage_options: ✅ googlesitekit_update_plugins: ✅ googlesitekit_view_splash: ✅ googlesitekit_view_authenticated_dashboard: ✅ googlesitekit_view_wp_dashboard_widget: ✅ googlesitekit_view_admin_bar_menu: ✅ googlesitekit_view_shared_dashboard: ⭕ googlesitekit_read_shared_module_data::["search-console"]: ✅ googlesitekit_read_shared_module_data::["pagespeed-insights"]: ⭕ googlesitekit_manage_module_sharing_options::["search-console"]: ✅ googlesitekit_manage_module_sharing_options::["pagespeed-insights"]: ✅ googlesitekit_delegate_module_sharing_management::["search-console"]: ✅ googlesitekit_delegate_module_sharing_management::["pagespeed-insights"]: ✅ enabled_features: adsPax: ⭕ audienceSegmentation: ⭕ conversionInfra: ⭕ gm3Components: ⭕ consent_mode: disabled consent_api: not-detected search-console_shared_roles: administrator, editor, author, contributor, shop_manager search-console_management: owner pagespeed-insights_shared_roles: none pagespeed-insights_management: all_admins search_console_property: https://plastiskip.com/ ```

image

In my case also, this could be related to my server setup, given I see the below at present for my admin user. Rather than being server related, it's IPv6 related as when I enable the IPv6 plugin, the dashboard loads once more.

image