googleapis / google-cloud-php

Google Cloud Client Library for PHP
https://cloud.google.com/php/docs/reference
Apache License 2.0
1.09k stars 436 forks source link

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

Open smoopins opened 3 months ago

smoopins commented 3 months ago

Environment details

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.
bshaffer commented 2 months ago

I believe this is the same issue as we've documented in https://github.com/protocolbuffers/protobuf/issues/13428

I will try to fix this shortly

bshaffer commented 2 months ago

This has been fixed in the main branch of protobuf, and will be fixed in the next protobuf release (https://github.com/protocolbuffers/protobuf/commit/6d84da5e2d42a8c83373c0bc6d7ed0ca6f78aade)