Skip to content

Commit 756f797

Browse files
committed
Update tests (WIP)
1 parent e42f342 commit 756f797

File tree

70 files changed

+102
-3568
lines changed

Some content is hidden

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

70 files changed

+102
-3568
lines changed

Zend/tests/bug43201.phpt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,37 @@ Warning: Undefined variable $ref in %s on line %d
3030

3131
Warning: Undefined variable $undef in %s on line %d
3232

33+
Deprecated: chop(): Passing null to argument of type string is deprecated in %s on line %d
34+
3335
Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
3436

3537
Warning: Undefined variable $undef in %s on line %d
3638

39+
Deprecated: chop(): Passing null to argument of type string is deprecated in %s on line %d
40+
3741
Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
3842

3943
Warning: Undefined variable $undef in %s on line %d
4044

45+
Deprecated: chop(): Passing null to argument of type string is deprecated in %s on line %d
46+
4147
Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
4248

4349
Warning: Undefined variable $undef in %s on line %d
4450

51+
Deprecated: chop(): Passing null to argument of type string is deprecated in %s on line %d
52+
4553
Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
4654

4755
Warning: Undefined variable $undef in %s on line %d
4856

57+
Deprecated: chop(): Passing null to argument of type string is deprecated in %s on line %d
58+
4959
Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
5060

5161
Warning: Undefined variable $undef in %s on line %d
5262

63+
Deprecated: chop(): Passing null to argument of type string is deprecated in %s on line %d
64+
5365
Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17
5466
ok

Zend/tests/bug64677.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class cat {
77
}
88
}
99
$cat = new cat();
10-
$cat->show_output('Files: ', trim(`cd .`)); // this gives invalid args to shell_exec
10+
$cat->show_output('Files: ', trim((string) `cd .`)); // this gives invalid args to shell_exec
1111
$cat->show_output('Files: ', `cd .`); // this causes a segmentation fault
1212
$cat->show_output(`cd .`); // this causes a segmentation fault
1313

Zend/tests/class_exists_002.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ class foo {
88
}
99

1010
var_dump(class_exists(''));
11-
var_dump(class_exists(NULL));
1211
var_dump(class_exists('FOO'));
1312
var_dump(class_exists('bar'));
1413
var_dump(class_exists(1));
1514

1615
?>
1716
--EXPECT--
1817
bool(false)
19-
bool(false)
2018
bool(true)
2119
bool(false)
2220
bool(false)

