Skip to content

Commit 545eb77

Browse files
committed
Update more tests (WIP)
1 parent 9b74ddb commit 545eb77

File tree

51 files changed

+82
-178
lines changed

Some content is hidden

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

51 files changed

+82
-178
lines changed

ext/dba/tests/dba_handlers.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ check(dba_handlers());
3131

3232
echo "Test 2\n";
3333

34-
check(dba_handlers(null));
34+
check(dba_handlers(false));
3535

3636
echo "Test 3\n";
3737

ext/hash/tests/hash_init_error.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ catch (\Error $e) {
3737

3838

3939
?>
40-
--EXPECT--
40+
--EXPECTF--
4141
*** Testing hash_init(): error conditions ***
4242

4343
-- Testing hash_init() function with unknown algorithms --
@@ -48,4 +48,6 @@ hash_init(): Argument #1 ($algo) must be a cryptographic hashing algorithm if HM
4848

4949
-- Testing hash_init() function with HASH_HMAC and no key --
5050
hash_init(): Argument #3 ($key) cannot be empty when HMAC is requested
51+
52+
Deprecated: hash_init(): Passing null to parameter of type string is deprecated in %s on line %d
5153
hash_init(): Argument #3 ($key) cannot be empty when HMAC is requested

ext/iconv/tests/iconv_mime_decode-charset-length-cve-2007-4840.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ iconv_mime_decode() charset parameter length checks (CVE-2007-4840)
55
--FILE--
66
<?php
77
$a = str_repeat("/", 9000000);
8-
var_dump(iconv_mime_decode("a", null, $a));
8+
var_dump(iconv_mime_decode("a", 0, $a));
99
?>
1010
--EXPECTF--
1111
Warning: iconv_mime_decode(): Encoding parameter exceeds the maximum allowed length of 64 characters in %s on line %d

ext/iconv/tests/iconv_mime_decode_headers-charset-length-cve-2007-4840.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ iconv_mime_decode_headers() charset parameter length checks (CVE-2007-4840)
55
--FILE--
66
<?php
77
$a = str_repeat("/", 9000000);
8-
var_dump(iconv_mime_decode_headers("a", null, $a));
8+
var_dump(iconv_mime_decode_headers("a", 0, $a));
99
?>
1010
--EXPECTF--
1111
Warning: iconv_mime_decode_headers(): Encoding parameter exceeds the maximum allowed length of 64 characters in %s on line %d

ext/imap/tests/bug45705_1.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ extension_loaded('imap') or die('skip imap extension not available in this build
99

1010
$address = 'John Doe <john@example.com>';
1111
var_dump($address);
12-
imap_rfc822_parse_adrlist($address, null);
12+
imap_rfc822_parse_adrlist($address, '');
1313
var_dump($address);
1414

1515
?>

ext/json/tests/001.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ NULL
3131
NULL
3232
NULL
3333
NULL
34+
35+
Deprecated: json_decode(): Passing null to parameter of type string is deprecated in %s on line %d
3436
NULL
3537
object(stdClass)#%d (1) {
3638
["test"]=>

ext/json/tests/bug69187.phpt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
Bug #69187 json_last_error return BC in PHP7
33
--FILE--
44
<?php
5-
var_dump(json_decode(NULL));
6-
var_dump(json_last_error());
75
var_dump(json_decode(FALSE));
86
var_dump(json_last_error());
97
var_dump(json_decode(""));
@@ -33,8 +31,6 @@ NULL
3331
int(4)
3432
NULL
3533
int(4)
36-
NULL
37-
int(4)
3834
int(0)
3935
int(0)
4036
int(1)

ext/json/tests/bug72069.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ Bug #72069 (Behavior \JsonSerializable different from json_encode)
33
--FILE--
44
<?php
55

6-
$result = json_encode(['end' => json_decode(null, true)]);
6+
$result = json_encode(['end' => json_decode('', true)]);
77
var_dump($result);
88

99
class A implements \JsonSerializable
1010
{
1111
function jsonSerialize()
1212
{
13-
return ['end' => json_decode(null, true)];
13+
return ['end' => json_decode('', true)];
1414
}
1515
}
1616
$a = new A();

ext/ldap/tests/ldap_escape_filter.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ldap_escape() test filter
77

88
$subject = 'foo=bar(baz)*';
99

10-
var_dump(ldap_escape($subject, null, LDAP_ESCAPE_FILTER));
10+
var_dump(ldap_escape($subject, '', LDAP_ESCAPE_FILTER));
1111

1212
?>
1313
--EXPECT--

ext/openssl/tests/openssl_decrypt_ccm.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ foreach ($methods as $method) {
2424

2525
// no IV
2626
var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
27-
NULL, $test['tag'], $test['aad']));
27+
'', $test['tag'], $test['aad']));
2828
// failed because no AAD
2929
var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
3030
$test['iv'], $test['tag']));

