DEPRECATED warnings when calling getName() on a Secret or SecretVersion
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 https://github.com/protocolbuffers/protobuf/issues/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 (https://github.com/protocolbuffers/protobuf/commit/6d84da5e2d42a8c83373c0bc6d7ed0ca6f78aade)
This should be fixed in this repo by the end of the week
These are now fixed in the latest version
Reopening as this actually seems to be an issue in the protobuf library and requires more consideration
Hmm, I can't duplicate this, but looking at these lines, they imply that null is being passed to strlen in the protobuf core library. This shouldn't be happening, and I'm not sure what the implications of this are.
To fix this in protobuf, the values being passed into strlen could be cast to string, so if they're null, they won't output that deprecation. But I find it odd that those values would be null...
- in GPBJsonWire, things would likely fail when
$field_nameis null - in Message, I'm not sure which instance of
strlenis throwing the error (because the line number is off), but they seem equally important.
Closing this for now as I can't duplicate it. Please open again on the protobuf repo and assign to me if you continue to experience the issue. And please provide the version of protobuf you're using.