Skip to content

Deprecation notices when using with PHP 8.4Β #1056

@mikkamp

Description

@mikkamp

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageNeed triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions