Skip to content

Commit 343b433

Browse files
committed
Revert printf changes (do not warn)
1 parent 1215408 commit 343b433

13 files changed

+280
-449
lines changed

ext/standard/formatted_print.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
| obtain it through the world-wide-web, please send a note to |
1111
| license@php.net so we can mail you a copy immediately. |
1212
+----------------------------------------------------------------------+
13-
| Author: Stig S�ther Bakken <ssb@php.net> |
13+
| Author: Stig Söther Bakken <ssb@php.net> |
1414
+----------------------------------------------------------------------+
1515
*/
1616

@@ -634,13 +634,13 @@ php_formatted_print(char *format, size_t format_len, zval *args, int argc, int n
634634

635635
case 'd':
636636
php_sprintf_appendint(&result, &outpos,
637-
zval_get_long_ex(tmp, /* is_strict */ true),
637+
zval_get_long_ex(tmp, /* is_strict */ false),
638638
width, padding, alignment, always_sign);
639639
break;
640640

641641
case 'u':
642642
php_sprintf_appenduint(&result, &outpos,
643-
zval_get_long_ex(tmp, /* is_strict */ true),
643+
zval_get_long_ex(tmp, /* is_strict */ false),
644644
width, padding, alignment);
645645
break;
646646

@@ -662,30 +662,30 @@ php_formatted_print(char *format, size_t format_len, zval *args, int argc, int n
662662

663663
case 'c':
664664
php_sprintf_appendchar(&result, &outpos,
665-
(char) zval_get_long_ex(tmp, /* is_strict */ true));
665+
(char) zval_get_long_ex(tmp, /* is_strict */ false));
666666
break;
667667

668668
case 'o':
669669
php_sprintf_append2n(&result, &outpos,
670-
zval_get_long_ex(tmp, /* is_strict */ true),
670+
zval_get_long_ex(tmp, /* is_strict */ false),
671671
width, padding, alignment, 3, hexchars, expprec);
672672
break;
673673

674674
case 'x':
675675
php_sprintf_append2n(&result, &outpos,
676-
zval_get_long_ex(tmp, /* is_strict */ true),
676+
zval_get_long_ex(tmp, /* is_strict */ false),
677677
width, padding, alignment, 4, hexchars, expprec);
678678
break;
679679

680680
case 'X':
681681
php_sprintf_append2n(&result, &outpos,
682-
zval_get_long_ex(tmp, /* is_strict */ true),
682+
zval_get_long_ex(tmp, /* is_strict */ false),
683683
width, padding, alignment, 4, HEXCHARS, expprec);
684684
break;
685685

686686
case 'b':
687687
php_sprintf_append2n(&result, &outpos,
688-
zval_get_long_ex(tmp, /* is_strict */ true),
688+
zval_get_long_ex(tmp, /* is_strict */ false),
689689
width, padding, alignment, 1, hexchars, expprec);
690690
break;
691691

ext/standard/tests/strings/bug23894_32bit.phpt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,8 @@ var_dump($test, bin2hex($test));
1212
$test = sprintf("% 13u", $a);
1313
var_dump($test, bin2hex($test));
1414
?>
15-
--EXPECTF--
16-
Deprecated: Implicit conversion from non-compatible float -12.3456 to int in %s on line %d
15+
--EXPECT--
1716
string(4) "-012"
1817
string(8) "2d303132"
19-
20-
Deprecated: Implicit conversion from non-compatible float -12.3456 to int in %s on line %d
2118
string(13) " 4294967284"
2219
string(26) "20202034323934393637323834"

ext/standard/tests/strings/bug23894_64bit.phpt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,8 @@ var_dump($test, bin2hex($test));
1212
$test = sprintf("% 13u", $a);
1313
var_dump($test, bin2hex($test));
1414
?>
15-
--EXPECTF--
16-
Deprecated: Implicit conversion from non-compatible float -12.3456 to int in %s on line %d
15+
--EXPECT--
1716
string(4) "-012"
1817
string(8) "2d303132"
19-
20-
Deprecated: Implicit conversion from non-compatible float -12.3456 to int in %s on line %d
2118
string(20) "18446744073709551604"
2219
string(40) "3138343436373434303733373039353531363034"

ext/standard/tests/strings/bug47842.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,12 @@ printf("printf 64-bit signed int '18446744073709551615' (2^64)-1 = %u\n", 184467
2323

2424
echo "Done\n";
2525
?>
26-
--EXPECTF--
26+
--EXPECT--
2727
-Test
2828
sscanf 32-bit signed int '2147483647' (2^31)-1 = 2147483647
2929
sscanf 32-bit unsign int '4294967295' (2^32)-1 = 4294967295
3030
sscanf 64-bit signed int '9223372036854775807' (2^63)-1 = 9223372036854775807
3131
sscanf 64-bit unsign int '18446744073709551615' (2^64)-1 = 18446744073709551615
3232
printf 64-bit signed int '9223372036854775807' (2^63)-1 = 9223372036854775807
33-
34-
Deprecated: Implicit conversion from non-compatible float 1.8446744073709552E+19 to int in %s on line %d
3533
printf 64-bit signed int '18446744073709551615' (2^64)-1 = 0
3634
Done

ext/standard/tests/strings/fprintf_variation_002.phpt

Lines changed: 66 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Test fprintf() function (variation - 2)
33
--FILE--
44
<?php
55

6-
$int_variation = array( "%d", "%-d", "%+d", "%7.2d", "%-7.2d", "%07.2d", "%-07.2d", "%'#7.2d" );
6+
$int_variation = array( '"%d"', '"%-d"', '"%+d"', '"%7.2d"', '"%-7.2d"', '"%07.2d"', '"%-07.2d"', '"%\'#7.2d"' );
77
$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
88

99
/* creating dumping file */
@@ -31,119 +31,87 @@ echo "\nDone";
3131
unlink($data_file);
3232

3333
?>
34-
--EXPECTF--
35-
Deprecated: Implicit conversion from non-compatible float 2.7 to int in %s on line %d
36-
37-
Deprecated: Implicit conversion from non-compatible float -2.7 to int in %s on line %d
38-
39-
Deprecated: Implicit conversion from non-compatible float 2.7 to int in %s on line %d
40-
41-
Deprecated: Implicit conversion from non-compatible float -2.7 to int in %s on line %d
42-
43-
Deprecated: Implicit conversion from non-compatible float 2.7 to int in %s on line %d
44-
45-
Deprecated: Implicit conversion from non-compatible float -2.7 to int in %s on line %d
46-
47-
Deprecated: Implicit conversion from non-compatible float 2.7 to int in %s on line %d
48-
49-
Deprecated: Implicit conversion from non-compatible float -2.7 to int in %s on line %d
50-
51-
Deprecated: Implicit conversion from non-compatible float 2.7 to int in %s on line %d
52-
53-
Deprecated: Implicit conversion from non-compatible float -2.7 to int in %s on line %d
54-
55-
Deprecated: Implicit conversion from non-compatible float 2.7 to int in %s on line %d
56-
57-
Deprecated: Implicit conversion from non-compatible float -2.7 to int in %s on line %d
58-
59-
Deprecated: Implicit conversion from non-compatible float 2.7 to int in %s on line %d
60-
61-
Deprecated: Implicit conversion from non-compatible float -2.7 to int in %s on line %d
62-
63-
Deprecated: Implicit conversion from non-compatible float 2.7 to int in %s on line %d
64-
65-
Deprecated: Implicit conversion from non-compatible float -2.7 to int in %s on line %d
66-
34+
--EXPECT--
6735
*** Testing fprintf() with integers ***
6836

6937
-- Iteration 1 --
7038

71-
0
72-
1
73-
-1
74-
2
75-
-2
76-
23333333
77-
-23333333
78-
1234
39+
"0"
40+
"1"
41+
"-1"
42+
"2"
43+
"-2"
44+
"23333333"
45+
"-23333333"
46+
"1234"
7947
-- Iteration 2 --
8048

81-
0
82-
1
83-
-1
84-
2
85-
-2
86-
23333333
87-
-23333333
88-
1234
49+
"0"
50+
"1"
51+
"-1"
52+
"2"
53+
"-2"
54+
"23333333"
55+
"-23333333"
56+
"1234"
8957
-- Iteration 3 --
9058

91-
+0
92-
+1
93-
-1
94-
+2
95-
-2
96-
+23333333
97-
-23333333
98-
+1234
59+
"+0"
60+
"+1"
61+
"-1"
62+
"+2"
63+
"-2"
64+
"+23333333"
65+
"-23333333"
66+
"+1234"
9967
-- Iteration 4 --
10068

101-
0
102-
1
103-
-1
104-
2
105-
-2
106-
23333333
107-
-23333333
108-
1234
69+
" 0"
70+
" 1"
71+
" -1"
72+
" 2"
73+
" -2"
74+
"23333333"
75+
"-23333333"
76+
" 1234"
10977
-- Iteration 5 --
11078

111-
0
112-
1
113-
-1
114-
2
115-
-2
116-
23333333
117-
-23333333
118-
1234
79+
"0 "
80+
"1 "
81+
"-1 "
82+
"2 "
83+
"-2 "
84+
"23333333"
85+
"-23333333"
86+
"1234 "
11987
-- Iteration 6 --
12088

121-
0000000
122-
0000001
123-
-000001
124-
0000002
125-
-000002
126-
23333333
127-
-23333333
128-
0001234
89+
"0000000"
90+
"0000001"
91+
"-000001"
92+
"0000002"
93+
"-000002"
94+
"23333333"
95+
"-23333333"
96+
"0001234"
12997
-- Iteration 7 --
13098

131-
0
132-
1
133-
-1
134-
2
135-
-2
136-
23333333
137-
-23333333
138-
1234
99+
"0 "
100+
"1 "
101+
"-1 "
102+
"2 "
103+
"-2 "
104+
"23333333"
105+
"-23333333"
106+
"1234 "
139107
-- Iteration 8 --
140108

141-
######0
142-
######1
143-
#####-1
144-
######2
145-
#####-2
146-
23333333
147-
-23333333
148-
###1234
109+
"######0"
110+
"######1"
111+
"#####-1"
112+
"######2"
113+
"#####-2"
114+
"23333333"
115+
"-23333333"
116+
"###1234"
149117
Done

ext/standard/tests/strings/fprintf_variation_003_64bit.phpt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
77
--FILE--
88
<?php
99

10-
$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
10+
$int_numbers = array( 0, 1, -1, 23333333, -23333333, "1234" );
1111

1212
/* creating dumping file */
1313
$data_file = __DIR__ . '/fprintf_variation_003_64bit.txt';
@@ -29,18 +29,12 @@ echo "\nDone";
2929
unlink($data_file);
3030

3131
?>
32-
--EXPECTF--
33-
Deprecated: Implicit conversion from non-compatible float 2.7 to int in %s on line %d
34-
35-
Deprecated: Implicit conversion from non-compatible float -2.7 to int in %s on line %d
36-
32+
--EXPECT--
3733
*** Testing fprintf() with binary ***
3834

3935
0
4036
1
4137
1111111111111111111111111111111111111111111111111111111111111111
42-
10
43-
1111111111111111111111111111111111111111111111111111111111111110
4438
1011001000000100111010101
4539
1111111111111111111111111111111111111110100110111111011000101011
4640
10011010010

ext/standard/tests/strings/fprintf_variation_006_64bit.phpt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
77
--FILE--
88
<?php
99

10-
$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
10+
$int_numbers = array( 0, 1, -1, 23333333, -23333333, "1234" );
1111

1212
/* creating dumping file */
1313
$data_file = __DIR__ . '/fprintf_variation_006_64bit.txt';
@@ -29,18 +29,12 @@ echo "\nDone";
2929
unlink($data_file);
3030

3131
?>
32-
--EXPECTF--
33-
Deprecated: Implicit conversion from non-compatible float 2.7 to int in %s on line %d
34-
35-
Deprecated: Implicit conversion from non-compatible float -2.7 to int in %s on line %d
36-
32+
--EXPECT--
3733
*** Testing fprintf() for unsigned integers ***
3834

3935
0
4036
1
4137
18446744073709551615
42-
2
43-
18446744073709551614
4438
23333333
4539
18446744073686218283
4640
1234

ext/standard/tests/strings/fprintf_variation_007_64bit.phpt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
77
--FILE--
88
<?php
99

10-
$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
10+
$int_numbers = array( 0, 1, -1, 23333333, -23333333, "1234" );
1111

1212
/* creating dumping file */
1313
$data_file = __DIR__ . '/fprintf_variation_007_64bit.txt';
@@ -29,18 +29,12 @@ echo "\nDone";
2929
unlink($data_file);
3030

3131
?>
32-
--EXPECTF--
33-
Deprecated: Implicit conversion from non-compatible float 2.7 to int in %s on line %d
34-
35-
Deprecated: Implicit conversion from non-compatible float -2.7 to int in %s on line %d
36-
32+
--EXPECT--
3733
*** Testing fprintf() for octals ***
3834

3935
0
4036
1
4137
1777777777777777777777
42-
2
43-
1777777777777777777776
4438
131004725
4539
1777777777777646773053
4640
2322

0 commit comments

Comments
 (0)