Zend/tests/exception_001.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ try {
77
try {
88
try {
99
try {
10-
throw new Exception(NULL);
10+
throw new Exception();
1111
} catch (Exception $e) {
1212
var_dump($e->getMessage());
1313
throw $e;

Zend/tests/interface_exists_001.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ interface foo {
88

99
var_dump(interface_exists('foo'));
1010
var_dump(interface_exists(1));
11-
var_dump(interface_exists(NULL));
1211

1312
?>
1413
--EXPECT--
1514
bool(true)
1615
bool(false)
17-
bool(false)

Zend/tests/nullsafe_operator/013.phpt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,21 @@ dump_error(fn() => array_key_exists('foo', $foo?->foo()));
3838

3939
?>
4040
--EXPECTF--
41+
Deprecated: {closure}(): Passing null to argument of type string is deprecated in %s on line %d
4142
int(0)
4243
bool(true)
4344
bool(false)
4445
bool(false)
4546
bool(false)
4647
bool(false)
48+
49+
Deprecated: defined(): Passing null to argument of type string is deprecated in %s on line %d
4750
bool(false)
51+
52+
Deprecated: chr(): Passing null to argument of type int is deprecated in %s on line %d
4853
string(1) "%s"
54+
55+
Deprecated: ord(): Passing null to argument of type string is deprecated in %s on line %d
4956
int(0)
5057
string(98) "call_user_func_array(): Argument #1 ($function) must be a valid callback, no array or string given"
5158
string(77) "call_user_func_array(): Argument #2 ($args) must be of type array, null given"
@@ -55,6 +62,8 @@ string(4) "NULL"
5562
string(52) "func_num_args() expects exactly 0 arguments, 1 given"
5663
string(52) "func_get_args() expects exactly 0 arguments, 1 given"
5764
string(69) "array_slice(): Argument #1 ($array) must be of type array, null given"
65+
66+
Deprecated: array_slice(): Passing null to argument of type int is deprecated in %s on line %d
5867
array(1) {
5968
[0]=>
6069
string(3) "foo"

Zend/tests/str_or_obj_of_class_zpp.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ try {
5151
}
5252

5353
?>
54-
--EXPECT--
54+
--EXPECTF--
5555
string(6) "string"
5656
string(1) "1"
57+
58+
Deprecated: zend_string_or_stdclass(): Passing null to argument of type string is deprecated in %s on line %d
5759
string(0) ""
5860
object(stdClass)#1 (0) {
5961
}

Zend/tests/str_or_obj_zpp.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ try {
3434
}
3535

3636
?>
37-
--EXPECT--
37+
--EXPECTF--
3838
string(6) "string"
3939
string(1) "1"
40+
41+
Deprecated: zend_string_or_object(): Passing null to argument of type string is deprecated in %s on line %d
4042
string(0) ""
4143
object(stdClass)#1 (0) {
4244
}

Zend/tests/trait_exists_001.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ trait foo {
88

99
var_dump(trait_exists('foo'));
1010
var_dump(trait_exists(1));
11-
var_dump(trait_exists(NULL));
1211

1312
?>
1413
--EXPECT--
1514
bool(true)
1615
bool(false)
17-
bool(false)

ext/standard/tests/array/array_filter_variation9.phpt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Test array_filter() function : usage variations - built-in functions as 'callbac
88

99
echo "*** Testing array_filter() : usage variations - built-in functions as 'callback' argument ***\n";
1010

11-
$input = array(0, 1, -1, 10, 100, 1000, null);
11+
$input = array(0, 1, -1, 10, 100, 1000);
1212

1313
// using built-in function 'is_int' as 'callback'
1414
var_dump( array_filter($input, 'is_int') );
@@ -48,7 +48,7 @@ array(6) {
4848
[5]=>
4949
int(1000)
5050
}
51-
array(7) {
51+
array(6) {
5252
[0]=>
5353
int(0)
5454
[1]=>
@@ -61,8 +61,6 @@ array(7) {
6161
int(100)
6262
[5]=>
6363
int(1000)
64-
[6]=>
65-
NULL
6664
}
6765
array_filter(): Argument #2 ($callback) must be a valid callback, function "echo" not found or invalid function name
6866
array_filter(): Argument #2 ($callback) must be a valid callback, function "exit" not found or invalid function name

ext/standard/tests/array/count_invalid_mode.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ $modes = [
1212
2,
1313
TRUE,
1414
FALSE,
15-
NULL,
1615
];
1716

1817
foreach ($modes as $mode) {
@@ -32,4 +31,3 @@ count(): Argument #2 ($mode) must be either COUNT_NORMAL or COUNT_RECURSIVE
3231
count(): Argument #2 ($mode) must be either COUNT_NORMAL or COUNT_RECURSIVE
3332
int(0)
3433
int(0)
35-
int(0)

ext/standard/tests/file/005_variation2.phpt

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ function stat_fn( $filename ) {
2828

2929
echo "*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***\n";
3030
echo "\n*** testing touch ***\n";
31-
$a = touch(NULL);
3231
$b = touch(false);
3332
$c = touch('');
3433
$d = touch(' ');
@@ -41,7 +40,6 @@ var_dump($d);
4140
var_dump($e);
4241

4342
echo "\n*** testing file info ***";
44-
stat_fn(NULL);
4543
stat_fn(false);
4644
stat_fn('');
4745
stat_fn(' ');
@@ -56,7 +54,9 @@ echo "Done";
5654
*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***
5755

5856
*** testing touch ***
59-
bool(false)
57+
58+
Warning: Undefined variable $a in %s on line %d
59+
NULL
6060
bool(false)
6161
bool(false)
6262
bool(true)
@@ -73,11 +73,6 @@ bool(true)
7373
-- File modification time is =>
7474
-- inode change time is =>
7575

76-
-- File '' --
77-
-- File access time is =>
78-
-- File modification time is =>
79-
-- inode change time is =>
80-
8176
-- File ' ' --
8277
-- File access time is => %d
8378
-- File modification time is => %d

ext/standard/tests/file/basename.phpt

-333 Bytes
Binary file not shown.

ext/standard/tests/file/basename_basic.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ $file_paths = array (
5656
/* empty paths */
5757
"",
5858
'',
59-
NULL,
6059
);
6160

6261
foreach ($file_paths as $file_path) {
@@ -98,4 +97,3 @@ string(1) " "
9897
string(1) " "
9998
string(0) ""
10099
string(0) ""
101-
string(0) ""

ext/standard/tests/file/bug51094.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ Fixed bug #51094 (parse_ini_file() with INI_SCANNER_RAW cuts a value that includ
33
--FILE--
44
<?php
55

6-
$ini = parse_ini_string('ini="ini;raw"', null, INI_SCANNER_RAW);
6+
$ini = parse_ini_string('ini="ini;raw"', false, INI_SCANNER_RAW);
77
var_dump($ini['ini']);
8-
$ini = parse_ini_string('ini="ini;raw', null, INI_SCANNER_RAW);
8+
$ini = parse_ini_string('ini="ini;raw', false, INI_SCANNER_RAW);
99
var_dump($ini['ini']);
10-
$ini = parse_ini_string('ini=ini;raw', null, INI_SCANNER_RAW);
10+
$ini = parse_ini_string('ini=ini;raw', false, INI_SCANNER_RAW);
1111
var_dump($ini['ini']);
12-
$ini = parse_ini_string('ini=ini"raw', null, INI_SCANNER_RAW);
12+
$ini = parse_ini_string('ini=ini"raw', false, INI_SCANNER_RAW);
1313
var_dump($ini['ini']);
14-
$ini = parse_ini_string("ini=\r\niniraw", null, INI_SCANNER_RAW);
14+
$ini = parse_ini_string("ini=\r\niniraw", false, INI_SCANNER_RAW);
1515
var_dump($ini['ini']);
1616
?>
1717
--EXPECT--

ext/standard/tests/file/bug61961.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Bug #61961 (file_get_content leaks when access empty file with max length)
55
$tmp_empty_file = __FILE__ . ".tmp";
66
file_put_contents($tmp_empty_file, "");
77

8-
var_dump(file_get_contents($tmp_empty_file, NULL, NULL, NULL, 10));
8+
var_dump(file_get_contents($tmp_empty_file, false, NULL, 0, 10));
99
unlink($tmp_empty_file);
1010
?>
1111
--EXPECT--

ext/standard/tests/file/chgrp.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if(substr(PHP_OS, 0, 3) == "WIN")
88
--FILE--
99
<?php
1010
try {
11-
chgrp("sjhgfskhagkfdgskjfhgskfsdgfkdsajf", null);
11+
chgrp("sjhgfskhagkfdgskjfhgskfsdgfkdsajf", 0);
1212
} catch (TypeError $exception) {
1313
echo $exception->getMessage() . "\n";
1414
}

ext/standard/tests/file/chown.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if(substr(PHP_OS, 0, 3) == "WIN")
77
?>
88
--FILE--
99
<?php
10-
chown("sjhgfskhagkfdgskjfhgskfsdgfkdsajf", NULL);
10+
chown("sjhgfskhagkfdgskjfhgskfsdgfkdsajf", 0);
1111
echo "ALIVE\n";
1212
?>
1313
--EXPECTF--

ext/standard/tests/file/fgetcsv_error_conditions.phpt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,23 @@ try {
2727
echo $e->getMessage() . \PHP_EOL;
2828
}
2929

30-
echo 'fgetcsv() with delimiter as NULL' . \PHP_EOL;
30+
echo 'fgetcsv() with delimiter as empty string' . \PHP_EOL;
3131
try {
32-
var_dump( fgetcsv($file_handle, $length, NULL, $enclosure) );
32+
var_dump( fgetcsv($file_handle, $length, '', $enclosure) );
3333
} catch (\ValueError $e) {
3434
echo $e->getMessage() . \PHP_EOL;
3535
}
3636

37-
echo 'fgetcsv() with enclosure as NULL' . \PHP_EOL;
37+
echo 'fgetcsv() with enclosure as empty string' . \PHP_EOL;
3838
try {
39-
var_dump( fgetcsv($file_handle, $length, $delimiter, NULL) );
39+
var_dump( fgetcsv($file_handle, $length, $delimiter, '') );
4040
} catch (\ValueError $e) {
4141
echo $e->getMessage() . \PHP_EOL;
4242
}
4343

44-
echo 'fgetcsv() with delimiter & enclosure as NULL' . \PHP_EOL;
44+
echo 'fgetcsv() with delimiter & enclosure as empty string' . \PHP_EOL;
4545
try {
46-
var_dump( fgetcsv($file_handle, $length, NULL, NULL) );
46+
var_dump( fgetcsv($file_handle, $length, '', '') );
4747
} catch (\ValueError $e) {
4848
echo $e->getMessage() . \PHP_EOL;
4949
}
@@ -53,9 +53,9 @@ fgetcsv() with negative length
5353
fgetcsv(): Argument #2 ($length) must be a greater than or equal to 0
5454
fgetcsv(): Argument #2 ($length) must be a greater than or equal to 0
5555
fgetcsv(): Argument #2 ($length) must be a greater than or equal to 0
56-
fgetcsv() with delimiter as NULL
56+
fgetcsv() with delimiter as empty string
5757
fgetcsv(): Argument #3 ($separator) must be a single character
58-
fgetcsv() with enclosure as NULL
58+
fgetcsv() with enclosure as empty string
5959
fgetcsv(): Argument #4 ($enclosure) must be a single character
60-
fgetcsv() with delimiter & enclosure as NULL
60+
fgetcsv() with delimiter & enclosure as empty string
6161
fgetcsv(): Argument #3 ($separator) must be a single character

ext/standard/tests/file/file_exists_variation1.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Dave Kelsey <[email protected]>
66
<?php
77
echo "*** Testing file_exists() : usage variations ***\n";
88

9-
var_dump(file_exists(NULL));
109
var_dump(file_exists(false));
1110
var_dump(file_exists(''));
1211
var_dump(file_exists(' '));
@@ -19,5 +18,4 @@ bool(false)
1918
bool(false)
2019
bool(false)
2120
bool(false)
22-
bool(false)
2321
Done

ext/standard/tests/file/file_get_contents_variation8.phpt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ $names_arr = array(
1919
-1,
2020
TRUE,
2121
FALSE,
22-
NULL,
2322
"",
2423
" ",
2524
"\0",
@@ -57,20 +56,18 @@ ValueError: Path cannot be empty
5756
-- Iteration 3 --
5857
ValueError: Path cannot be empty
5958
-- Iteration 4 --
60-
ValueError: Path cannot be empty
61-
-- Iteration 5 --
6259

6360
Warning: file_get_contents( ): Failed to open stream: No such file or directory in %s on line %d
6461
bool(false)
65-
-- Iteration 6 --
62+
-- Iteration 5 --
6663
ValueError: file_get_contents(): Argument #1 ($filename) must not contain any null bytes
67-
-- Iteration 7 --
64+
-- Iteration 6 --
6865
TypeError: file_get_contents(): Argument #1 ($filename) must be of type string, array given
69-
-- Iteration 8 --
66+
-- Iteration 7 --
7067

7168
Warning: file_get_contents(/no/such/file/dir): Failed to open stream: No such file or directory in %s on line %d
7269
bool(false)
73-
-- Iteration 9 --
70+
-- Iteration 8 --
7471

7572
Warning: file_get_contents(php/php): Failed to open stream: No such file or directory in %s on line %d
7673
bool(false)

ext/standard/tests/file/file_put_contents_variation5.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ runtest();
1919
$newpath = "";
2020
set_include_path($newpath);
2121
runtest();
22-
set_include_path(null);
22+
set_include_path("");
2323
runtest();
2424
set_include_path(";; ; ;c:\\rubbish");
2525
runtest();

0 commit comments

Comments
 (0)