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

Bump minimum version to PHP 7.1 for Symfony 4 #22733

Merged
merged 3 commits into from
May 18, 2017

Conversation

fabpot
Copy link
Member

@fabpot fabpot commented May 17, 2017

Q A
Branch? master
Bug fix? no
New feature? yes-ish?
BC breaks? yes-ish?
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR n/a

.travis.yml Outdated
- php: 5.5
- php: 5.6
- php: 7.0
- php: 7.1.0
Copy link
Member

Choose a reason for hiding this comment

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

we should have a test running the fullstack testsuite on latest 7.1 too IMO

Copy link
Member

Choose a reason for hiding this comment

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

We have one, like in the previous branches: the deps=low line does it

Copy link
Member

Choose a reason for hiding this comment

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

deps=low is a per-component build, not a fullstack build. It does not test the requirements of the fullstack

Copy link
Member

@nicolas-grekas nicolas-grekas May 18, 2017

Choose a reason for hiding this comment

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

Unless I misunderstood what you meant, the line you're​ asking for doesn't exist on the SF3 lines. Thus we should not add it since it has never been required.

appveyor.yml Outdated
@@ -59,8 +57,6 @@ test_script:
- cd c:\php && 7z x php-7.1.3-Win32-VC14-x64.zip -y >nul && copy /Y php.ini-min php.ini
- cd c:\projects\symfony
- php phpunit src\Symfony --exclude-group benchmark,intl-data || SET X=!errorlevel!
- cd c:\php && 7z x php-5.5.9-nts-Win32-VC11-x86.zip -y >nul && copy /Y php.ini-min php.ini
- cd c:\projects\symfony
- SET SYMFONY_PHPUNIT_SKIPPED_TESTS=phpunit.skipped
- php phpunit src\Symfony --exclude-group benchmark,intl-data || SET X=!errorlevel!
Copy link
Member

Choose a reason for hiding this comment

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

this line should be removed, as it was the one running tests on 5.5.9. there is no need to run tests a second time on 7.1.3 without changing the php.ini (skipped tests will stay the same)

@stof
Copy link
Member

stof commented May 17, 2017

@fabpot when bumping the version to 4.0, you forgot to update all inter-component requirements to allow them to use the 4.0 version of other components in their own 4.0 versions

@nicolas-grekas
Copy link
Member

Looks like this requires us to drop HHVM, impossible to make it run on the CI. I'm fine with that personally.

@fabpot
Copy link
Member Author

fabpot commented May 18, 2017

@javiereguiluz
Copy link
Member

In addition to the poll, according to the latest global PHP stats, HHVM is used by 0.36% of PHP developers. The number is practically zero ... but maybe there are some high-profile clients there (Facebook is using it, Slack was thinking about using it, ...)

@Seldaek
Copy link
Member

Seldaek commented May 18, 2017

@javiereguiluz please don't forget that the stats are about number of composer installs.. That doesn't translate 1:1 to users, as some may do more installs than others. I think it's mostly interesting to see trends over time as exact point-in-time numbers can't be fully trusted.

@stof
Copy link
Member

stof commented May 18, 2017

@nicolas-grekas HHVM has 2 modes: PHP 5 mode and PHP 7 mode. IIRC, it runs in PHP 5 mode by default. We should add hhvm.php7.all = 1 in the HHVM INI file.

@nicolas-grekas
Copy link
Member

nicolas-grekas commented May 18, 2017

I just tried again this mode, same failure. We'd need a php 7.1 mode. There is just no way currently to make hhvm run on a 7.1 code base. HHVM advertises itself as 70099 so even Composer cant.
Just dropping for now.

@stof
Copy link
Member

stof commented May 18, 2017

Have you tried using the latest HHVM rather than 3.18 ? they may have updated their PHP 7 mode to expose it as 7.1 later

@nicolas-grekas
Copy link
Member

Yep, 3.19 locally, same result

.travis.yml Outdated
# Load fixtures
if [[ ! $skip ]]; then
sleep 5
Copy link
Member

