-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] TableCell Helper throws error if value is numeric #21429
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
But the |
@chalasr you are right ... but don't you think it's super common to use tables to display numeric values? |
I agree and don't see any technical drawback for changing this on 2.7. I just think that, theoretically, this should be considered as an enhancement since it involves to change |
If there was a string typehint, there would be no bug, as PHP would cast it for us (unless you use strict_types in your own code, but then it would be your responsibility to pass a string strictly, and your choice to use strict mode). I suggest casting in the constructor though (behaving the same than the string typehint) and keeping it documented as |
Mis-read the comment by @stof in symfony#21429
This PR was squashed before being merged into the 2.7 branch (closes #21430). Discussion ---------- Casting TableCell value to string. | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #21429 | License | MIT | Doc PR | PHP throws a catchable fatal error when the value from this method is used in strstr in the Table class. This fixes the error by casting to a string before returning the value. Commits ------- 1e5707f Casting TableCell value to string.
When using the TableCell helper in the Console Component, if I pass a numeric value as the first parameter of the constructor, then render the table, PHP throws an error:
Sample code:
Casting to a string (either in the TableCell helper, or before the value is passed to the constructor) fixes it.
The text was updated successfully, but these errors were encountered: