Movatterモバイル変換


[0]ホーム

URL:


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

Commit999c0a5

Browse files
[NumberFormatter] Fix invalid numeric literal on PHP 7
1 parent56624e6 commit999c0a5

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

‎src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php‎

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -213,24 +213,18 @@ class NumberFormatter
213213
);
214214

215215
/**
216-
* The maximumvalues of the integer type in 32 bit platforms.
216+
* The maximumvalue of the integer type in 32 bit platforms.
217217
*
218-
* @vararray
218+
* @varint
219219
*/
220-
privatestatic$int32Range =array(
221-
'positive' =>2147483647,
222-
'negative' => -2147483648,
223-
);
220+
privatestatic$int32Max =2147483647;
224221

225222
/**
226-
* The maximumvalues of the integer type in 64 bit platforms.
223+
* The maximumvalue of the integer type in 64 bit platforms.
227224
*
228-
* @vararray
225+
* @varint|float
229226
*/
230-
privatestatic$int64Range =array(
231-
'positive' =>9223372036854775807,
232-
'negative' => -9223372036854775808,
233-
);
227+
privatestatic$int64Max =9223372036854775807;
234228

235229
privatestatic$enSymbols =array(
236230
self::DECIMAL =>array('.',',',';','%','0','#','-','+','¤','¤¤','.','E','','*','','NaN','@',','),
@@ -508,7 +502,7 @@ public function parseCurrency($value, &$currency, &$position = null)
508502
* @param int $type Type of the formatting, one of the format type constants. NumberFormatter::TYPE_DOUBLE by default
509503
* @param int $position Offset to begin the parsing on return this value will hold the offset at which the parsing ended
510504
*
511-
* @returnbool|string The parsed value of false on error
505+
* @returnint|float|false The parsed value of false on error
512506
*
513507
* @see http://www.php.net/manual/en/numberformatter.parse.php
514508
*/
@@ -795,7 +789,7 @@ private function convertValueDataType($value, $type)
795789
*/
796790
privatefunctiongetInt32Value($value)
797791
{
798-
if ($value >self::$int32Range['positive'] ||$value <self::$int32Range['negative']) {
792+
if ($value >self::$int32Max ||$value <-self::$int32Max -1) {
799793
returnfalse;
800794
}
801795

@@ -808,20 +802,18 @@ private function getInt32Value($value)
808802
* @param mixed $value The value to be converted
809803
*
810804
* @return int|float|false The converted value
811-
*
812-
* @see https://bugs.php.net/bug.php?id=59597 Bug #59597
813805
*/
814806
privatefunctiongetInt64Value($value)
815807
{
816-
if ($value >self::$int64Range['positive'] ||$value <self::$int64Range['negative']) {
808+
if ($value >self::$int64Max ||$value <-self::$int64Max -1) {
817809
returnfalse;
818810
}
819811

820-
if (PHP_INT_SIZE !==8 && ($value >self::$int32Range['positive'] ||$value <=self::$int32Range['negative'])) {
812+
if (PHP_INT_SIZE !==8 && ($value >self::$int32Max ||$value <=-self::$int32Max -1)) {
821813
// Bug #59597 was fixed on PHP 5.3.14 and 5.4.4
822814
// The negative PHP_INT_MAX was being converted to float
823815
if (
824-
$value ==self::$int32Range['negative'] &&
816+
$value ==-self::$int32Max -1 &&
825817
((PHP_VERSION_ID <50400 &&PHP_VERSION_ID >=50314) ||PHP_VERSION_ID >=50404 || (extension_loaded('intl') &&method_exists('IntlDateFormatter','setTimeZone')))
826818
) {
827819
return (int)$value;
@@ -834,7 +826,7 @@ private function getInt64Value($value)
834826
// Bug #59597 was fixed on PHP 5.3.14 and 5.4.4
835827
// A 32 bit integer was being generated instead of a 64 bit integer
836828
if (
837-
($value >self::$int32Range['positive'] ||$value <self::$int32Range['negative']) &&
829+
($value >self::$int32Max ||$value <-self::$int32Max -1) &&
838830
(PHP_VERSION_ID <50314 || (PHP_VERSION_ID >=50400 &&PHP_VERSION_ID <50404)) &&
839831
!(extension_loaded('intl') &&method_exists('IntlDateFormatter','setTimeZone'))
840832
) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp