Skip to content

Commit 02c989e

Browse files
committed
Update more tests (WIP)
1 parent ab45157 commit 02c989e

11 files changed

+48
-25
lines changed

ext/filter/tests/055.phpt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ filter_var() and FILTER_VALIDATE_MAC
55
--FILE--
66
<?php
77
$values = Array(
8-
array("01-23-45-67-89-ab", null),
8+
array("01-23-45-67-89-ab", 0),
99
array("01-23-45-67-89-ab", array("options" => array("separator" => "-"))),
1010
array("01-23-45-67-89-ab", array("options" => array("separator" => "."))),
1111
array("01-23-45-67-89-ab", array("options" => array("separator" => ":"))),
12-
array("01-23-45-67-89-AB", null),
13-
array("01-23-45-67-89-aB", null),
14-
array("01:23:45:67:89:ab", null),
15-
array("01:23:45:67:89:AB", null),
16-
array("01:23:45:67:89:aB", null),
17-
array("01:23:45-67:89:aB", null),
18-
array("xx:23:45:67:89:aB", null),
19-
array("0123.4567.89ab", null),
12+
array("01-23-45-67-89-AB", 0),
13+
array("01-23-45-67-89-aB", 0),
14+
array("01:23:45:67:89:ab", 0),
15+
array("01:23:45:67:89:AB", 0),
16+
array("01:23:45:67:89:aB", 0),
17+
array("01:23:45-67:89:aB", 0),
18+
array("xx:23:45:67:89:aB", 0),
19+
array("0123.4567.89ab", 0),
2020
array("01-23-45-67-89-ab", array("options" => array("separator" => "--"))),
2121
array("01-23-45-67-89-ab", array("options" => array("separator" => ""))),
2222
);

ext/filter/tests/057.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ foreach (array(null, true, false, 1, "", new stdClass) as $invalid) {
1919
}
2020
?>
2121
--EXPECTF--
22+
Deprecated: filter_input_array(): Passing null to parameter of type int is deprecated in %s on line %d
23+
2224
Warning: filter_input_array(): Unknown filter with ID 0 in %s on line %d
2325
bool(false)
2426

27+
Deprecated: filter_var_array(): Passing null to parameter of type int is deprecated in %s on line %d
28+
2529
Warning: filter_var_array(): Unknown filter with ID 0 in %s on line %d
2630
bool(false)
2731

ext/gd/tests/imagetruecolortopalette_error3.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require __DIR__ . '/func.inc';
1414
$image = imagecreatetruecolor(50, 50);
1515

1616
trycatch_dump(
17-
fn() => imagetruecolortopalette($image, true, null)
17+
fn() => imagetruecolortopalette($image, true, 0)
1818
);
1919

2020
?>

ext/intl/tests/bug72241.phpt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ Bug #72241: get_icu_value_internal out-of-bounds read
66
<?php
77
$var1=str_repeat("A", 1000);
88
$out = locale_get_primary_language($var1);
9-
echo strlen($out) . PHP_EOL;
10-
echo unpack('H*', $out)[1] . PHP_EOL;
9+
var_dump($out);
1110
?>
1211
--EXPECT--
13-
0
12+
NULL

ext/intl/tests/collator_compare_variant2.phpt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,11 @@ function ut_main()
7171
array( 'ab' , 'b' ),
7272
array( 'ab' , 'a' ),
7373
array( 123 , 'abc' ),
74-
array( 'ac' , null ),
74+
array( 'ac' , '' ),
7575
array( '.' , '.' ),
7676
// Try to compare long strings.
7777
array( 'abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcde',
7878
'abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdea'),
79-
array( null , null )
8079
);
8180

8281
$res_str .= compare_pairs( 'en_US', $test_params );
@@ -91,7 +90,7 @@ function ut_main()
9190
array( 'а', 'b' ),
9291
array( 'а', 'bb' ),
9392
array( 'а', 'ab' ),
94-
array( 'а', null )
93+
array( 'а', '' )
9594
);
9695

9796
$res_str .= compare_pairs( 'ru_RU', $test_params );
@@ -120,16 +119,15 @@ ut_run();
120119
'ab' < 'b'
121120
'ab' > 'a'
122121
123 < 'abc'
123-
'ac' > NULL
122+
'ac' > ''
124123
'.' = '.'
125124
'abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcde' < 'abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdea'
126-
NULL = NULL
127125
'а' < 'б'
128126
'а' < 'аа'
129127
'аб' < 'ба'
130128
'а' > ','
131129
'а' < 'b'
132130
'а' < 'bb'
133131
'а' < 'ab'
134-
'а' > NULL
132+
'а' > ''
135133
'y' < 'k'

