Skip to content

Commit 30bf210

Browse files
committed
general functions test fixes
1 parent 35e092d commit 30bf210

Some content is hidden

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

77 files changed

+134
-706
lines changed
42 Bytes
Binary file not shown.

ext/standard/tests/strings/bug54322.phpt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
Bug #54322: Null pointer deref in get_html_translation_table due to information loss in long-to-int conversion
33
--FILE--
44
<?php
5-
var_dump(
6-
get_html_translation_table(NAN, 0, "UTF-8") > 0
7-
);
8-
--EXPECTF--
9-
Warning: get_html_translation_table() expects parameter 1 to be int, float given in %s on line %d
10-
bool(false)
5+
try {
6+
var_dump(get_html_translation_table(NAN, 0, "UTF-8") > 0);
7+
} catch (TypeError $e) {
8+
echo $e->getMessage(), "\n";
9+
}
10+
?>
11+
--EXPECT--
12+
get_html_translation_table() expects parameter 1 to be int, float given

ext/standard/tests/strings/chr_error.phpt

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,28 @@ Test chr() function : error conditions
1111
echo "*** Testing chr() : error conditions ***\n";
1212

1313
echo "\n-- Testing chr() function with no arguments --\n";
14-
var_dump( chr() );
14+
try {
15+
var_dump( chr() );
16+
} catch (TypeError $e) {
17+
echo $e->getMessage(), "\n";
18+
}
1519

1620
echo "\n-- Testing chr() function with more than expected no. of arguments --\n";
1721
$extra_arg = 10;
18-
var_dump( chr(72, $extra_arg) );
22+
try {
23+
var_dump( chr(72, $extra_arg) );
24+
} catch (TypeError $e) {
25+
echo $e->getMessage(), "\n";
26+
}
1927

2028
?>
2129
===DONE===
2230
--EXPECTF--
2331
*** Testing chr() : error conditions ***
2432

2533
-- Testing chr() function with no arguments --
26-
27-
Warning: Wrong parameter count for chr() in %s on line %d
28-
NULL
34+
Wrong parameter count for chr()
2935

3036
-- Testing chr() function with more than expected no. of arguments --
31-
32-
Warning: Wrong parameter count for chr() in %s on line %d
33-
NULL
37+
Wrong parameter count for chr()
3438
===DONE===
-717 Bytes
Binary file not shown.
Binary file not shown.

