-
Notifications
You must be signed in to change notification settings - Fork 91
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
[BUGFIX] Cast string values to float or int #773
Conversation
Can you add some more test cases to cover this? |
I'm not sure why the tests are not failing without this patch. |
I had the same problem at first: The problem only occurs with variables that are passed as string. The existing test cases use integers. |
Nope, thats not it. I removed my patch and added a var_dump
to src/Core/Parser/SyntaxTree/Expression/MathExpressionNode.php and run ./vendor/bin/phpunit -v This is the result:
The tests are using both int and string and should fail, but aren't. String + String works fine in the unit test but not in a real project. |
I can get the test to fail only if I add:
And change:
to
Here the test result:
If I apply my patch now all errors are gone again. |
Okay... A functional test with the exact code from the issue passes. I also tested it in a TYPO3 v12 project in development context, no warnings. Maybe you need to check first under which conditions this is reproducible in a TYPO3 project (or otherwise). Nevertheless, it can't hurt to add the test cases. |
If it helps, this is the passing functional test: |
My project is Typo3 v11 and I've tested it with development context and live context. I don't think we need new tests, as the existing tests are already passing strings to the function. |
I just set up typo3 v11 with ddev (php 8.2, development context, TYPO3's debug options enabled). I can't reproduce the error. Could you look into how your setup might differ from the default setup? Maybe we need to change something in the Fluid testing setup to cover your configuration. |
I run into this error today and found this issue. My local dev environment is a Docker and composer setup. TYPO3 Version 11.5.27 Which is different from the one in the issue. So it can't be that. As I also can't reproduce this with the UnitTest and only in a working project, my guess is that some setting related to strong types must be different. That is why I have opened #778. If you apply both, all tests are passing again. |
Hi, any news on how to progress here? |
The change is fine codewise, I suppose. I don't fully understand why the tests did not find this, but I don't think it is currently necessary to fully understand this, either. We'll merge the patch and will harden the class as prepared. |
The test would have found it with this #778 |
@tlueder I need to rebase or merge the PR with current main before merging. Unfortunately, pushing to your branch is denied for me. I'll thus cherry-pick your changes to an own branch now and will push as new PR. |
Ok, or I could have rebased it for you, what ever gets the job done. |
1345d52
to
0bb8a86
Compare
Thanks! |
Fixes #672