fix: Use self:: instead of $this-> for static validation methods in GapicClientTrait validation #643
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes a critical issue where enabling OpCache (specifically with JIT or strict optimization levels) causes a fatal error:
Too few arguments to functionGoogle\Cloud...\GapicClientTrait::validateNotNull(), 2 passed ... and exactly 2 expectedThe methods
validateNotNullandtraitValidate(aliased fromValidationTrait::validate) are defined as static. However, they are currently called using instance syntax ($this->...).While valid in standard PHP, some OpCache/JIT configurations misinterpret the stack frame when a static method is invoked via
$this, potentially counting the implicit object instance as a misaligned argument or failing to discard it correctly before the static call.I have updated the calls to use
self::instead of$this->.This explicitly invokes them as static methods, ensuring the correct opcode generation and preventing the argument count mismatch error in optimized environments.
closes #642
what is this code?
opening it in an IDE is like a Christmas tree