ext/openssl/tests/openssl_decrypt_gcm.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ foreach ($tests as $idx => $test) {
2222

2323
// no IV
2424
var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
25-
NULL, $test['tag'], $test['aad']));
25+
'', $test['tag'], $test['aad']));
2626
// failed because no AAD
2727
var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
2828
$test['iv'], $test['tag']));

ext/openssl/tests/openssl_decrypt_ocb.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ foreach ($tests as $idx => $test) {
2222

2323
// no IV
2424
var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
25-
NULL, $test['tag'], $test['aad']));
25+
'', $test['tag'], $test['aad']));
2626

2727
// IV too long
2828
var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,

ext/openssl/tests/openssl_encrypt_ccm.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ foreach ($methods as $method) {
2424
}
2525

2626
// Empty IV error
27-
var_dump(openssl_encrypt('data', $method, 'password', 0, NULL, $tag, ''));
27+
var_dump(openssl_encrypt('data', $method, 'password', 0, '', $tag, ''));
2828

2929
// Test setting different IV length and tag length
3030
var_dump(openssl_encrypt('data', $method, 'password', 0, str_repeat('x', 10), $tag, '', 14));

ext/openssl/tests/openssl_encrypt_gcm.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ foreach ($tests as $idx => $test) {
2222
}
2323

2424
// Empty IV error
25-
var_dump(openssl_encrypt('data', $method, 'password', 0, NULL, $tag, ''));
25+
var_dump(openssl_encrypt('data', $method, 'password', 0, '', $tag, ''));
2626

2727
// Failing to retrieve tag (max is 16 bytes)
2828
var_dump(openssl_encrypt('data', $method, 'password', 0, str_repeat('x', 32), $tag, '', 20));

ext/openssl/tests/openssl_encrypt_ocb.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ foreach ($tests as $idx => $test) {
2222
}
2323

2424
// Empty IV error
25-
var_dump(openssl_encrypt('data', $method, 'password', 0, NULL, $tag, ''));
25+
var_dump(openssl_encrypt('data', $method, 'password', 0, '', $tag, ''));
2626

2727
// Failing to retrieve tag (must be at most 16 bytes)
2828
var_dump(openssl_encrypt('data', $method, 'password', 0, str_repeat('x', 12), $tag, '', 20));

