Skip to content
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

PHP 8.0 - add fdiv() function polyfill #200

Merged
merged 1 commit into from Jan 14, 2020
Merged

Conversation

@IonBazan
Copy link
Contributor

IonBazan commented Nov 26, 2019

This PR adds simple fdiv() implementation by suppressing warnings on the division, just like in original implementation: php/php-src@e35bdb4

This feature works only on PHP 7+ because suppressing warnings does not produce valid results and casting to string does not detect negative zero on older versions.
Full logic implementation is available at https://github.com/IonBazan/polyfill/blob/php8-php5/src/Php80/Php80.php but lacks negative-zero detection for PHP 5. If anyone figures out how to detect it, we can simply replace LogicException with it.

@IonBazan IonBazan force-pushed the IonBazan:php8 branch 3 times, most recently from f8af237 to 2c6fcfd Nov 26, 2019
src/Php80/Php80.php Outdated Show resolved Hide resolved
src/Php80/composer.json Outdated Show resolved Hide resolved
src/Php80/composer.json Show resolved Hide resolved
src/Php80/Php80.php Show resolved Hide resolved
@stof

This comment has been minimized.

Copy link
Member

stof commented Nov 26, 2019

@IonBazan your idea based on var_dump will now work when xdebug overloads it (and it might not work on Windows due to line endings, but that's easier to solve).

@IonBazan IonBazan force-pushed the IonBazan:php8 branch 5 times, most recently from a976252 to a0cfdb1 Dec 5, 2019
@IonBazan

This comment has been minimized.

Copy link
Contributor Author

IonBazan commented Dec 5, 2019

@nicolas-grekas @stof changes applied. I decided to drop PHP 5 because found it impossible to detect negative zeros on it.

src/Php80/composer.json Outdated Show resolved Hide resolved
@IonBazan IonBazan force-pushed the IonBazan:php8 branch from 80800fd to febf1b8 Dec 20, 2019
@IonBazan IonBazan requested review from nicolas-grekas and stof Dec 20, 2019
@nicolas-grekas nicolas-grekas force-pushed the IonBazan:php8 branch from febf1b8 to f0b5e2c Jan 13, 2020
Copy link
Member

nicolas-grekas left a comment

@fabpot can you please register a new symfony/polyfill-php80 repository+package based on a subtree-split of the src/Php80 folder?

@nicolas-grekas

This comment has been minimized.

Copy link
Member

nicolas-grekas commented Jan 14, 2020

Thank you @IonBazan.

nicolas-grekas added a commit that referenced this pull request Jan 14, 2020
This PR was merged into the 1.13-dev branch.

Discussion
----------

PHP 8.0 - add fdiv() function polyfill

This PR adds simple `fdiv()` implementation by suppressing warnings on the division, just like in original implementation: php/php-src@e35bdb4

This feature works only on PHP 7+ because suppressing warnings does not produce valid results and casting to string does not detect negative zero on older versions.
Full logic implementation is available at https://github.com/IonBazan/polyfill/blob/php8-php5/src/Php80/Php80.php but lacks negative-zero detection for PHP 5. If anyone figures out how to detect it, we can simply replace `LogicException` with it.

Commits
-------

f0b5e2c PHP 8.0 - add fdiv() function polyfill
@nicolas-grekas nicolas-grekas merged commit f0b5e2c into symfony:master Jan 14, 2020
2 checks passed
2 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@IonBazan IonBazan deleted the IonBazan:php8 branch Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.