Skip to content

Remove ZEND_DVAL_TO_LVAL_CAST_OK #9215

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

Merged
merged 2 commits into from
Aug 4, 2022

Conversation

zeriyoshi
Copy link
Contributor

As far as I can see, this operation should always use the slow (right) method, and the results seem to be wrong when ZEND_DVAL_TO_LVAL_CAST_OK is enabled.

I see, this macro seems to be always disabled in Linux / gcc and macOS 10.15 / clang (13.0.0) environments. (If clang is updated, the autoconf check succeeds and it is enabled. The test always fails because it does not work as expected)

Are there cases where this macro is correctly enabled?

Blocker: #9087

@cmb69
Copy link
Member

cmb69 commented Aug 1, 2022

As far as I can see, this operation should always use the slow (right) method, and the results seem to be wrong when ZEND_DVAL_TO_LVAL_CAST_OK is enabled.

Given that casting an out of range float to an integer is undefined behavior, I think you're right.

Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be back-ported to PHP 8.0?

@cmb69
Copy link
Member

cmb69 commented Aug 1, 2022

Should this be back-ported to PHP 8.0?

I'd say, yes.

@zeriyoshi
Copy link
Contributor Author

@cmb69
I don't think zend_dval_to_lval_slow is an appropriate name, but since it is declared as ZEND_API, should I keep it?
Also, is it correct that the backport should be up to the version in the Active Support status (PHP 8.0)?

@cmb69
Copy link
Member

cmb69 commented Aug 3, 2022

We need to keep zend_dval_to_lval() anyway, at least for PHP-8.0 and PHP-8.1, so it would make sense to just forward to zend_dval_to_lval_slow() from there. For master, we could actually remove zend_dval_to_lval_slow() (that would need a note in UPGRADING.INTERNALS).

As far as I can see, this operation should always use the _slow method, and the results seem to be wrong when ZEND_DVAL_TO_LVAL_CAST_OK is enabled.
@zeriyoshi zeriyoshi force-pushed the remove_dval_to_lval_cast_ok branch from d2bb76f to c162a73 Compare August 4, 2022 04:39
@zeriyoshi zeriyoshi changed the base branch from master to PHP-8.0 August 4, 2022 04:40
@zeriyoshi zeriyoshi force-pushed the remove_dval_to_lval_cast_ok branch from c162a73 to c77a8c3 Compare August 4, 2022 04:40
@zeriyoshi
Copy link
Contributor Author

@cmb69 @iluuu1994
I understand. If there are no objections, I will merge this MR into PHP-8.0 and later at midnight (GMT+9). After that, I will create a PR against master to refactor API.

(I am newbie to this process, so I will @ it just in case)

@cmb69
Copy link
Member

cmb69 commented Aug 4, 2022

@zeriyoshi, yes, that makes sense. But don't forget to still merge upwards (first into PHP 8.1, and then into "master").

@zeriyoshi zeriyoshi merged commit 3725717 into php:PHP-8.0 Aug 4, 2022
@zeriyoshi zeriyoshi deleted the remove_dval_to_lval_cast_ok branch August 4, 2022 17:58
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.

4 participants