-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Towards PHP 7 compatibility #14086
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
Comments
For Translation component: #14087 |
The Security test seems to be a phpunit issue |
@dosten Did you see an open issue at the PhpUnit repo? |
@xabbuh No, i see that the error come from here https://github.com/symfony/security-core/blob/master/Tests/Authentication/Token/RememberMeTokenTest.php#L55-L62. |
That test doesn't make sense. You don't test against phpunit exceptions and even testing fatal errors that are ensured by the language is even worse. Then we would have to add a lot of tests. I'll fix it. |
See #14088 |
This PR was merged into the 2.3 branch. Discussion ---------- remove useless tests that fail in php 7 | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #14086 for Security and Form component | License | MIT | Doc PR | - `@expectedException \PHPUnit_Framework_Error` doesn't catch php fatal errors for wrong types in php 7. But these test are also pretty useless anyway. Then we would have to add a lot of tests for all arguments that are typehinted. Let's just remove these tests. Commits ------- 59cab27 remove useless tests that fail in php 7
This PR was merged into the 2.3 branch. Discussion ---------- [Translator] fix test for php 7 compatibility | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #14086 for Translation component | License | MIT | Doc PR | - Commits ------- 02b829f [Translator] fix test for php 7 compatibility
See #14107 for the remaining work |
This PR was merged into the 2.3 branch. Discussion ---------- Add parsing of hexadecimal strings for PHP 7 | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #14086 | License | MIT | Doc PR | n/a PHP 7 does not handle the hexadecimal notation in is_numeric checks anymore, so the detection needs to be implemented explicitly. With this change, we should have a passing testsuite on PHP 7 Commits ------- e848040 Add parsing of hexadecimal strings for PHP 7
Reopening because we are not there yet. We have some classes using reserved keywords in the Validator component (the We also have some test failures in the Debug, Translation and VarDumper components |
See #14204 for VarDumper For Debug (and maybe also VarDumper), we'll have to wait until the new exception mechanism is stabilized |
I think #14228 is ready now, how are we doing otherwise with this issue? |
Just crossposting @nicolas-grekas comments from #14228 which seems to help the tests a bit further along and exposes a fatal error for the Validator component. Possibly a PHP 7 bug or maybe it's something we can code around. Anyone have a PHP 7 setup to debug this on?: https://travis-ci.org/symfony/symfony/jobs/61229099#L560 |
…straints as they are reserved words in PHP7 (stefan.r) This PR was merged into the 2.3 branch. Discussion ---------- Add PHP7 compatible versions for the Null/True/False constraints as they are reserved words in PHP7 | Q | A | ------------- | --- | Bug fix? | PHP7 compatibility | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | N/A | Fixed tickets | N/A - helps towards #14086 | License | MIT Null, True and False are reserved words in PHP7: https://wiki.php.net/rfc/reserve_more_types_in_php_7 Commits ------- 44edbdf Fixed compatibility with PHP7 and up by introducing new constraints (IsNull, IsTrue, IsFalse) and related validators (IsNullValidator, IsTrueValidator, IsFalseValidator)
…straints as they are reserved words in PHP7 (stefan.r) This PR was merged into the 2.3 branch. Discussion ---------- Add PHP7 compatible versions for the Null/True/False constraints as they are reserved words in PHP7 | Q | A | ------------- | --- | Bug fix? | PHP7 compatibility | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | N/A | Fixed tickets | N/A - helps towards symfony/symfony#14086 | License | MIT Null, True and False are reserved words in PHP7: https://wiki.php.net/rfc/reserve_more_types_in_php_7 Commits ------- 44edbdf Fixed compatibility with PHP7 and up by introducing new constraints (IsNull, IsTrue, IsFalse) and related validators (IsNullValidator, IsTrueValidator, IsFalseValidator)
…straints as they are reserved words in PHP7 (stefan.r) This PR was merged into the 2.3 branch. Discussion ---------- Add PHP7 compatible versions for the Null/True/False constraints as they are reserved words in PHP7 | Q | A | ------------- | --- | Bug fix? | PHP7 compatibility | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | N/A | Fixed tickets | N/A - helps towards symfony/symfony#14086 | License | MIT Null, True and False are reserved words in PHP7: https://wiki.php.net/rfc/reserve_more_types_in_php_7 Commits ------- 44edbdf Fixed compatibility with PHP7 and up by introducing new constraints (IsNull, IsTrue, IsFalse) and related validators (IsNullValidator, IsTrueValidator, IsFalseValidator)
…straints as they are reserved words in PHP7 (stefan.r) This PR was merged into the 2.3 branch. Discussion ---------- Add PHP7 compatible versions for the Null/True/False constraints as they are reserved words in PHP7 | Q | A | ------------- | --- | Bug fix? | PHP7 compatibility | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | N/A | Fixed tickets | N/A - helps towards symfony/symfony#14086 | License | MIT Null, True and False are reserved words in PHP7: https://wiki.php.net/rfc/reserve_more_types_in_php_7 Commits ------- 44edbdf Fixed compatibility with PHP7 and up by introducing new constraints (IsNull, IsTrue, IsFalse) and related validators (IsNullValidator, IsTrueValidator, IsFalseValidator)
Remaining issues on PHP 7:
|
any update ? |
@changloong We've fixed a bunch of other errors, but not all of them. If you have some time, can you help us finish this one? |
Hi @fabpot I think I can work on this and make some pull request when I pass my local test:) |
The debug component needs updating to correctly display throwables. This came up in laravel 5.2. |
@GrahamCampbell That's probably something for @nicolas-grekas :) |
Great. :) |
I'll fix that asap :-)
|
Loosing the exception typehint from non-private methods on non-final classes is a bigish breaking change though. Does this mean many of the changes can only be made on symfony 3.0? |
@stof I met some issues with ParameterBag / ContainerBuilder too. I will try to make a relevant issue asap :/ |
…-grekas) This PR was merged into the 2.3 branch. Discussion ---------- [php7] Fix for substr() always returning a string | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #14086 | License | MIT | Doc PR | - This should be the last required fix for PHP7 support. The patch in the debug component is a workaround for a bug in PHP7 (http://3v4l.org/8rm9B) that is going to be fixed soon (@jpauli power). Commits ------- 77ee866 [php7] Fix for substr() always returning a string
…-grekas) This PR was merged into the 2.7 branch. Discussion ---------- [php7] Fix for substr() always returning a string | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #14086 | License | MIT | Doc PR | - The remaining failures will stop once https://bugs.php.net/bug.php?id=70159 is fixed ([patch pending](php/php-src@a28115c)). Commits ------- d6dfe98 [php7] Fix for substr() always returning a string
…ekas) This PR was merged into the 2.3 branch. Discussion ---------- [travis] Build phpunit with local components | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #14086 | License | MIT | Doc PR | - The tests for PHP7 currently fail because travis ships with a phar phpunit that embeds the yaml components. This one takes priority over the one in the repo. But it is outdated. The issue arose with PHP7 tests but could have happen with any build. Commits ------- ce2a371 [travis] Build phpunit with local components
Sorry if my question is not in the right place but this discussion made me realize that I cannot upgrade my project to PHP7 as I'm using Symfony 2.8. I just checked on Github and all 2.8 related tags have the old names for the constraints (True, False, Null...). I was surprised because I had read this post before checking the code: http://symfony.com/blog/symfony-achieves-100-php7-compatibility If that's the case, do I have to upgrade to Symfony 3 in order to upgrade to PHP7? As Symfony 3.1 is not a LTS I thought it wasn't a good idea to use it on production. Am I right? How are you guys doing to have both a LTS Symfony version and PHP7 on production? Thanks! |
Symfony 2.8 (and even 2.7) are compatible with PHP7. as you can see on github, the class |
@anacicconi All releases before Symfony 3.0 ship with both the legacy and the |
Oh, ok! I didn't understand that. So I can keep 2.8. Just out of curiosity, is it recommended to use Symfony3.1 on production? |
sure |
@anacicconi sure. we are using it ;) |
Ok, thanks ;) |
PHP 7 is meant to be released at the end of the year. At this time, our supported versions will be 2.3, 2.6 (security-only), 2.7 and 3.0. Each of these versions will need to be compatible with PHP 7.
Currently, Travis is running our testsuite against PHP 7 nightly, showing that this goal is not yet reached.
A bunch of tests are triggering fatal errors. We should debug the reason for that, to see whether it is a regression in PHP (which should be reported to them as soon as possible) or something related to one of the PHP 7 BC breaks, requiring to fix our code:
string
cannot be used as class name (reserved because of scalar type hints)Except these components where we cannot run tests because of these errors, the only remaining failures on PHP 7 for Symfony 2.3 (you can check Travis builds for other branches to see whether there are more in newer versions) are the parsing of hexadecimal numeric strings in XmlUtils and Yaml because PHP 7 does not cast them as int anymore. We will need to implement this conversion separately.
It would be great to start working on the PHP 7 compatibility soon (especially for the issue with class names being reserved because it might require deprecating a class name in favor of a new one, which should be done before the 2.7 release)
The text was updated successfully, but these errors were encountered: