Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Avoid Passing null to parameter exception on PHP 8.1 #43951

Merged
merged 1 commit into from
Aug 31, 2022

Conversation

jose123v
Copy link
Contributor

image

This PR makes sure that the parameter is a string, same as 9.x for 8.x, please, really a small not breaking change

protected function invalidOperator($operator)
{
return ! is_string($operator) || (! in_array(strtolower($operator), $this->operators, true) &&
! in_array(strtolower($operator), $this->grammar->getOperators(), true));
}

@jose123v jose123v changed the title Avoid Passing null to parameter exception on PHP 8.1 [8.x] Avoid Passing null to parameter exception on PHP 8.1 Aug 31, 2022
@jose123v
Copy link
Contributor Author

jose123v commented Aug 31, 2022

The test is something about microtime

There was 1 failure:

1) Illuminate\Tests\Support\SupportHelpersTest::testRetryWithPassingSleepCallback
Failed asserting that 0.3241841793060303 matches expected 0.3.

D:\a\framework\framework\tests\Support\SupportHelpersTest.php:576
phpvfscomposer://D:\a\framework\framework\vendor\phpunit\phpunit\phpunit:91

FAILURES!
Tests: 6795, Assertions: 16631, Failures: 1, Skipped: 186.
Error: Process completed with exit code 1.

public function testRetryWithPassingSleepCallback()
{
$startTime = microtime(true);
$attempts = retry(3, function ($attempts) {
if ($attempts > 2) {
return $attempts;
}
throw new RuntimeException;
}, function ($attempt) {
return $attempt * 100;
});
// Make sure we made three attempts
$this->assertEquals(3, $attempts);
// Make sure we waited 300ms for the first two attempts
$this->assertEqualsWithDelta(0.3, microtime(true) - $startTime, 0.02);
}

@taylorotwell taylorotwell merged commit 762b917 into laravel:8.x Aug 31, 2022
@driesvints
Copy link
Member

This won't be released as 8.x isn't maintained anymore.

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.

None yet

3 participants