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

PHP Deprecated: Calling get_class() without arguments is deprecated in .....google-site-kit/third-party/google/apiclient/src/Http/REST.php on line 49 #9977

Open
jamesozzie opened this issue Jan 6, 2025 · 4 comments
Assignees
Labels
P1 Medium priority Type: Bug Something isn't working Type: Support Support request

Comments

@jamesozzie
Copy link
Collaborator

jamesozzie commented Jan 6, 2025

Bug Description

As reported by one user in the Site Kit support forums, a depreciation notice exists, possibly from the admin toolbar. The error appears as below:

PHP Deprecated: Calling get_class() without arguments is deprecated in /.../google-site-kit/third-party/google/apiclient/src/Http/REST.php on line 49

Awaiting Site Health information from impacted user.

Note that this error was highlighted by engineering when reviewing another issue (#8589). Maybe you have some insights into this @mohitwp?

Additional Context

  • PHP Version:
  • OS: [e.g. iOS]
  • Browser: [e.g. chrome, safari]
  • Plugin Version: [e.g. 22]
  • Device: [e.g. iPhone6]

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

Acceptance criteria

  • google/apiclient should be upgraded to 2.15.2 or higher

Implementation Brief

Test Coverage

  • No changes

QA Brief

Changelog entry

@jamesozzie jamesozzie changed the title PHP Deprecated: Calling get_class() without arguments is deprecated in /home/(…)/public_html/wp-content/plugins/google-site-kit/third-party/google/apiclient/src/Http/REST.php on line 49 PHP Deprecated: Calling get_class() without arguments is deprecated in .....google-site-kit/third-party/google/apiclient/src/Http/REST.php on line 49 Jan 6, 2025
@jamesozzie jamesozzie added Type: Bug Something isn't working Type: Support Support request labels Jan 6, 2025
@aaemnnosttv
Copy link
Collaborator

This will be fixed by upgrading google/apiclient to 2.15.2+ but this requires that we first upgrade to Guzzle 7 so I've opened an issue to do that first.

@aaemnnosttv aaemnnosttv added the P1 Medium priority label Mar 3, 2025
@techanvil techanvil self-assigned this Mar 4, 2025
@techanvil
Copy link
Collaborator

Hey @aaemnnosttv, noting that we have some patcher logic for google/apiclient in our Scoper config, I think we should be a bit cautious with the IB and estimate, as it's possible the new version could invalidate this logic or require some additions (unless you've already explored this and determined that it won't cause any issue).

site-kit-wp/scoper.inc.php

Lines 112 to 126 in 7a0a940

if ( preg_match( '#google/apiclient/src/Google/Http/REST\.php$#', $file_path ) ) {
$contents = str_replace( "\\$prefix\\intVal", '\\intval', $contents );
}
if ( false !== strpos( $file_path, 'vendor/google/apiclient/' ) || false !== strpos( $file_path, 'vendor/google/auth/' ) ) {
// Use modified prefix just for this patch.
$s_prefix = str_replace( '\\', '\\\\', $prefix );
$contents = str_replace( "'\\\\GuzzleHttp\\\\ClientInterface", "'\\\\" . $s_prefix . '\\\\GuzzleHttp\\\\ClientInterface', $contents );
$contents = str_replace( '"\\\\GuzzleHttp\\\\ClientInterface', '"\\\\' . $s_prefix . '\\\\GuzzleHttp\\\\ClientInterface', $contents );
$contents = str_replace( "'GuzzleHttp\\\\ClientInterface", "'" . $s_prefix . '\\\\GuzzleHttp\\\\ClientInterface', $contents );
$contents = str_replace( '"GuzzleHttp\\\\ClientInterface', '"' . $s_prefix . '\\\\GuzzleHttp\\\\ClientInterface', $contents );
}
if ( false !== strpos( $file_path, 'vendor/google/apiclient/' ) ) {
$contents = str_replace( "'Google_", "'" . $prefix . '\Google_', $contents );
$contents = str_replace( '"Google_', '"' . $prefix . '\Google_', $contents );
}

@techanvil techanvil assigned aaemnnosttv and unassigned techanvil Mar 4, 2025
@aaemnnosttv
Copy link
Collaborator

@techanvil That's a good call, although I imagine the changes in the scoper patching would be done in #10302. I'll update the estimate to allow for more time to be safe. Looking a bit more closely, we may need to update Google_Site_Kit_Client due to some signature changes in the underlying client but these shouldn't be time consuming to make.

Here's the diff of the library from our current version 2.14.0 to the latest version we could upgrade to 2.16.1 (due to PHP min increasing in newer versions)
googleapis/google-api-php-client@v2.14.0...v2.16.1

I don't think there is much more to add here without doing it, but we're still blocked by the Guzzle update. We can always revisit the definition before starting this once that issue is done. If you prefer, we can keep this in IB until then as it wouldn't be actionable yet anyways.

@techanvil
Copy link
Collaborator

Hey @aaemnnosttv, thanks for updating the estimate and digging into the changes between the versions.

I don't really mind whether this stays in IB until the Guzzle update is done. I think it would be fine to progress it before that, but it would be useful to add a couple of notes in the IB to raise awareness of the client signature changes and scoper rules. If you prefer to keep it in IB though, so we can get a clearer picture of things once #10302 is complete, that's fine by me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 Medium priority Type: Bug Something isn't working Type: Support Support request
Projects
None yet
Development

No branches or pull requests

3 participants