ext/openssl/tests/openssl_x509_export_basic.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ if (PHP_EOL !== "\n") {
2929

3030
var_dump(strcmp($output, $a));
3131
var_dump(strcmp($output, $output2));
32-
var_dump(strcmp($output, $output3));
33-
var_dump(strcmp($output, $output4)); // different
34-
var_dump(strcmp($output, $output5)); // different
32+
var_dump(strcmp($output, $output4));
33+
var_dump($output3);
34+
var_dump($output5);
3535
?>
3636
--EXPECTF--
3737
bool(true)
@@ -44,5 +44,5 @@ openssl_x509_export(): Argument #1 ($certificate) must be of type OpenSSLCertifi
4444
int(0)
4545
int(0)
4646
int(%d)
47-
int(0)
48-
int(%d)
47+
NULL
48+
NULL

ext/posix/tests/posix_initgroups.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if (!function_exists('posix_initgroups')) die('skip posix_initgroups() not found
88
--FILE--
99
<?php
1010

11-
var_dump(posix_initgroups(NULL, NULL));
11+
var_dump(posix_initgroups('', 0));
1212

1313
?>
1414
--EXPECT--

ext/posix/tests/posix_mknod.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if (!function_exists('posix_mknod')) die('skip posix_mknod() not found');
88
--FILE--
99
<?php
1010

11-
var_dump(posix_mknod(NULL, NULL, NULL, NULL));
11+
var_dump(posix_mknod('', 0, 0, 0));
1212

1313
?>
1414
--EXPECT--

ext/posix/tests/posix_mknod_basic.phpt

Lines changed: 0 additions & 18 deletions
This file was deleted.

ext/readline/tests/libedit_write_history_001.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ $name = tempnam('/tmp', 'readline.tmp');
1616
readline_add_history('foo');
1717
readline_add_history('');
1818
readline_add_history(1);
19-
readline_add_history(NULL);
2019
readline_write_history($name);
2120

2221
var_dump(file_get_contents($name));
@@ -25,9 +24,8 @@ unlink($name);
2524

2625
?>
2726
--EXPECT--
28-
string(21) "_HiStOrY_V2_
27+
string(20) "_HiStOrY_V2_
2928
foo
3029

3130
1
32-
3331
"

ext/readline/tests/readline_add_history_001.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ readline_add_history(): Basic test
77

88
var_dump(readline_add_history('foo'));
99
var_dump(readline_list_history());
10-
var_dump(readline_add_history(NULL));
10+
var_dump(readline_add_history(''));
1111
var_dump(readline_list_history());
1212
var_dump(readline_clear_history());
1313

ext/reflection/tests/ReflectionClass_constructor_002.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ try {
4545
}
4646

4747
?>
48-
--EXPECT--
48+
--EXPECTF--
4949
ReflectionClass::__construct() expects exactly 1 argument, 0 given
50+
51+
Deprecated: ReflectionClass::__construct(): Passing null to parameter of type string is deprecated in %s on line %d
5052
Class "" does not exist
5153
Class "1" does not exist
5254
Class "1" does not exist

ext/reflection/tests/ReflectionClass_getConstant_error.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ class C {
88

99
$rc = new ReflectionClass("C");
1010
echo "Check invalid params:\n";
11-
var_dump($rc->getConstant(null));
1211
var_dump($rc->getConstant(1));
1312
var_dump($rc->getConstant(1.5));
1413
var_dump($rc->getConstant(true));
@@ -18,4 +17,3 @@ Check invalid params:
1817
bool(false)
1918
bool(false)
2019
bool(false)
21-
bool(false)

ext/reflection/tests/ReflectionClass_getMethod_002.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,12 @@ try {
5454

5555

5656
?>
57-
--EXPECT--
57+
--EXPECTF--
5858
Check invalid params:
5959
ReflectionClass::getMethod() expects exactly 1 argument, 0 given
6060
ReflectionClass::getMethod() expects exactly 1 argument, 2 given
61+
62+
Deprecated: ReflectionClass::getMethod(): Passing null to parameter of type string is deprecated in %s on line %d
6163
Method C::() does not exist
6264
Method C::1() does not exist
6365
Method C::1.5() does not exist

ext/reflection/tests/ReflectionClass_getProperty_002.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@ try {
5252
echo $e->getMessage() . "\n";
5353
}
5454
?>
55-
--EXPECT--
55+
--EXPECTF--
5656
Check invalid params:
5757
ReflectionClass::getProperty() expects exactly 1 argument, 0 given
5858
ReflectionClass::getProperty() expects exactly 1 argument, 2 given
59+
60+
Deprecated: ReflectionClass::getProperty(): Passing null to parameter of type string is deprecated in %s on line %d
5961
Property C::$ does not exist
6062
Property C::$1 does not exist
6163
Property C::$1.5 does not exist

ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ try {
3838

3939

4040
?>
41-
--EXPECT--
41+
--EXPECTF--
4242
ReflectionClass::getStaticPropertyValue() expects at most 2 arguments, 3 given
4343
ReflectionClass::getStaticPropertyValue() expects at least 1 argument, 0 given
44+
45+
Deprecated: ReflectionClass::getStaticPropertyValue(): Passing null to parameter of type string is deprecated in %s on line %d
4446
Property C::$ does not exist
4547
string(3) "def"
4648
ReflectionClass::getStaticPropertyValue(): Argument #1 ($name) must be of type string, array given

ext/reflection/tests/ReflectionClass_hasConstant_002.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ class C {
1111

1212
$rc = new ReflectionClass("C");
1313
echo "Check invalid params:\n";
14-
var_dump($rc->hasConstant(null));
1514
var_dump($rc->hasConstant(1));
1615
var_dump($rc->hasConstant(1.5));
1716
var_dump($rc->hasConstant(true));
@@ -21,4 +20,3 @@ Check invalid params:
2120
bool(false)
2221
bool(false)
2322
bool(false)
24-
bool(false)

ext/reflection/tests/ReflectionClass_hasMethod_002.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ class C {
1111

1212
$rc = new ReflectionClass("C");
1313
echo "Check invalid params:\n";
14-
var_dump($rc->hasMethod(null));
1514
var_dump($rc->hasMethod(1));
1615
var_dump($rc->hasMethod(1.5));
1716
var_dump($rc->hasMethod(true));
@@ -21,4 +20,3 @@ Check invalid params:
2120
bool(false)
2221
bool(false)
2322
bool(false)
24-
bool(false)

ext/reflection/tests/ReflectionClass_hasProperty_002.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ class C {
1111

1212
$rc = new ReflectionClass("C");
1313
echo "Check invalid params:\n";
14-
var_dump($rc->hasProperty(null));
1514
var_dump($rc->hasProperty(1));
1615
var_dump($rc->hasProperty(1.5));
1716
var_dump($rc->hasProperty(true));
@@ -21,4 +20,3 @@ Check invalid params:
2120
bool(false)
2221
bool(false)
2322
bool(false)
24-
bool(false)

ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ try {
6565
echo $e->getMessage() . "\n";
6666
}
6767
?>
68-
--EXPECT--
68+
--EXPECTF--
6969
Does A implement A?
7070
- Using object argument: A is not an interface
7171
- Using string argument: A is not an interface
@@ -146,6 +146,8 @@ Does I2 implement I2?
146146
Test bad arguments:
147147
ReflectionClass::implementsInterface() expects exactly 1 argument, 0 given
148148
ReflectionClass::implementsInterface() expects exactly 1 argument, 2 given
149+
150+
Deprecated: ReflectionClass::implementsInterface(): Passing null to parameter of type string is deprecated in %s on line %d
149151
Interface "" does not exist
150152
Interface "ThisClassDoesNotExist" does not exist
151153
Interface "2" does not exist

ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ try {
3535
echo $e->getMessage() . "\n";
3636
}
3737
?>
38-
--EXPECT--
38+
--EXPECTF--
3939
Test bad arguments:
4040
ReflectionClass::isSubclassOf() expects exactly 1 argument, 0 given
4141
ReflectionClass::isSubclassOf() expects exactly 1 argument, 2 given
42+
43+
Deprecated: ReflectionClass::isSubclassOf(): Passing null to parameter of type string is deprecated in %s on line %d
4244
Class "" does not exist
4345
Class "ThisClassDoesNotExist" does not exist
4446
Class "2" does not exist

ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@ try {
4343

4444

4545
?>
46-
--EXPECT--
46+
--EXPECTF--
4747
ReflectionClass::setStaticPropertyValue() expects exactly 2 arguments, 3 given
4848
ReflectionClass::setStaticPropertyValue() expects exactly 2 arguments, 0 given
4949
ReflectionClass::setStaticPropertyValue() expects exactly 2 arguments, 1 given
50+
51+
Deprecated: ReflectionClass::setStaticPropertyValue(): Passing null to parameter of type string is deprecated in %s on line %d
5052
Class C does not have a property named
5153
Class C does not have a property named 1.5
5254
ReflectionClass::setStaticPropertyValue(): Argument #1 ($name) must be of type string, array given

0 commit comments

Comments
 (0)