ext/standard/tests/strings/chunk_split_variation8.phpt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ $values = array (
4646
// loop through each element of values for 'chunklen'
4747
for($count = 0; $count < count($values); $count++) {
4848
echo "-- Iteration ".($count+1). " --\n";
49-
var_dump( chunk_split($heredoc_str, $values[$count], $ending) );
49+
try {
50+
var_dump( chunk_split($heredoc_str, $values[$count], $ending) );
51+
} catch (TypeError $e) {
52+
echo $e->getMessage(), "\n";
53+
}
5054
}
5155

5256
echo "Done"
@@ -82,9 +86,7 @@ string(129) "This's heredoc string with and
8286
It has _speci@l ch@r$ 2222 !!!Now \k as escape char to test
8387
chunk_split():::"
8488
-- Iteration 7 --
85-
86-
Warning: chunk_split() expects parameter 2 to be int, float given in %s on line %d
87-
NULL
89+
chunk_split() expects parameter 2 to be int, float given
8890
-- Iteration 8 --
8991

9092
Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d

ext/standard/tests/strings/convert_cyr_string.phpt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ basic convert_cyr_string() tests
33
--FILE--
44
<?php
55

6-
var_dump(convert_cyr_string());
7-
var_dump(convert_cyr_string(""));
8-
var_dump(convert_cyr_string("", ""));
96
var_dump(convert_cyr_string("", "", ""));
107
var_dump(convert_cyr_string(array(), array(), array()));
118

@@ -20,15 +17,6 @@ var_dump(convert_cyr_string("", "d", "i"));
2017
echo "Done\n";
2118
?>
2219
--EXPECTF--
23-
Warning: convert_cyr_string() expects exactly 3 parameters, 0 given in %s on line %d
24-
NULL
25-
26-
Warning: convert_cyr_string() expects exactly 3 parameters, 1 given in %s on line %d
27-
NULL
28-
29-
Warning: convert_cyr_string() expects exactly 3 parameters, 2 given in %s on line %d
30-
NULL
31-
3220
Warning: convert_cyr_string(): Unknown source charset: in %s on line %d
3321

3422
Warning: convert_cyr_string(): Unknown destination charset: in %s on line %d

ext/standard/tests/strings/convert_cyr_string_error.phpt

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,6 @@ $extra_arg = 10;
1515

1616
echo "*** Testing convert_cyr_string() : error conditions ***\n";
1717

18-
echo "\n-- Testing convert_cyr_string() function with no arguments --\n";
19-
var_dump( convert_cyr_string() );
20-
21-
echo "\n-- Testing convert_cyr_string() function with no 'to' character set --\n";
22-
var_dump( convert_cyr_string($str, $from) );
23-
24-
echo "\n-- Testing convert_cyr_string() function with more than expected no. of arguments --\n";
25-
var_dump( convert_cyr_string($str, $from, $to, $extra_arg) );
26-
2718
echo "\n-- Testing convert_cyr_string() function with invalid 'from' character set --\n";
2819
var_dump(bin2hex( convert_cyr_string($str, "?", $to) ));
2920

@@ -38,21 +29,6 @@ var_dump(bin2hex( convert_cyr_string($str, ">", "?")) );
3829
--EXPECTF--
3930
*** Testing convert_cyr_string() : error conditions ***
4031

41-
-- Testing convert_cyr_string() function with no arguments --
42-
43-
Warning: convert_cyr_string() expects exactly 3 parameters, 0 given in %s on line %d
44-
NULL
45-
46-
-- Testing convert_cyr_string() function with no 'to' character set --
47-
48-
Warning: convert_cyr_string() expects exactly 3 parameters, 2 given in %s on line %d
49-
NULL
50-
51-
-- Testing convert_cyr_string() function with more than expected no. of arguments --
52-
53-
Warning: convert_cyr_string() expects exactly 3 parameters, 4 given in %s on line %d
54-
NULL
55-
5632
-- Testing convert_cyr_string() function with invalid 'from' character set --
5733

5834
Warning: convert_cyr_string(): Unknown source charset: ? in %s on line %d

ext/standard/tests/strings/crypt.phpt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ echo (CRYPT_MD5) ? ((crypt($str, $salt3) === $res_3) ? 'MD5' : 'MD5 - ERROR
1919
echo (CRYPT_BLOWFISH) ? ((crypt($str, $salt4) === $res_4) ? 'BLO' : 'BLO - ERROR') : 'BLO', "\n";
2020

2121
var_dump(crypt($str));
22-
var_dump(crypt());
23-
var_dump(crypt("", "", ""));
2422

2523
?>
2624
--EXPECTF--
@@ -31,9 +29,3 @@ BLO
3129

3230
Notice: crypt(): No salt parameter was specified. You must use a randomly generated salt and a strong hash function to produce a secure hash. in %s on line %d
3331
string(%d) "%s"
34-
35-
Warning: crypt() expects at least 1 parameter, 0 given in %s on line %d
36-
NULL
37-
38-
Warning: crypt() expects at most 2 parameters, 3 given in %s on line %d
39-
NULL

ext/standard/tests/strings/dirname_error.phpt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,15 @@ Test dirname() function : error conditions
66
Description: Returns directory name component of path.
77
*/
88
echo "*** Testing error conditions ***\n";
9-
// zero arguments
10-
var_dump( dirname() );
119

1210
// Bad arg
1311
var_dump( dirname("/var/tmp/bar.gz", 0) );
1412

15-
// more than expected no. of arguments
16-
var_dump( dirname("/var/tmp/bar.gz", 1, ".gz") );
17-
1813
echo "Done\n";
1914
?>
2015
--EXPECTF--
2116
*** Testing error conditions ***
2217

23-
Warning: dirname() expects at least 1 parameter, 0 given in %s on line %d
24-
NULL
25-
2618
Warning: dirname(): Invalid argument, levels must be >= 1 in %s on line %d
2719
NULL
28-
29-
Warning: dirname() expects at most 2 parameters, 3 given in %s on line %d
30-
NULL
3120
Done

0 commit comments

Comments
 (0)