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

PHP 8.1 compatibility for 2.13 #4735

Merged
merged 1 commit into from
Aug 24, 2021

Conversation

derrabus
Copy link
Member

Q A
Type bug
BC Break no
Fixed issues N/A

Summary

The methods getDateTimeTzFormatString() and getDateTimeFormatString() will never return null in real implementations, but this is what the mock created in that test currently does.

Their return value is passed to DateTime::format(). Passing null to that method triggers a deprecation warning in PHP 8.1. With this PR, I'd like to fix the broken mock.

@morozov
Copy link
Member

morozov commented Jul 29, 2021

Note, DBAL 2.x is only supported in the part of improving the upgrade path to 3.x. I do not think we should be beating the dead horse and adding the support for PHP 8.1 thus increasing the supported version range from PHP 7.1 to 8.1.

@morozov morozov added the PHP label Jul 29, 2021
@derrabus
Copy link
Member Author

See my comment #4734 (comment)

Let's continue the discussion there.

@derrabus derrabus force-pushed the bugfix/broken-platform-mock branch 4 times, most recently from 868efb3 to 7cf7317 Compare August 7, 2021 15:54
@derrabus derrabus changed the title Fix broken platform mock PHP 8.1 compatibility for 2.13 Aug 7, 2021
@derrabus derrabus force-pushed the bugfix/broken-platform-mock branch from 7cf7317 to 7c9f37c Compare August 7, 2021 15:59

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Co-authored-by: Sergei Morozov <morozov@tut.by>
Signed-off-by: Alexander M. Turek <me@derrabus.de>
@derrabus derrabus force-pushed the bugfix/broken-platform-mock branch from 7c9f37c to ae37075 Compare August 7, 2021 16:03
@derrabus
Copy link
Member Author

derrabus commented Aug 7, 2021

@morozov I have backported several changes from #4682 as you suggested, and enabled PHP 8.1 in CI.

@greg0ire greg0ire requested a review from morozov August 7, 2021 18:35
@@ -24,7 +24,7 @@
abstract class AbstractAsset
{
/** @var string */
protected $_name;
protected $_name = '';
Copy link
Member

Choose a reason for hiding this comment

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

Since it comes from a newer major release, I'd double check if it can cause any BC break. Do such changes belong to a patch release at all or the support for a new backwards-incompatible PHP version deserves a minor release?

Copy link
Member Author

@derrabus derrabus Aug 10, 2021

Choose a reason for hiding this comment

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

All code that I could find that accesses this property already assumes that it is a string. In most cases, the value is used in a string concatenation operation which would implicitly cast it to an empty string if it were null.

@@ -104,7 +104,7 @@ public function testListForeignKeysFromExistingDatabase(): void
new Schema\ForeignKeyConstraint(
['log'],
'log',
[''],
[],
Copy link
Member

Choose a reason for hiding this comment

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

Since it comes from a newer major release, I'd double check if it can cause any BC break.

@morozov morozov merged commit d877a12 into doctrine:2.13.x Aug 24, 2021
@morozov
Copy link
Member

morozov commented Aug 24, 2021

Thanks, @derrabus!

@derrabus derrabus deleted the bugfix/broken-platform-mock branch August 24, 2021 22:20
@derrabus derrabus added this to the 2.13.3 milestone Sep 11, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants