Skip to content

Commit 34bb7e7

Browse files
committed
Fixed tests (mostly MFB)
1 parent 1de42cc commit 34bb7e7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1292
-1280
lines changed

ext/pcre/tests/invalid_utf8_offset.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ if (@preg_match('/./u', '') === false) {
99
--FILE--
1010
<?php
1111

12-
$string = "\xc3\xa9 uma string utf8 bem formada";
12+
$string = b"\xc3\xa9 uma string utf8 bem formada";
1313

14-
var_dump(preg_match('~.*~u', $string, $m, 0, 1));
14+
var_dump(preg_match(b'~.*~u', $string, $m, 0, 1));
1515
var_dump($m);
1616
var_dump(preg_last_error() == PREG_BAD_UTF8_OFFSET_ERROR);
1717

18-
var_dump(preg_match('~.*~u', $string, $m, 0, 2));
18+
var_dump(preg_match(b'~.*~u', $string, $m, 0, 2));
1919
var_dump($m);
2020
var_dump(preg_last_error() == PREG_NO_ERROR);
2121

@@ -29,7 +29,7 @@ bool(true)
2929
int(1)
3030
array(1) {
3131
[0]=>
32-
unicode(28) " uma string utf8 bem formada"
32+
string(28) " uma string utf8 bem formada"
3333
}
3434
bool(true)
3535
Done

ext/standard/tests/file/007_variation11.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ unlink(dirname(__FILE__)."/007_variation11.tmp");
6262
--EXPECTF--
6363
*** Test fopen() & fclose() functions: with 'wt' mode ***
6464
resource(%d) of type (stream)
65-
unicode(6) "stream"
65+
%unicode|string%(6) "stream"
6666
int(0)
6767
int(37)
6868
int(37)
69-
bool(false)
69+
string(0) ""
7070
int(0)
7171
bool(true)
72-
unicode(7) "Unknown"
72+
%unicode|string%(7) "Unknown"
7373
int(37)
7474
int(0)
7575
bool(true)

ext/standard/tests/file/007_variation13.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ unlink(dirname(__FILE__)."/007_variation13.tmp");
5454
--EXPECTF--
5555
*** Test fopen() & fclose() functions: with 'at' mode ***
5656
resource(%d) of type (stream)
57-
unicode(6) "stream"
57+
%unicode|string%(6) "stream"
5858
int(37)
59-
bool(false)
59+
string(0) ""
6060
int(0)
6161
bool(true)
62-
unicode(7) "Unknown"
62+
%unicode|string%(7) "Unknown"
6363
int(57)
6464
bool(true)
6565
*** Done ***

ext/standard/tests/file/007_variation15.phpt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Test fopen and fclose() functions - usage variations - "xt" mode
2121
and fclose function
2222
*/
2323
$file_path = dirname(__FILE__);
24-
$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
24+
$string = b"abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
2525
$file = $file_path."/007_variation15.tmp";
2626

2727
echo "*** Test fopen() & fclose() functions: with 'xt' mode ***\n";
@@ -45,16 +45,14 @@ unlink(dirname(__FILE__)."/007_variation15.tmp");
4545
--EXPECTF--
4646
*** Test fopen() & fclose() functions: with 'xt' mode ***
4747
resource(%d) of type (stream)
48-
unicode(6) "stream"
48+
%unicode|string%(6) "stream"
4949
int(0)
50-
51-
Notice: fwrite(): 37 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d
5250
int(37)
5351
int(37)
54-
bool(false)
52+
string(0) ""
5553
int(0)
5654
bool(true)
57-
unicode(7) "Unknown"
55+
%unicode|string%(7) "Unknown"
5856

59-
Warning: fopen(%s): failed to open stream: File exists in %s on line %d
57+
Warning: fopen(%s): failed to open stream: File exists in %s on line %s
6058
*** Done ***

ext/standard/tests/file/007_variation19.phpt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ require($file_path."/file.inc");
2525

2626
create_files($file_path, 1, "text_with_new_line", 0755, 20, "wb", "007_variation", 19, "bytes");
2727
$file = $file_path."/007_variation19.tmp";
28-
$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
28+
$string = b"abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
2929

3030
echo "*** Test fopen() & fclose() functions: with 'wb' mode ***\n";
3131
$file_handle = fopen($file, "wb"); //opening the file "wb" mode
@@ -57,16 +57,14 @@ unlink(dirname(__FILE__)."/007_variation19.tmp");
5757
--EXPECTF--
5858
*** Test fopen() & fclose() functions: with 'wb' mode ***
5959
resource(%d) of type (stream)
60-
unicode(6) "stream"
60+
%unicode|string%(6) "stream"
6161
int(0)
62-
63-
Notice: fwrite(): 37 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d
6462
int(37)
6563
int(37)
66-
bool(false)
64+
string(0) ""
6765
int(0)
6866
bool(true)
69-
unicode(7) "Unknown"
67+
%unicode|string%(7) "Unknown"
7068
int(37)
7169
int(0)
7270
bool(true)

ext/standard/tests/file/007_variation21.phpt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ require($file_path."/file.inc");
2424

2525
create_files($file_path, 1, "text_with_new_line", 0755, 20, "w", "007_variation", 21, "bytes");
2626
$file = $file_path."/007_variation21.tmp";
27-
$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
27+
$string = b"abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
2828

2929
echo "*** Test fopen() & fclose() functions: with 'ab' mode ***\n";
3030
$file_handle = fopen($file, "ab"); //opening the file "ab" mode
@@ -49,14 +49,12 @@ unlink(dirname(__FILE__)."/007_variation21.tmp");
4949
--EXPECTF--
5050
*** Test fopen() & fclose() functions: with 'ab' mode ***
5151
resource(%d) of type (stream)
52-
unicode(6) "stream"
53-
54-
Notice: fwrite(): 37 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d
52+
%unicode|string%(6) "stream"
5553
int(37)
56-
bool(false)
54+
string(0) ""
5755
int(0)
5856
bool(true)
59-
unicode(7) "Unknown"
57+
%unicode|string%(7) "Unknown"
6058
int(57)
6159
bool(true)
6260
*** Done ***

ext/standard/tests/file/007_variation23.phpt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Test fopen and fclose() functions - usage variations - "xb" mode
2121
and fclose function
2222
*/
2323
$file_path = dirname(__FILE__);
24-
$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
24+
$string = b"abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
2525
$file = $file_path."/007_variation23.tmp";
2626

2727
echo "*** Test fopen() & fclose() functions: with 'xb' mode ***\n";
@@ -45,16 +45,14 @@ unlink(dirname(__FILE__)."/007_variation23.tmp");
4545
--EXPECTF--
4646
*** Test fopen() & fclose() functions: with 'xb' mode ***
4747
resource(%d) of type (stream)
48-
unicode(6) "stream"
48+
%unicode|string%(6) "stream"
4949
int(0)
50-
51-
Notice: fwrite(): 37 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d
5250
int(37)
5351
int(37)
54-
bool(false)
52+
string(0) ""
5553
int(0)
5654
bool(true)
57-
unicode(7) "Unknown"
55+
%unicode|string%(7) "Unknown"
5856

59-
Warning: fopen(%s): failed to open stream: File exists in %s on line %d
57+
Warning: fopen(%s): failed to open stream: File exists in %s on line %s
6058
*** Done ***

ext/standard/tests/file/007_variation3.phpt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ require($file_path."/file.inc");
2525

2626
create_files($file_path, 1, "text_with_new_line", 0755, 20, "w", "007_variation", 3, "bytes");
2727
$file = $file_path."/007_variation3.tmp";
28-
$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
28+
$string = b"abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
2929

3030
echo "*** Test fopen() & fclose() functions: with 'w' mode ***\n";
3131
$file_handle = fopen($file, "w"); //opening the file "w" mode
@@ -35,7 +35,7 @@ var_dump( ftell($file_handle) ); //Initial file pointer position, expected at t
3535
var_dump( fwrite($file_handle, $string) ); //Check for write operation; passes; expected:size of the $string
3636
var_dump( ftell($file_handle) ); //File pointer position after write operation, expected at the end of the file
3737
rewind($file_handle);
38-
var_dump( fread($file_handle, 100) ); //Check for read operation; fails; expected: bool(false)
38+
var_dump( fread($file_handle, 100) ); //Check for read operation; fails; expected: empty string
3939
var_dump( ftell($file_handle) ); //File pointer position after read operation, expected at the begining of the file
4040
var_dump( fclose($file_handle) ); //Check for close operation on the file handle
4141
var_dump( get_resource_type($file_handle) ); //Check whether resource is lost after close operation
@@ -57,16 +57,14 @@ unlink(dirname(__FILE__)."/007_variation3.tmp");
5757
--EXPECTF--
5858
*** Test fopen() & fclose() functions: with 'w' mode ***
5959
resource(%d) of type (stream)
60-
unicode(6) "stream"
60+
%unicode|string%(6) "stream"
6161
int(0)
62-
63-
Notice: fwrite(): 37 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d
6462
int(37)
6563
int(37)
66-
bool(false)
64+
string(0) ""
6765
int(0)
6866
bool(true)
69-
unicode(7) "Unknown"
67+
%unicode|string%(7) "Unknown"
7068
int(37)
7169
int(0)
7270
bool(true)

ext/standard/tests/file/007_variation5.phpt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ require($file_path."/file.inc");
2424

2525
create_files($file_path, 1, "text_with_new_line", 0755, 20, "w", "007_variation", 5, "bytes");
2626
$file = $file_path."/007_variation5.tmp";
27-
$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
27+
$string = b"abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
2828

2929
echo "*** Test fopen() & fclose() functions: with 'a' mode ***\n";
3030
$file_handle = fopen($file, "a"); //opening the file "a" mode
@@ -49,14 +49,12 @@ unlink(dirname(__FILE__)."/007_variation5.tmp");
4949
--EXPECTF--
5050
*** Test fopen() & fclose() functions: with 'a' mode ***
5151
resource(%d) of type (stream)
52-
unicode(6) "stream"
53-
54-
Notice: fwrite(): 37 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d
52+
%unicode|string%(6) "stream"
5553
int(37)
56-
bool(false)
54+
string(0) ""
5755
int(0)
5856
bool(true)
59-
unicode(7) "Unknown"
57+
%unicode|string%(7) "Unknown"
6058
int(57)
6159
bool(true)
6260
*** Done ***

ext/standard/tests/file/007_variation7.phpt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Test fopen and fclose() functions - usage variations - "x" mode
2121
and fclose function
2222
*/
2323
$file_path = dirname(__FILE__);
24-
$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
24+
$string = b"abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
2525
$file = $file_path."/007_variation7.tmp";
2626

2727
echo "*** Test fopen() & fclose() functions: with 'x' mode ***\n";
@@ -45,16 +45,14 @@ unlink(dirname(__FILE__)."/007_variation7.tmp");
4545
--EXPECTF--
4646
*** Test fopen() & fclose() functions: with 'x' mode ***
4747
resource(%d) of type (stream)
48-
unicode(6) "stream"
48+
%unicode|string%(6) "stream"
4949
int(0)
50-
51-
Notice: fwrite(): 37 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d
5250
int(37)
5351
int(37)
54-
bool(false)
52+
string(0) ""
5553
int(0)
5654
bool(true)
57-
unicode(7) "Unknown"
55+
%unicode|string%(7) "Unknown"
5856

59-
Warning: fopen(%s): failed to open stream: File exists in %s on line %d
57+
Warning: fopen(%s): failed to open stream: File exists in %s on line %s
6058
*** Done ***

ext/standard/tests/file/bug27508.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ stream_wrapper_register("myFile", "FileStream")
4646
or die("Failed to register protocol");
4747

4848
$tmp_dir = __DIR__;
49-
$tn = tempnam($tmp_dir, 'foo');
49+
$tn = (binary) tempnam($tmp_dir, 'foo');
5050
if (!$tn) {
5151
die("tempnam failed");
5252
}

ext/standard/tests/file/bug46347.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ var_dump(parse_ini_file($file));
1717
<?php
1818
unlink(__DIR__.'/parse.ini');
1919
?>
20-
--EXPECT--
20+
--EXPECTF--
2121
array(1) {
22-
["part1.*.part2"]=>
23-
string(1) "1"
22+
[%u|b%"part1.*.part2"]=>
23+
%unicode|string%(1) "1"
2424
}

ext/standard/tests/file/copy_variation9.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ echo "*** Done ***\n";
5656
unlink(dirname(__FILE__)."/copy_copy_variation9.tmp");
5757
unlink(dirname(__FILE__)."/copy_variation9.tmp");
5858
?>
59-
--EXPECT--
59+
--EXPECTF--
6060
*** Test copy() function: destination with/without write permissions ***
6161

6262
-- With write permissions --

ext/standard/tests/file/file_get_contents_variation5.phpt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ set_error_handler('test_error_handler');
2525
$filename = 'FileGetContentsVar5.tmp';
2626
$absFile = dirname(__FILE__).'/'.$filename;
2727
$h = fopen($absFile,"w");
28-
fwrite($h, "contents read");
28+
fwrite($h, b"contents read");
2929
fclose($h);
3030

3131

@@ -183,27 +183,27 @@ string(12) "ontents read"
183183
string(%d) "contents read"
184184

185185
--empty string DQ--
186-
Error: 2 - file_get_contents() expects parameter 4 to be long, string given, %s(%d)
186+
Error: 2 - file_get_contents() expects parameter 4 to be long, %unicode_string_optional% given, %s(%d)
187187
NULL
188188

189189
--empty string SQ--
190-
Error: 2 - file_get_contents() expects parameter 4 to be long, string given, %s(%d)
190+
Error: 2 - file_get_contents() expects parameter 4 to be long, %unicode_string_optional% given, %s(%d)
191191
NULL
192192

193193
--string DQ--
194-
Error: 2 - file_get_contents() expects parameter 4 to be long, string given, %s(%d)
194+
Error: 2 - file_get_contents() expects parameter 4 to be long, %unicode_string_optional% given, %s(%d)
195195
NULL
196196

197197
--string SQ--
198-
Error: 2 - file_get_contents() expects parameter 4 to be long, string given, %s(%d)
198+
Error: 2 - file_get_contents() expects parameter 4 to be long, %unicode_string_optional% given, %s(%d)
199199
NULL
200200

201201
--mixed case string--
202-
Error: 2 - file_get_contents() expects parameter 4 to be long, string given, %s(%d)
202+
Error: 2 - file_get_contents() expects parameter 4 to be long, %unicode_string_optional% given, %s(%d)
203203
NULL
204204

205205
--heredoc--
206-
Error: 2 - file_get_contents() expects parameter 4 to be long, string given, %s(%d)
206+
Error: 2 - file_get_contents() expects parameter 4 to be long, %unicode_string_optional% given, %s(%d)
207207
NULL
208208

209209
--instance of classWithToString--

ext/standard/tests/file/file_get_contents_variation8.phpt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,31 +52,38 @@ bool(false)
5252
Warning: file_get_contents(1): failed to open stream: No such file or directory in %s on line %d
5353
bool(false)
5454
-- Iteration 2 --
55+
56+
Warning: file_get_contents(): Filename cannot be empty in %s on line %d
5557
bool(false)
5658
-- Iteration 3 --
59+
60+
Warning: file_get_contents(): Filename cannot be empty in %s on line %d
5761
bool(false)
5862
-- Iteration 4 --
63+
64+
Warning: file_get_contents(): Filename cannot be empty in %s on line %d
5965
bool(false)
6066
-- Iteration 5 --
6167

6268
Warning: file_get_contents( ): failed to open stream: No such file or directory in %s on line %d
6369
bool(false)
6470
-- Iteration 6 --
71+
72+
Warning: file_get_contents(): Filename cannot be empty in %s on line %d
6573
bool(false)
6674
-- Iteration 7 --
6775

68-
Notice: Array to string conversion in %s on line %d
76+
Notice: Array to string conversion in %s
6977

70-
Warning: file_get_contents(Array): failed to open stream: No such file or directory in %s on line %d
78+
Warning: file_get_contents(Array): failed to open stream: No such file or directory in %s
7179
bool(false)
7280
-- Iteration 8 --
7381

74-
Warning: file_get_contents(/no/such/file/dir): failed to open stream: No such file or directory in %s on line %d
82+
Warning: file_get_contents(/no/such/file/dir): failed to open stream: %s in %s on line %d
7583
bool(false)
7684
-- Iteration 9 --
7785

7886
Warning: file_get_contents(php/php): failed to open stream: No such file or directory in %s on line %d
7987
bool(false)
8088

8189
*** Done ***
82-

ext/standard/tests/file/file_get_contents_variation9.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ $chainlink = dirname(__FILE__).'/fileGetContentsVar9.ChainLink';
2525
$h = fopen($filename,"w");
2626
//Data should be more than the size of a link.
2727
for ($i = 1; $i <= 10; $i++) {
28-
fwrite($h, "Here is a repeated amount of data");
28+
fwrite($h, b"Here is a repeated amount of data");
2929
}
3030
fclose($h);
3131

0 commit comments

Comments
 (0)