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

prevent php 8.1 deprecation notice in strtotime #748

Merged
merged 1 commit into from
Jan 31, 2023

Conversation

peterjaap
Copy link
Contributor

@peterjaap peterjaap commented Jan 24, 2023

I got this error;

image

Fix proof:

php > $data['date'] = null;
php > $dateTime = date('d-m-Y H:i', strtotime($data['date']));
PHP Deprecated:  strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in php shell code on line 1
PHP Stack trace:
PHP   1. {main}() php shell code:0
PHP   2. strtotime($datetime = NULL) php shell code:1

Deprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in php shell code on line 1

Call Stack:
   32.4666     603888   1. {main}() php shell code:0
   32.4666     603888   2. strtotime($datetime = NULL) php shell code:1

php > $dateTime = date('d-m-Y H:i', strtotime($data['date'] ?? ''));
php > var_dump($dateTime);
php shell code:1:
string(16) "01-01-1970 00:00"

Resolves #739

Fix proof:

```
php > $data['date'] = null;
php > $dateTime = date('d-m-Y H:i', strtotime($data['date']));
PHP Deprecated:  strtotime(): Passing null to parameter myparcelnl#1 ($datetime) of type string is deprecated in php shell code on line 1
PHP Stack trace:
PHP   1. {main}() php shell code:0
PHP   2. strtotime($datetime = NULL) php shell code:1

Deprecated: strtotime(): Passing null to parameter myparcelnl#1 ($datetime) of type string is deprecated in php shell code on line 1

Call Stack:
   32.4666     603888   1. {main}() php shell code:0
   32.4666     603888   2. strtotime($datetime = NULL) php shell code:1

php > $dateTime = date('d-m-Y H:i', strtotime($data['date'] ?? ''));
php > var_dump($dateTime);
php shell code:1:
string(16) "01-01-1970 00:00"
```
@peterjaap peterjaap requested a review from a team as a code owner January 24, 2023 14:58
@joerivanveen joerivanveen changed the base branch from main to develop January 24, 2023 19:42
@joerivanveen joerivanveen changed the title Fix PHP 8.1 deprecation notice in strtotime prevent php 8.1 deprecation notice in strtotime Jan 24, 2023
@joerivanveen joerivanveen merged commit e016246 into myparcelnl:develop Jan 31, 2023
MyParcelBot pushed a commit that referenced this pull request Feb 2, 2023
## [4.8.1](v4.8.0...v4.8.1) (2023-02-02)

### 🐛 Bug Fixes

* clarify texts regarding mailbox settings ([#745](#745)) ([8d33bd9](8d33bd9))
* fix division by zero issue on checkout ([#746](#746)) ([cee3094](cee3094))
* fix php 8.1 deprecation notice in strtotime ([#748](#748)) ([eca47d6](eca47d6))
* mailbox works with kilo setting on php 8.1 ([#744](#744)) ([721259a](721259a))
* prevent type error in use entity id ([#749](#749)) ([57a05a7](57a05a7))
* use correct way to inject search value ([#750](#750)) ([d11f3e0](d11f3e0))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants