Skip to content

PHP 8.2 compatibility #29

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

SOHELAHMED7
Copy link

@SOHELAHMED7 SOHELAHMED7 commented Dec 6, 2023

This PR adds PHP 8.2 compatibility.

I am using this module in Yii2 app which runs on PHP 8.2

Till now I only faced 1 PHP 8.2 compatibility issue for which I created this PR.


This pull request is endorsed by ☁️ cebe.cloud

Update JobFilter.php
@@ -193,7 +193,7 @@ public function searchSenders()
*/
private function parseDatetime($value, $isEnd = false)
{
$dt = DateTime::createFromFormat('Y-m-d\TH:i', $value);
$dt = DateTime::createFromFormat('Y-m-d\TH:i', (string) $value);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this fix the case where $value is null? If so, it might be better to catch that case and return null directly before calling createFromFormat():

if ($value === null) {
     return null;
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Suggestion applied.

@cebe
Copy link

cebe commented Dec 7, 2023

Here is the error message fixed by this change:

Deprecated: DateTime::createFromFormat(): Passing null to parameter #2 ($datetime) of type string is deprecated in /in/Wd3KZ on line 3

https://3v4l.org/Wd3KZ

Update JobFilter.php
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.

2 participants