Choose a reason for hiding this comment

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

why sleeping ?

Copy link
Member

Choose a reason for hiding this comment

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

Previously we did not require it because we had some extensions to compile, which gave some time for the ldap sever to start in the background. But now we have to sleep a bit to let it start.

composer.json Outdated
@@ -16,7 +16,7 @@
}
],
"require": {
"php": ">=5.5.9",
"php": "^7.1.0",
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't we keep the ">=" operator?

Copy link
Member

Choose a reason for hiding this comment

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

Well, this constraint forbids using the existing version with PHP 8. I think it is fine. I'm almost sure that the current code will not work with PHP 8 (PHP major versions will break BC for sure if we look at the existing releases where even minor versions have a hard time preserving BC fully). This way, when PHP 8 starts to come out, we can update our requirements once we start testing it with PHP 7

Copy link
Contributor

Choose a reason for hiding this comment

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

This way exclude PHP8, IMO it's a good thing and avoid future PR to exclude it and then re-enable PHP8 after BC breaks corrected.

@nicolas-grekas nicolas-grekas force-pushed the 4.0-PHP-bump branch 2 times, most recently from fb64a47 to b930c86 Compare May 18, 2017 09:19
@@ -83,11 +77,11 @@ before_install:
echo extension = ldap.so >> $INI
echo extension = redis.so >> $INI
echo extension = memcached.so >> $INI
[[ $PHP = 5.* ]] && echo extension = mongo.so >> $INI
[[ $PHP = 5.* ]] && echo extension = memcache.so >> $INI
#echo extension = mongodb.so >> $INI
Copy link
Member

Choose a reason for hiding this comment

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

the test suite does not pass yet with mongodb - but this is not master specific so should be handled on a lower branch

@nicolas-grekas nicolas-grekas force-pushed the 4.0-PHP-bump branch 4 times, most recently from 1482630 to 809736f Compare May 18, 2017 11:40
"symfony/http-foundation": "~3.3|~4.0.0",
"symfony/http-kernel": "~3.3|~4.0.0",
"symfony/cache": "~3.4|~4.0",
"symfony/class-loader": "~3.4|~4.0",
Copy link
Member

Choose a reason for hiding this comment

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

The ClassLoader component won't have a 4.0 release.

Copy link
Member

Choose a reason for hiding this comment

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

yeah, but the requirement will be dropped entirely when removing deprecated code anyway (only the BC layer requires it), so it is fine for now

"symfony/translation": "~2.8|~3.0|~4.0.0",
"symfony/var-dumper": "~3.3|~4.0.0",
"symfony/browser-kit": "~3.4|~4.0",
"symfony/class-loader": "~3.4|~4.0",
Copy link
Member

Choose a reason for hiding this comment

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

The ClassLoader component won't have a 4.0 release.

Copy link
Member

Choose a reason for hiding this comment

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

let's do that in the next PR removing class loader, here it's a batch change

Copy link
Member

Choose a reason for hiding this comment

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

fair enough

},
"suggest": {
"symfony/browser-kit": "",
"symfony/class-loader": "",
Copy link
Member

Choose a reason for hiding this comment

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

should be removed

Copy link
Member

Choose a reason for hiding this comment

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

removed

@nicolas-grekas
Copy link
Member

Thank you @fabpot.

@nicolas-grekas
Copy link
Member

;)

@nicolas-grekas nicolas-grekas merged commit 4758c2c into symfony:master May 18, 2017
nicolas-grekas added a commit that referenced this pull request May 18, 2017
… dunglas, nicolas-grekas)

This PR was merged into the 4.0-dev branch.

Discussion
----------

Bump minimum version to PHP 7.1 for Symfony 4

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes-ish?
| BC breaks?    | yes-ish?
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Commits
-------

4758c2c Tweak travis and appveyor for Symfony 4
6633c8b Allow individual bridges, bundles and components to be used with 4.0
c850733 bumped minimum version to PHP 7.1
@mofarrell
Copy link

