Skip to content

Casting TableCell value to string. #21430

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

Closed

Conversation

jaydiablo
Copy link
Contributor

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.

PHP throws a catchable fatal error when the value from this method is
used in strstr in the Table class.
@xabbuh
Copy link
Member

xabbuh commented Jan 27, 2017

Taking it strictly the current behaviour is not wing as the TableCell constructor documents that it expects a string. In the other hand does this change not do any harm. So +0 from me on the proposed change.

@chalasr
Copy link
Member

chalasr commented Jan 27, 2017

Looks like a feature to me, it is the expected behavior on 2.7.

@nicolas-grekas
Copy link
Member

👍 on 2.7, minor tweak to me

@nicolas-grekas nicolas-grekas added this to the 2.7 milestone Jan 29, 2017
@fabpot
Copy link
Member

fabpot commented Jan 30, 2017

I would only cast for ints then.

@xabbuh
Copy link
Member

xabbuh commented Feb 3, 2017

@jaydiablo Can you make the change @fabpot asked for? :)

@jaydiablo
Copy link
Contributor Author

Sure, what about other numeric values that aren't ints? Like a float.

Should we wrap the cast in something like:

if (is_numeric($value) && !is_string($value)) {

?

@fabpot
Copy link
Member

fabpot commented Feb 3, 2017

My point was that I don't want to have a cast to a string for objects for instance.

@fabpot
Copy link
Member

fabpot commented Feb 3, 2017

Thank you @jaydiablo.

fabpot added a commit that referenced this pull request Feb 3, 2017
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.
@fabpot fabpot closed this Feb 3, 2017
@jaydiablo jaydiablo deleted the console-tablecell-numeric-fix branch February 4, 2017 06:09
This was referenced Feb 6, 2017
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.

6 participants