googleapis/google-cloud-php

DEPRECATED warnings when calling getName() on a Secret or SecretVersion

smoopins opened this issue · 2 comments

Environment details

  • OS: MacOS Sonoma 14.5 (M1 series)
  • PHP version: 8.2.21
  • Package name and version: cloud-secret-manager: v1.15.2

Steps to reproduce

Call the getName() method of either a Secret or a SecretVersion.

Code example

        $projectId = 'beetlejuice-example';
        $client = new SecretManagerServiceClient();
        $parent = $client->projectName($projectId);

        $secretId = 'harry-belafonte-example';
        $createSecretRequest = (new CreateSecretRequest())
            ->setParent($parent)
            ->setSecretId($secretId)
            ->setSecret(new Secret([
                'replication' => new Replication([
                    'automatic' => new Automatic(),
                ]),
            ]));

        $secret = $this->client->createSecret($createSecretRequest);
        echo $secret->getName();

The above code outputs many copies of the following pair of deprecation warnings:

   DEPRECATED  strlen(): Passing null to parameter #1 ($string) of type string is deprecated in vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php on line 1890.


   DEPRECATED  strlen(): Passing null to parameter #1 ($string) of type string is deprecated in vendor/google/protobuf/src/Google/Protobuf/Internal/GPBJsonWire.php on line 23.

I believe this is the same issue as we've documented in protocolbuffers/protobuf#13428

I will try to fix this shortly

This has been fixed in the main branch of protobuf, and will be fixed in the next protobuf release (protocolbuffers/protobuf@6d84da5)