Fixed bug GH-20745 ("Casting out of range floats to int" applies to strings)#20746
Merged
bwoebi merged 1 commit intophp:PHP-8.5from Dec 29, 2025
Merged
Fixed bug GH-20745 ("Casting out of range floats to int" applies to strings)#20746bwoebi merged 1 commit intophp:PHP-8.5from
bwoebi merged 1 commit intophp:PHP-8.5from
Conversation
2a7ff59 to
95e6e50
Compare
…o strings) This reverts the warning for float-strings, to whose it never should have been applied in the first place.
95e6e50 to
b77634e
Compare
ndossche
reviewed
Dec 21, 2025
Member
ndossche
left a comment
There was a problem hiding this comment.
This looks fine from a technical PoV. I'll leave the decision with Gina however.
mvorisek
reviewed
Dec 21, 2025
| int(3) | ||
| int(3) | ||
|
|
||
| Warning: The float-string "1.0E+121" is not representable as an int, cast occurred in %s on line %d |
Contributor
There was a problem hiding this comment.
IMO the source type should not matter, as long as the input is not representable in target type, the warning should be consistent.
Girgias
approved these changes
Dec 26, 2025
Member
Girgias
left a comment
There was a problem hiding this comment.
I don't remember why I did this, might have been because I based my patch on the non-numeric warning one so added them everywhere those exist or I was hitting some weird edge cases.
I'm fine with this fix. Not sure if we need RM blessing for this (as the new rules are hella confusing)
nyrzhun
pushed a commit
to nyrzhun/php-src
that referenced
this pull request
Feb 2, 2026
The `zend_string *s` parameter became unused after commit f754ffa (phpGH-20746) removed the `zend_oob_string_to_long_error()` calls. This fixes an unused-parameter compiler warning and updates a stale comment in zend_operators.c that incorrectly stated this function can emit warnings.
nyrzhun
added a commit
to nyrzhun/php-src
that referenced
this pull request
Feb 2, 2026
The `zend_string *s` parameter became unused after commit f754ffa (phpGH-20746) removed the `zend_oob_string_to_long_error()` calls. This fixes an unused-parameter compiler warning and updates a stale comment in zend_operators.c that incorrectly stated this function can emit warnings.
nyrzhun
added a commit
to nyrzhun/php-src
that referenced
this pull request
Feb 2, 2026
The `zend_string *s` parameter became unused after commit f754ffa (phpGH-20746) removed the `zend_oob_string_to_long_error()` calls. This fixes an unused-parameter compiler warning and updates a stale comment in zend_operators.c that incorrectly stated this function can emit warnings.
nyrzhun
added a commit
to nyrzhun/php-src
that referenced
this pull request
Feb 2, 2026
The `zend_string *s` parameter became unused after commit f754ffa (phpGH-20746) removed the `zend_oob_string_to_long_error()` calls. This fixes an unused-parameter compiler warning and updates a stale comment in zend_operators.c that incorrectly stated this function can emit warnings.
nyrzhun
added a commit
to nyrzhun/php-src
that referenced
this pull request
Feb 2, 2026
The `zend_string *s` parameter became unused after commit f754ffa (phpGH-20746) removed the `zend_oob_string_to_long_error()` calls. This fixes an unused-parameter compiler warning and updates a stale comment in zend_operators.c that incorrectly stated this function can emit warnings.
nyrzhun
added a commit
to nyrzhun/php-src
that referenced
this pull request
Feb 3, 2026
The `zend_string *s` parameter became unused after commit f754ffa (phpGH-20746) removed the `zend_oob_string_to_long_error()` calls. This fixes an unused-parameter compiler warning and updates a stale comment in zend_operators.c that incorrectly stated this function can emit warnings.
nyrzhun
added a commit
to nyrzhun/php-src
that referenced
this pull request
Feb 4, 2026
The `zend_string *s` parameter became unused after commit f754ffa (phpGH-20746) removed the `zend_oob_string_to_long_error()` calls. This fixes an unused-parameter compiler warning and updates a stale comment in zend_operators.c that incorrectly stated this function can emit warnings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This reverts the warning for float-strings, to whose it never should have been applied in the first place.
@Girgias We did not vote on that. The PR was done after the RFC, and never up for consideration at vote time.
In fact, during discussion time, it was even the topic: https://news-web.php.net/php.internals/128293 - but it was clarified (by someone else) that it's only about floats, not float-strings.
Feel free to propose it again for PHP 8.6 - I personally think it only should apply to implicit casts, in line with https://wiki.php.net/rfc/implicit-float-int-deprecate.
But for PHP 8.5 we should revert this ad-hoc addition to the first PHP 8.5 RC.
From my point of view this is a regression, where nobody agreed on break compatibility here.
With respect to the PR, I retain the zend_oob_string_to_long_error function, as removing it would probably break ABI, but removing all callers should be sufficient.