ext/intl/tests/collator_get_sort_key_variant7.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function ut_main()
3333
$test_params = array(
3434
'abc', 'abd', 'aaa',
3535
'аа', 'а', 'z',
36-
'', null , '3',
36+
'', '3',
3737
'y' , 'i' , 'k'
3838
);
3939

@@ -70,8 +70,6 @@ source: z
7070
key: 5c01050105
7171
source:
7272
key: 0101
73-
source:
74-
key: 0101
7573
source: 3
7674
key: 1901050105
7775
source: y

ext/intl/tests/formatter_fail.phpt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,18 @@ ArgumentCountError: NumberFormatter::create() expects at least 2 arguments, 0 gi
107107
Error: NumberFormatter object is already constructed in %s on line %d
108108
'U_ZERO_ERROR'
109109

110+
Deprecated: NumberFormatter::__construct(): Passing null to parameter of type string is deprecated in %s on line %d
111+
112+
Deprecated: NumberFormatter::__construct(): Passing null to parameter of type int is deprecated in %s on line %d
113+
114+
Deprecated: NumberFormatter::create(): Passing null to parameter of type string is deprecated in %s on line %d
115+
116+
Deprecated: NumberFormatter::create(): Passing null to parameter of type int is deprecated in %s on line %d
117+
118+
Deprecated: numfmt_create(): Passing null to parameter of type string is deprecated in %s on line %d
119+
120+
Deprecated: numfmt_create(): Passing null to parameter of type int is deprecated in %s on line %d
121+
110122
IntlException: Constructor failed in %s on line %d
111123
'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR'
112124
'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR'

ext/intl/tests/gregoriancalendar___construct_error.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ try {
2929
echo $e->getMessage(), "\n";
3030
}
3131
try {
32-
var_dump(new IntlGregorianCalendar(1,2,3,4,NULL,array()));
32+
var_dump(new IntlGregorianCalendar(1,2,3,4,5,array()));
3333
} catch (TypeError $e) {
3434
echo $e->getMessage(), "\n";
3535
}

ext/intl/tests/gregoriancalendar___construct_variant1.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ini_set("intl.error_level", E_WARNING);
1010

1111
date_default_timezone_set('Europe/Amsterdam');
1212

13-
$intlcal = intlgregcal_create_instance(2012, 1, 29, 16, 0, NULL);
13+
$intlcal = intlgregcal_create_instance(2012, 1, 29, 16, 0, 0);
1414
var_dump($intlcal->getTimeZone()->getId());
1515
var_dump($intlcal->getTime(), (float)strtotime('2012-02-29 16:00:00') * 1000);
1616

ext/intl/tests/msgfmt_fail2.phpt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,21 @@ ArgumentCountError: msgfmt_create() expects exactly 2 arguments, 1 given in %s o
126126
ArgumentCountError: MessageFormatter::create() expects exactly 2 arguments, 1 given in %s on line %d
127127
'U_ZERO_ERROR'
128128

129+
Deprecated: MessageFormatter::__construct(): Passing null to parameter of type string is deprecated in %s on line %d
130+
131+
Deprecated: MessageFormatter::__construct(): Passing null to parameter of type string is deprecated in %s on line %d
132+
129133
IntlException: msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR in %s on line %d
130134
'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
135+
136+
Deprecated: MessageFormatter::create(): Passing null to parameter of type string is deprecated in %s on line %d
137+
138+
Deprecated: MessageFormatter::create(): Passing null to parameter of type string is deprecated in %s on line %d
131139
'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
140+
141+
Deprecated: msgfmt_create(): Passing null to parameter of type string is deprecated in %s on line %d
142+
143+
Deprecated: msgfmt_create(): Passing null to parameter of type string is deprecated in %s on line %d
132144
'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
133145

134146
IntlException: msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR in %s on line %d

ext/intl/tests/ut_common.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ function ut_nfmt_create( $locale, $style, $pattern = null )
142142
return numfmt_create( $locale, $style, $pattern );
143143
}
144144
}
145-
function ut_nfmt_format( $fmt, $number, $type = null )
145+
function ut_nfmt_format( $fmt, $number, $type = NumberFormatter::TYPE_DEFAULT )
146146
{
147147
return $GLOBALS['oo-mode'] ? $fmt->format( $number, $type ) : numfmt_format( $fmt, $number, $type );
148148
}

0 commit comments

Comments
 (0)