Is this just a version number issue? HHVM can change what version number it gives back. Are there some PHP7 features we haven't implemented yet that are making it burdensome for Symfony to support HHVM?

@nicolas-grekas
Copy link
Member

nicolas-grekas commented May 18, 2017

That's not the only issue because even with the branches that support php5.5 thus hhvm, once you enable the php7 mode the test suite fails to just run, with strange type issues being reported.
It's quite easy to reproduce: just try running the ./phpunit script in this mode on e.g. 3.2.

@mofarrell
Copy link

We have an suboption to PHP7 that can disable the strict type checks. The strict type checks are broken in some cases, and we have that on our radar. It happens to not be trivial to fix, and also currently not at the top of our priority list.
The option is hhvm.php7.scalar_types=0

nicolas-grekas added a commit that referenced this pull request May 22, 2017
This PR was squashed before being merged into the 4.0-dev branch (closes #22820).

Discussion
----------

Remove PHP < 7.1.3 code

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | yes
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets | #22733
| License       | MIT
| Doc PR        | N/A

Commits
-------

7091fb4 Remove PHP < 7.1.3 code
@SenseException
Copy link
Contributor

Will Symfony 4 use scalar type hints and return types? This would be a break to the 3.x versions, but with a major release the best time to introduce them.

@stof
Copy link
Member

stof commented May 22, 2017

@SenseException we will use them in new APIs. But we won't add them in existing interfaces, as this would be a BC break without a progressive upgrade path, and so the drawbacks are much bigger than the benefits for the community.

Btw, the master branch already contains a scalar typehint in at least one place (the last argument in

public function registerListener($key, $logoutPath, $csrfTokenId, $csrfParameter, CsrfTokenManagerInterface $csrfTokenManager = null, string $context = null)
)

@SenseException
Copy link
Contributor

@stof I'm aware that this would be a bold move, but your argument also fits to a future Symfony 5, 6, 7 and so on. Implementing an old Symfony 4 interface forces a user to omit type hints even when it is a new project that never was on version 3 before.

But it seems that a return type can be added to the class implementing an interface that misses that type: https://3v4l.org/BHlVW.

@sstok
Copy link
Contributor

sstok commented May 28, 2017

@SenseException yes you can add return types to implementations, even when the interface doesn't require them. But doing this would be something for Symfony 5 so developers can first upgrade to Symfony 4, add the return-types, and then when Symfony 5 is released they can safely upgrade.

@SenseException
Copy link
Contributor

So Symfony 5 is going to have the type hints and return types? I just want to read when Symfony and its components arr going to use modern (2017) PHP.

@dunglas
Copy link
Member

dunglas commented May 29, 2017

We'll use type hints and return types for the new code. It's not possible without a BC break for the old one (and it has very little interest because, as pointed out by other people, you can use type hints in your code and our code base is well tested).

@javiereguiluz
Copy link
Member

@SenseException in addition to what Kévin told you, we can only use PHP 7 features for new code added to Symfony. For the existing code, we can't use PHP 7 until November 2021 (as explained in this comment: #22862 (comment))

@SenseException
Copy link
Contributor

@javiereguiluz Thank you for pointing me to the comment and the answer to my question.

@fabpot fabpot mentioned this pull request Oct 19, 2017
@@ -63,7 +63,7 @@

const VERSION = '4.0.0-DEV';
const VERSION_ID = 40000;
const MAJOR_VERSION = 4;
const MAJOR_VERSION = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you change this?

Copy link
Contributor

Choose a reason for hiding this comment

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

That seems like a bug in the release script 😛

Copy link
Contributor

Choose a reason for hiding this comment

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

It was already fixed in ce519b6

joshtrichards pushed a commit to joshtrichards/symfony-finder that referenced this pull request Apr 26, 2024
This PR was squashed before being merged into the 4.0-dev branch (closes #22820).

Discussion
----------

Remove PHP < 7.1.3 code

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | yes
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets | symfony/symfony#22733
| License       | MIT
| Doc PR        | N/A

Commits
-------

54adaf8 Remove PHP < 7.1.3 code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.