Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Zend/zend.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,23 @@ static void zend_print_zval_r_to_buf(smart_str *buf, zval *expr, int indent) /*
case IS_LONG:
smart_str_append_long(buf, Z_LVAL_P(expr));
break;
case IS_DOUBLE:
{
zend_string *str = zend_strpprintf_unchecked(0, "%.*H", (int) EG(precision), Z_DVAL_P(expr));
smart_str_appends(buf, ZSTR_VAL(str));
/* Without a decimal point, this can be mistaken for an integer, so add one.
* This check even works for scientific notation, because the
* mantissa always contains a decimal point.
* We need to check for finiteness, because INF, -INF and NAN
* must not have a decimal point added.
* (copied from php_var_export_ex, changed to only use helpers defined in Zend/)
*/
if (zend_finite(Z_DVAL_P(expr)) && NULL == strchr(ZSTR_VAL(str), '.')) {
smart_str_appendl(buf, ".0", 2);
}
zend_string_release_ex(str, 0);
break;
}
case IS_REFERENCE:
zend_print_zval_r_to_buf(buf, Z_REFVAL_P(expr), indent);
break;
Expand Down
2 changes: 1 addition & 1 deletion ext/date/tests/bug41709.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Array
[hour] => 0
[minute] => 0
[second] => 0
[fraction] => 0
[fraction] => 0.0
[warning_count] => 1
[warnings] => Array
(
Expand Down
4 changes: 2 additions & 2 deletions ext/date/tests/bug48678.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ DateInterval Object
[h] => 12
[i] => 30
[s] => 5
[f] => 0
[f] => 0.0
[weekday] => 0
[weekday_behavior] => 0
[first_last_day_of] => 0
Expand All @@ -35,7 +35,7 @@ DateInterval Object
[h] => 12
[i] => 30
[s] => 5
[f] => 0
[f] => 0.0
[weekday] => 0
[weekday_behavior] => 0
[first_last_day_of] => 0
Expand Down
2 changes: 1 addition & 1 deletion ext/date/tests/bug49081.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ DateInterval Object
[h] => 4
[i] => 0
[s] => 0
[f] => 0
[f] => 0.0
[weekday] => 0
[weekday_behavior] => 0
[first_last_day_of] => 0
Expand Down
2 changes: 1 addition & 1 deletion ext/date/tests/bug52738.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ di Object
[h] => 0
[i] => 0
[s] => 0
[f] => 0
[f] => 0.0
[weekday] => 0
[weekday_behavior] => 0
[first_last_day_of] => 0
Expand Down
4 changes: 2 additions & 2 deletions ext/date/tests/date-parse-by-format001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Array
[hour] => 0
[minute] => 0
[second] => 0
[fraction] => 0
[fraction] => 0.0
[warning_count] => 0
[warnings] => Array
(
Expand All @@ -36,7 +36,7 @@ Array
[hour] => 0
[minute] => 0
[second] => 0
[fraction] => 0
[fraction] => 0.0
[warning_count] => 0
[warnings] => Array
(
Expand Down
108 changes: 54 additions & 54 deletions ext/standard/tests/general_functions/print_r.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -415,13 +415,13 @@ Array
*** Testing print_r() on float variables ***

-- Iteration 1 --
-0
-0
-0
-0.0
-0.0
-0.0
-- Iteration 2 --
0
0
0
0.0
0.0
0.0
-- Iteration 3 --
1.234
1.234
Expand All @@ -431,13 +431,13 @@ Array
-1.234
-1.234
-- Iteration 5 --
-2
-2
-2
-2.0
-2.0
-2.0
-- Iteration 6 --
2
2
2
2.0
2.0
2.0
-- Iteration 7 --
-0.5
-0.5
Expand All @@ -451,17 +451,17 @@ Array
-0.00067
-0.00067
-- Iteration 10 --
-670
-670
-670
-670.0
-670.0
-670.0
-- Iteration 11 --
670
670
670
670.0
670.0
670.0
-- Iteration 12 --
670
670
670
670.0
670.0
670.0
-- Iteration 13 --
-0.00410003
-0.00410003
Expand All @@ -479,13 +479,13 @@ Array
4100.003
4100.003
-- Iteration 17 --
100000
100000
100000
100000.0
100000.0
100000.0
-- Iteration 18 --
-100000
-100000
-100000
-100000.0
-100000.0
-100000.0
-- Iteration 19 --
1.0E-5
1.0E-5
Expand All @@ -495,29 +495,29 @@ Array
-1.0E-5
-1.0E-5
-- Iteration 21 --
100000
100000
100000
100000.0
100000.0
100000.0
-- Iteration 22 --
-100000
-100000
-100000
-100000.0
-100000.0
-100000.0
-- Iteration 23 --
100000
100000
100000
100000.0
100000.0
100000.0
-- Iteration 24 --
-100000
-100000
-100000
-100000.0
-100000.0
-100000.0
-- Iteration 25 --
100000
100000
100000
100000.0
100000.0
100000.0
-- Iteration 26 --
-100000
-100000
-100000
-100000.0
-100000.0
-100000.0
-- Iteration 27 --
1.0E-5
1.0E-5
Expand Down Expand Up @@ -1578,7 +1578,7 @@ Array
-- Iteration 4 --
Array
(
[0] => -0
[0] => -0.0
[1] => Where am I?
[2] => Array
(
Expand All @@ -1594,7 +1594,7 @@ Array

Array
(
[0] => -0
[0] => -0.0
[1] => Where am I?
[2] => Array
(
Expand All @@ -1610,7 +1610,7 @@ Array

Array
(
[0] => -0
[0] => -0.0
[1] => Where am I?
[2] => Array
(
Expand All @@ -1628,23 +1628,23 @@ Array
Array
(
[0] =>
[1] => 20000000000
[1] => 20000000000.0
[2] => 79.1
[3] => 4.599998
)

Array
(
[0] =>
[1] => 20000000000
[1] => 20000000000.0
[2] => 79.1
[3] => 4.599998
)

Array
(
[0] =>
[1] => 20000000000
[1] => 20000000000.0
[2] => 79.1
[3] => 4.599998
)
Expand All @@ -1654,23 +1654,23 @@ Array
(
[0] => array(1,2,3,4)1.0000002TRUE
[1] =>
[2] => 4611333
[2] => 4611333.0
[3] => /00\7
)

Array
(
[0] => array(1,2,3,4)1.0000002TRUE
[1] =>
[2] => 4611333
[2] => 4611333.0
[3] => /00\7
)

Array
(
[0] => array(1,2,3,4)1.0000002TRUE
[1] =>
[2] => 4611333
[2] => 4611333.0
[3] => /00\7
)

Expand Down
Loading