Skip to content

fix: ensure class_exists is not called with null#2405

Merged
bshaffer merged 2 commits intogoogleapis:mainfrom
i6systems:fix-php-8.1-deprecation
Mar 17, 2023
Merged

fix: ensure class_exists is not called with null#2405
bshaffer merged 2 commits intogoogleapis:mainfrom
i6systems:fix-php-8.1-deprecation

Conversation

@carlos-granados
Copy link
Copy Markdown
Contributor

In the keyType() function in Model.php we were calling class_exists() to find out if a class existed. However, in some cases the value that we were checking could be null. Since PHP 8.1 a deprecation warning is thrown. In this PR we check that the value that we are passing is not null before calling class_exists(), thus removing the deprecation

Fixes #2372

@carlos-granados carlos-granados requested a review from a team March 10, 2023 11:39
@carlos-granados carlos-granados force-pushed the fix-php-8.1-deprecation branch from 0ac2bcf to 5ea1a91 Compare March 10, 2023 11:41
@bshaffer bshaffer changed the title Fixes deprecation thrown when calling class_exists with null in PHP 8.1 fix: calling class_exists with null in Google\Model Mar 16, 2023
@bshaffer bshaffer changed the title fix: calling class_exists with null in Google\Model fix: ensure class_exists is not called with null Mar 16, 2023
@bshaffer bshaffer enabled auto-merge (squash) March 16, 2023 22:55
@bshaffer bshaffer merged commit 5ed4edc into googleapis:main Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

class_exists() seems to be called on a null value, which causes a deprecation warning in PHP >=8.1

2 participants