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

Return empty string instead of setting it to null #1

Conversation

liverpoolfc-fan
Copy link
Owner

PHP 8.0 stopped allowing empty strings to be passed to gmstrftime. This led to the previously suggested change to replace the empty string with null. Unfortunately, that change collided with the gmstrftime also accepting null as a valid input where it would return the current time formatted as requested.

This led to contacts who had empty Anniversary and Birthday fields getting their empty strings replaced by nulls, and subsequently getting passed to gmstrftime which would assign them values of the current time.

The correct behaviour for the streamer in this instance is to just return the empty string

What does this implement/fix? Explain your changes.

...

Does this close any currently open issues?

...

Any relevant logs, error output, etc?

...

Where has this been tested?

Server (please complete the following information):

  • OS: [e.g. iOS]
  • PHP Version: [e.g. 8.2]
  • Backend for: [e.g. Kopano, Zimbra, Mail-in-a-Box]
  • and Version: [e.g. git, 9.0, v61.1]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Mail App [e.g. GMail, Apple Mail]
  • Version [e.g. 22]

PHP 8.0 stopped allowing empty strings to be passed to gmstrftime. This led to the previously suggested change to replace the empty string with null. Unfortunately, that change collided with the gmstrftime also accepting null as a valid input where it would return the current time formatted as requested.

This led to contacts who had empty Anniversary and Birthday fields getting their empty strings replaced by nulls, and subsequently getting passed to gmstrftime which would assign them values of the current time.

The correct behaviour for the streamer in this instance is to just return the empty string
@liverpoolfc-fan liverpoolfc-fan merged commit bcdb0c8 into Replace-deprecated-gmstrftime-PHP-function May 30, 2023
@liverpoolfc-fan liverpoolfc-fan deleted the Return-empty-string-for-empty-date branch May 30, 2023 15:04
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.

1 participant