Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

PHPStan Error in google/cloud-recaptcha-enterprise

Open
#8,372 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
php
Domain
api, backend, cloud

Research direction

Start with RecaptchaEnterpriseServiceClient, Assessment::getRiskAnalysis(), and RiskAnalysis::getReasons(), then compare the returned RepeatedField behavior with the referenced protobuf-php change. Reproduce the PHPStan error using the shown request flow and determine the compatibility boundary. Done means the reported undefined-method error has an agreed, verified resolution for this deprecated package.

Written by the indexing model from the issue text.

Description

Since the package is deprecated, I was unsure which issue type would be appropriate, but I am submitting this as a Bug Report because a PHPStan error occurs.

Environment details
  • OS: Debian GNU/Linux 12 (bookworm)
  • PHP version: 8.3.22
  • Package name and version: google/cloud-recaptcha-enterprise:2.1.1, google/protobuf:4.31.1
Steps to reproduce
  1. Create an instance of RecaptchaEnterpriseServiceClient.
  2. Create a CreateAssessmentRequest object.
  3. Send the request using the client.
  4. Access the RiskAnalysis of the returned Assessment and call getReasons().
  5. Attempt to call getIterator() on the result of getReasons().
  6. A PHPStan error occurs.
Code example
use Google\Cloud\RecaptchaEnterprise\V1\Assessment;  
use Google\Cloud\RecaptchaEnterprise\V1\Client\RecaptchaEnterpriseServiceClient;  
use Google\Cloud\RecaptchaEnterprise\V1\CreateAssessmentRequest;

// Credentials are actually passed when creating the client
$client = new RecaptchaEnterpriseServiceClient();

// Omitted: building the Assessment instance
$assessment = new Assessment();
$assessmentRequest = CreateAssessmentRequest::build($parent, $assessment);

$createdAssessment = $client->createAssessment($assessmentRequest);
$createdAssessment->getRiskAnalysis()?->getReasons()->getIterator(); // Call to an undefined method Google\Protobuf\Internal\RepeatedField::getIterator().

I’ve been following the protobuf updates and it appears this issue may be due to changes introduced here:

https://github.com/protocolbuffers/protobuf-php/commit/9a6ad10d77de8a6d3320f10bd097bed8d6021ac1#diff-f4adb7d6333d82634864e3424d178a65e8c6e413c257198fd8371622e1e0b303

I understand that this package is deprecated and things still function for now, but I wanted to report this for future compatibility and also because this causes a PHPStan error. I’d appreciate it if you could consider addressing it.

Dominant language
PHP
Stars
1.2k
Forks
464
Avg merge
2d 2h
Merged PRs (30d)
103

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.

More from googleapis/google-cloud-php

All issues in googleapis/google-cloud-php

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.