Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 42fda6d

Browse files
Add polyfill for PHP_FLOAT_* constants
1 parent cda932e commit 42fda6d

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Moved to core since 7.2 (was in the optional XML extension earlier):
1616
- [`utf8_decode`](https://php.net/utf8_decode)
1717

1818
Also, it provides a constant added to PHP 7.2:
19+
- [`PHP_FLOAT_*`](https://php.net/reserved.constants#constant.php-float-dig)
1920
- [`PHP_OS_FAMILY`](https://php.net/reserved.constants#constant.php-os-family)
2021

2122
More information can be found in the

‎bootstrap.php‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@
1212
use Symfony\Polyfill\Php72 as p;
1313

1414
if (PHP_VERSION_ID < 70200) {
15+
if (!defined('PHP_FLOAT_DIG')) {
16+
define('PHP_FLOAT_DIG', 15);
17+
}
18+
if (!defined('PHP_FLOAT_EPSILON')) {
19+
define('PHP_FLOAT_EPSILON', 2.2204460492503E-16);
20+
}
21+
if (!defined('PHP_FLOAT_MIN')) {
22+
define('PHP_FLOAT_MIN', 2.2250738585072E-308);
23+
}
24+
if (!defined('PHP_FLOAT_MAX')) {
25+
define('PHP_FLOAT_MAX', 1.7976931348623157E+308);
26+
}
27+
if (!defined('PHP_OS_FAMILY')) {
28+
define('PHP_OS_FAMILY', p\Php72::php_os_family());
29+
}
30+
1531
if ('\\' === DIRECTORY_SEPARATOR && !function_exists('sapi_windows_vt100_support')) {
1632
function sapi_windows_vt100_support($stream, $enable = null) { return p\Php72::sapi_windows_vt100_support($stream, $enable); }
1733
}
@@ -27,9 +43,6 @@ function utf8_decode($s) { return p\Php72::utf8_decode($s); }
2743
if (!function_exists('spl_object_id')) {
2844
function spl_object_id($s) { return p\Php72::spl_object_id($s); }
2945
}
30-
if (!defined('PHP_OS_FAMILY')) {
31-
define('PHP_OS_FAMILY', p\Php72::php_os_family());
32-
}
3346
if (!function_exists('mb_ord')) {
3447
function mb_ord($s, $enc = null) { return p\Php72::mb_ord($s, $enc); }
3548
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /