googleads / googleads/google-ads-php

Deprecation notices when using with PHP 8.4

Open
#1,056 12 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug triage
Dominant language
PHP
Stars
357
Forks
276
Avg merge
1d 7h
Merged PRs (30d)
3

Description

Your client library and Google Ads API versions:

  • Client library version: dev-legacy-v25.0.0
  • Google Ads API version: V18
    Your environment:
    PHP 7. 4 up to PHP 8.4

Description of the bug:
When using the library on PHP 8.4 there are several deprecation notices which are logged. They all seem to be coming from the same function parseName which must make the $template parameter type nullable.

There might be other occurrences of PHP 8.4 incompatibilities in the library, but these are the ones we encountered from the parts that we use.

Steps to reproduce:
Use one of the services from the library with PHP 8.4 ensuring that deprecation notices are being logged.

Expected behavior:
No deprecation notices when running on PHP 8.4

Request/Response Logs:
These are the notices we are currently encountering:

GoogleAdsServiceClient::parseName(): Implicitly marking parameter $template as nullable is deprecated, the explicit nullable type must be used instead
google-listings-and-ads/vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/V16/Services/Client/GoogleAdsServiceClient.php:1789

CustomerServiceClient::parseName(): Implicitly marking parameter $template as nullable is deprecated, the explicit nullable type must be used instead
google-listings-and-ads/vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/V16/Services/Client/CustomerServiceClient.php:163

ConversionActionServiceClient::parseName(): Implicitly marking parameter $template as nullable is deprecated, the explicit nullable type must be used instead
google-listings-and-ads/vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/V16/Services/Client/ConversionActionServiceClient.php:157

CampaignServiceClient::parseName(): Implicitly marking parameter $template as nullable is deprecated, the explicit nullable type must be used instead
google-listings-and-ads/vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/V16/Services/Client/CampaignServiceClient.php:287

ProductLinkInvitationServiceClient::parseName(): Implicitly marking parameter $template as nullable is deprecated, the explicit nullable type must be used instead
google-listings-and-ads/vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/V16/Services/Client/ProductLinkInvitationServiceClient.php:164

LabelServiceClient::parseName(): Implicitly marking parameter $template as nullable is deprecated, the explicit nullable type must be used instead
google-listings-and-ads/vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/V16/Services/Client/LabelServiceClient.php:141

CampaignBudgetServiceClient::parseName(): Implicitly marking parameter $template as nullable is deprecated, the explicit nullable type must be used instead
google-listings-and-ads/vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/V16/Services/Client/CampaignBudgetServiceClient.php:141

AssetServiceClient::parseName(): Implicitly marking parameter $template as nullable is deprecated, the explicit nullable type must be used instead
google-listings-and-ads/vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/V16/Services/Client/AssetServiceClient.php:161

AssetGroupServiceClient::parseName(): Implicitly marking parameter $template as nullable is deprecated, the explicit nullable type must be used instead
google-listings-and-ads/vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/V16/Services/Client/AssetGroupServiceClient.php:159

AssetGroupAssetServiceClient::parseName(): Implicitly marking parameter $template as nullable is deprecated, the explicit nullable type must be used instead
google-listings-and-ads/vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/V16/Services/Client/AssetGroupAssetServiceClient.php:181

ExtensionFeedItemServiceClient::parseName(): Implicitly marking parameter $template as nullable is deprecated, the explicit nullable type must be used instead
google-listings-and-ads/vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/V16/Services/Client/ExtensionFeedItemServiceClient.php:211

Anything else we should know about your project / environment:
The error logs from above are from V16 of the API, however this is still the same with the files for the latest V18 as well.

We include the library within a WordPress extension so we need to remain compatible with PHP 7.4 up to PHP 8.4, which is why we are currently using the legacy package: https://packagist.org/packages/googleads/google-ads-php#dev-legacy-v25.0.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with parseName in the listed V16 client files and compare the corresponding V18 GoogleAdsServiceClient.php implementation. Reproduce the notices with PHP 8.4, then verify the affected client services run without deprecations while retaining compatibility with PHP 7.4.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.