-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Fix implicit to and from bool type juggling #60890
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
Conversation
Hey! To help keep things organized, we don't allow "Draft" pull requests. Could you please click the "ready for review" button or close this PR and open a new one when you are done? Note that a pull request does not have to be "perfect" or "ready for merge" when you first open it. We just want it to be ready for a first review. Cheers! Carsonbot |
src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php
Outdated
Show resolved
Hide resolved
Some of those changes are definitely legitimate as they are clearly mistakes in the existing code that went unnoticed (static analysis could catch them, but our CI only reports new violations in each PR and we never worked on fixing issues reported in existing code):
Those could definitely be submitted directly (against the 6.4 branch). We have other cases (when using preg_match or bitwise comparisons) where we indeed rely on the implicit type juggling of the return type, which are legitimate changes once PHP deprecates those type juggling rules (static analysis probably also prevents them for new code). As reported in my review comments, the changes done in the DI component look wrong to me (and are the cause of failures in the CI as well) |
Yes I had figured out the cause, but I was having some other local failures before that made it difficult to waddle through stuff. There is also a bug in master on php-src which is not helping me to get a good overview of the situation. Question about |
d89795e
to
b812e26
Compare
@@ -336,7 +336,7 @@ public function testProcessFailsOnPassingClassToScalarTypedParameter() | |||
(new CheckTypeDeclarationsPass(true))->process($container); | |||
} | |||
|
|||
public function testProcessSuccessOnPassingBadScalarType() | |||
public function xtestProcessSuccessOnPassingBadScalarType() |
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 skipping this test ?
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.
I stole this from @nicolas-grekas WIP commit: nicolas-grekas@02e3881
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.
🙈
src/Symfony/Bundle/TwigBundle/Tests/Functional/AttributeExtensionTest.php
Show resolved
Hide resolved
a249be4
to
e2cdfd7
Compare
src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php
Outdated
Show resolved
Hide resolved
@@ -65,7 +65,7 @@ public static function provideTransformations() | |||
public function testTransform($from, $to, $locale) | |||
{ | |||
// Since we test against other locales, we need the full implementation | |||
IntlTestHelper::requireFullIntl($this, false); | |||
IntlTestHelper::requireFullIntl($this, null); |
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.
I suggest omitting null
entirely as it is optional (as done in some of the impacted files btw).
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.
I'll do that when I have time and have gone through the other issues.
Not sure what those asserts are doing however
There is no need to test false as this is a PHP engine behaviour to cast to empty string
There is no need to test false as this is a PHP engine behaviour to cast to empty string
There are a few cases where I don't seem to be able to find the root cause. A big one is:
|
This is possibly something that should be fixed on PHP's side
e2cdfd7
to
fa063a6
Compare
This PR was squashed before being merged into the 6.4 branch. Discussion ---------- Fix various bool-type coercions | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no <!-- if yes, also update UPGRADE-*.md and src/**/CHANGELOG.md --> | Issues | | License | MIT This is cherry-picking some of the commits from #60890 which are basically bugs. Not sure what the commit naming policy is so do let me know if you want me to manually rebase and rename commits following some guidelines. Commits ------- b3d30e3 Fix various bool-type coercions
@Girgias you can define the |
Continued in #61203, thanks for submitting! |
This is to see part of the impact of php/php-src#18879, and it seems to be finding some bugs in tests or SF itself, but I would need confirmation from other people.
This is very much W.I.P. and I might use CI to check that my changes are correct as I have some local test failures even just running with 8.4.8
I am well aware the commit messages are kinda useless at the moment, but they are somewhat self-contained, so they can be looked at individually.