-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Reintroduce support for PHP 7.1 and 7.2 #4386
Conversation
Depends on doctrine/coding-standard#226 due to composer.json platform constraint to 7.1.3 |
This looks like an unnecessary burden in terms of CI and dependencies. 👎 |
@morozov the testsuite runs a few minutes faster on Github than on Travis, there is surely enough space to add 2 jobs for 7.1, 7.2 with Sqlite. In terms of dependencies this PR doesn't change much, the coding-standard can be upped to 8.1.x again after the related PR is merged and released. Considering that 2.11 and 2.12 are stepping stones for migrating to 3 and don't get feature work done on them anymore this does not cause much problems. |
Why only SQLite? If we support a PHP version, we support and need to test all DB drivers with this version because many of them are shipped with PHP.
I don't get this point. In order to use DBAL 3, one has to use the corresponding PHP version. How does it help that the stepping-stone version supports an older PHP? It has to be upgraded anyway. |
I don't understand… Overall this looks like it will imply a lot of work for you in this PR, and for us when maintaining the repository because of the reasons you tweeted (we are needlessly constrained by some of our tools). Here is how I solved that issue in |
@morozov there is very little changes in database extension code between minor php versions. If you look at PDO Sqlite and PDO MySql for example, except cleanup of tests and build scripts really nothing changed between 2015 and 2019. Given that PHP upmerges bugfixes over quite long timeframes of 3 years this makes the extensions stable enough to risk a tiny blind spot. |
@greg0ire PHP is the most static dependency in applications, because the packages come from the operating system, wheras composer packages are much more flexible. If you are running based on Ubuntu LTSes or CentOS systems then usually your PHP code is quire current, but you are still working with an old PHP version. That means you can more easily upgrade your PHP dependencies than PHP itself. With this change somebody on a LTS PHP 7.1 could upgrade to DBAL 2.11, and then prepare the migration to DBAL 3 APIs, regardless of their longer running PHP upgrade cycle. |
What prevents the users of LTS distros from upgrading PHP first and then upgrading the DBAL? If the end goal is to get to the latest DBAL (otherwise, what is this all for?) then PHP has to be upgraded anyways. |
I don't see the argument how this is a lot of work for us, this PR took me 2 hours to work on, it will work as soon as the doctrine/coding-standard supports PHP 7.1. In addition it will also not take us a lot of work from here on, because there is no work to be done on the 2.11.x and 2.12.x branch anymore except bugfixing. This will not be affected by code running on PHP 7.3+ or 7.1+. The argument for raising the versions has constantly been that it puts a burden on us maintainers, and that new features should be used because they make life easier. yet it only took me 2 hours to get it working on 7.1 even though the code is not being target anymore for this version since 2.9. Not a single new feature or syntax was used, and no change was necessary in lib/ folder. In between many hundreds of commits were made that weren't made with 7.1 in mind at all. Meanwhile our users that are on older versions of PHP can't get the latest DBAL with potentially new fixes or features. |
You will need to run |
So again, the question still is:
So far, I'm absolutely not getting behind this. |
31dabf6
to
8d6a884
Compare
@morozov DBAL is the only Doctrine component that currently requires 7.3+, ORM is up with 7.2 - but that is also artificially set. Evrey other component requires only 7.1. The new MongoDB ODM requires 7.2, but i am not sure syntax wise how much they depend on it. Only recent LTS versions of distributions came out with 7.3 support (CentOS 8, Debian Buster), Ubuntu 18.04 is still widespread and only has 7.1. Composer version stats show "only" 50% usage by 7.3 and 7.4 and 7.2, 7.1 still have almost 40%: https://blog.packagist.com/php-versions-stats-2020-1-edition/ We really don't have a lot of work supporting our users on those old PHP versions, I don't have any problems investing my time into it, i am not asking you for your time on this. |
@@ -51,10 +51,7 @@ | |||
}, | |||
"bin": ["bin/doctrine-dbal"], | |||
"config": { | |||
"sort-packages": true, | |||
"platform": { | |||
"php": "7.3.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W/o the platform fixed, all dependency updates will have to be made on the lowest supported version. Otherwise, there's a risk of locking the dependencies that are not compatible with it.
It might be better to unset the platform version on CI before the update but have it committed in the repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When supporting this range of versions, you need to "composer update" anyways to get to the right packages. So the solution is probably rather to remove composer.lock in this step. With this setting in, you cannot get the code running locally with 7.1 and 7.2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But without this setting, the one performing a dependency update will have to use PHP 7.1. Otherwise, they will learn that the new resolution doesn't work with PHP 7.1 only on CI. Is there a Composer CLI switch to pass config.platform.php
at runtime?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This point is not relevant anymore since ce3421e composer.lock is not committed anymore and the Ci always fetches the latest packeges matching all constraints.
I think the usage statistics of https://github.com/orgs/doctrine/teams/doctrinecore/discussions/21 might make the maintenance burden this move might cause lighter. |
You should know that developers cannot always choose the PHP version they want. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@beberlei @morozov , this is very related to https://github.com/orgs/doctrine/teams/doctrinecore/discussions/21, I would love your input on that.
I see that helps solve the PHP 7.1 compatibility problem which I'm not interested in solving. In the rest of the cases, the approach with using |
|
Is it a practical or theoretical issue?
Agree.
I believe this is only the case when our library supports the PHP version lower than the dependencies support. So it's only valid if we support the unsupported PHP versions. |
It's very practical, I recall having issue with shared dependencies, in particular
Agree, and in the whole Doctrine ecosystem, they are more supported than not ATM. |
Hey everybody, just wanted to jump in here. Just to get to a point why this would be SUPER important for me / us at TYPO3 CMS (typo3.org). We've been using and loving Doctrine DBAL since we introduced it back then in 2017. So here's our situation: TYPO3 v10 has a PHP 7.2 min requirement (can also be installed via composer), and ships with Doctrine DBAL 2.10 (as this is the last version that supports PHP 7.2). Naturally we have to take HUGE steps to prepare OUR code base (that is TYPO3, and not even the thousands of TYPO3 plugins that are out there) to the deprecations and new code that was introduced in 2.11 and 2.12, in our TYPO3 v10. TYPO3 v11 we decided to have PHP 7.4 as minimum requirement, allowing us to bump to Doctrine DBAL 3.0. This would technically be possible, but there are a lot of really really really hard changes for us (e.g. final classes, and I know why you did that) on things we extended previously, or the Statement / Result Interface changes, which are semantically really really good), so we will have to do a lot of work to even get Doctrine 3.0 running. In any case, for us it's now not possible to even allow TYPO3 v10 with PHP8, because of Doctrine 2.12 (no PHP 7.2 support but PHP 8 support, but Doctrine 2.10 with no PHP 8 support). I know it's a burden for you folks, and I'm willing to help in any kind of ways - be it money or code (I've reached out to donations / sponsorships for the Doctrine project via email as suggested on the website several weeks ago with no answer), but I'd love to know if there are changes to make live easier for a lot of PHP folks:
I'd love to have as many people go with Doctrine DBAL 3.x as soon as possible, but given the current circumstances, looks like our project will have to stick with Doctrine 2.10 for a long time. I don't expect anything from you, because you've done a tremendous work, and I highly appreciate it. Nonetheless, just wanted to raise my voice, as I'm happy to see such a PR / issue popping up. |
Anything we can do to get this out or is it not yet considered to get merged? |
We just need some time, it will be happening |
@morozov @greg0ire This PR is done from my POV now As I haven't changed anything in lib/ and the composer "downgrades" constitute more a bugfix than a feature or improvement I personally would be fine to merge this into 2.12 as a bugfix instead of 2.13 to keep it simple, but releasing a new minor would be fine either. What do you think? I cleaned a few things up from the previous state, since the 2.12.x branch already did a few things w.r.t to Composer and Github Workflow simpliciatios. As soon as you have approved the PR and nothing is open from your side I will squash all the commits together. |
@@ -1691,12 +1690,11 @@ private function generateIdentifierName($identifier) | |||
protected function getCommentOnTableSQL(string $tableName, ?string $comment): string | |||
{ | |||
return sprintf( | |||
<<<'SQL' | |||
" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HEREDOCs were added in PHP 7.3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correction, moving the closing tag for now/heredocs to the same indentation as starting was added in 7.3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't moving the heredoc terminator to the beginning of the line have more or less the same effect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It applies a tab more for every line, but works.
imho it's better to not indent heredoc blocks.
return sprintf(
<<<SQL
EXEC sys.sp_addextendedproperty @name=N'MS_Description',
@value=N%s, @level0type=N'SCHEMA', @level0name=N'dbo',
@level1type=N'TABLE', @level1name=N%s
SQL,
$this->quoteStringLiteral((string) $comment),
$this->quoteStringLiteral($tableName)
);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@beberlei you could use git restore --source=origin/2.12.x lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php && git revert 9a8ea5e039268368d48f38c853a00840e8201bde
to make it 7.1-compatible, that way syntactic coloration is kept.
@@ -51,10 +51,7 @@ | |||
}, | |||
"bin": ["bin/doctrine-dbal"], | |||
"config": { | |||
"sort-packages": true, | |||
"platform": { | |||
"php": "7.3.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But without this setting, the one performing a dependency update will have to use PHP 7.1. Otherwise, they will learn that the new resolution doesn't work with PHP 7.1 only on CI. Is there a Composer CLI switch to pass config.platform.php
at runtime?
This is by no means a bugfix. The support for the old PHP version was dropped deliberately.
I think I stop caring about 2.x at this point. |
Yes, we should do the 2.13 anyways because it should also include the Deprecations #4535 PR and thats going to be larger. |
4d4db9c
to
24625f0
Compare
Summary
While working on the ORM support for PHP 8 (2.8 branch) realized i had to update PHP to 7.3 because DBAL requires it. Some investigation uncovered that this constraint is arbitrarily set, only minor syntax breaks in tests folder, not even in lib/src lead to errors. Straightforward to support with PHPUnit 7, 8 and 9 as well.
This PR makes DBAL 2.11 compatible with PHP 7.1 and 7.2 again in preparation for a future DBAL in the 2.x branch that includes the doctrine/deprecations component.
Individual parts:
LegacyAssertions
andMockBuilderProxy
to support running testsuite on phpunit 7 to 9