Skip to content

Commit 1084c4e

Browse files
committed
Fix tests
1 parent 1257d42 commit 1084c4e

File tree

4 files changed

+39
-32
lines changed

4 files changed

+39
-32
lines changed

ext/mbstring/tests/bug73646.phpt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@ if (!function_exists('mb_ereg')) die('skip mbregex support not available');
77
?>
88
--FILE--
99
<?php
10+
$v1;
11+
12+
try {
13+
$v1=str_repeat("#", -1);
14+
} catch (\ErrorException $e) {
15+
echo $e->getMessage() . "\n";
16+
}
1017

11-
$v1=str_repeat("#", -1);
1218
var_dump(mb_ereg_search_init($v1));
1319
?>
14-
--EXPECTF--
15-
Warning: str_repeat(): Second argument has to be greater than or equal to 0 in %sbug73646.php on line %d
20+
--EXPECT--
21+
Second argument has to be greater than or equal to 0
1622
bool(true)

ext/opcache/tests/bug70207.phpt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ function bar() {
1414
}
1515
function foo() {
1616
try { return bar(); }
17-
finally { @str_repeat("foo", -10); }
17+
finally {
18+
try { @str_repeat("foo", -10); }
19+
catch (\ErrorException $e) {}
20+
}
1821
}
1922

2023
var_dump(foo());

ext/standard/tests/strings/str_split_variation6.phpt

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
1818
* passing different integer values for 'split_length' argument to str_split()
1919
*/
2020

21-
echo "*** Testing str_split() : different intger values for 'split_length' ***\n";
21+
echo "*** Testing str_split() : different integer values for 'split_length' ***\n";
2222
//Initialise variables
2323
$str = 'This is a string with 123 & escape char \t';
2424

@@ -35,17 +35,20 @@ $values = array (
3535

3636
//loop through each element of $values for 'split_length'
3737
for($count = 0; $count < count($values); $count++) {
38-
echo "-- Iteration ".($count + 1)." --\n";
39-
var_dump( str_split($str, $values[$count]) );
38+
echo "-- Iteration ".($count + 1)." --\n";
39+
40+
try {
41+
var_dump( str_split($str, $values[$count]) );
42+
} catch (\ErrorException $e) {
43+
echo $e->getMessage() . "\n";
44+
}
4045
}
4146
echo "Done"
4247
?>
43-
--EXPECTF--
44-
*** Testing str_split() : different intger values for 'split_length' ***
48+
--EXPECT--
49+
*** Testing str_split() : different integer values for 'split_length' ***
4550
-- Iteration 1 --
46-
47-
Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
48-
bool(false)
51+
The length of each segment must be greater than zero
4952
-- Iteration 2 --
5053
array(42) {
5154
[0]=>
@@ -134,9 +137,7 @@ array(42) {
134137
string(1) "t"
135138
}
136139
-- Iteration 3 --
137-
138-
Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
139-
bool(false)
140+
The length of each segment must be greater than zero
140141
-- Iteration 4 --
141142
array(1) {
142143
[0]=>
@@ -155,7 +156,5 @@ array(1) {
155156
string(42) "This is a string with 123 & escape char \t"
156157
}
157158
-- Iteration 7 --
158-
159-
Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
160-
bool(false)
159+
The length of each segment must be greater than zero
161160
Done

ext/standard/tests/strings/str_split_variation7.phpt

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
1818
* passing different integer values for 'split_length' and heredoc string as 'str' argument to str_split()
1919
*/
2020

21-
echo "*** Testing str_split() : different intger values for 'split_length' with heredoc 'str' ***\n";
21+
echo "*** Testing str_split() : different integer values for 'split_length' with heredoc 'str' ***\n";
2222
//Initialise variables
2323
$str = <<<EOT
2424
string with 123,escape char \t.
@@ -37,17 +37,20 @@ $values = array (
3737

3838
//loop through each element of $values for 'split_length'
3939
for($count = 0; $count < count($values); $count++) {
40-
echo "-- Iteration ".($count + 1)." --\n";
41-
var_dump( str_split($str, $values[$count]) );
40+
echo "-- Iteration ".($count + 1)." --\n";
41+
42+
try {
43+
var_dump( str_split($str, $values[$count]) );
44+
} catch (\ErrorException $e) {
45+
echo $e->getMessage() . "\n";
46+
}
4247
}
4348
echo "Done"
4449
?>
45-
--EXPECTF--
46-
*** Testing str_split() : different intger values for 'split_length' with heredoc 'str' ***
50+
--EXPECT--
51+
*** Testing str_split() : different integer values for 'split_length' with heredoc 'str' ***
4752
-- Iteration 1 --
48-
49-
Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
50-
bool(false)
53+
The length of each segment must be greater than zero
5154
-- Iteration 2 --
5255
array(30) {
5356
[0]=>
@@ -112,9 +115,7 @@ array(30) {
112115
string(1) "."
113116
}
114117
-- Iteration 3 --
115-
116-
Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
117-
bool(false)
118+
The length of each segment must be greater than zero
118119
-- Iteration 4 --
119120
array(1) {
120121
[0]=>
@@ -133,7 +134,5 @@ array(1) {
133134
string(30) "string with 123,escape char ."
134135
}
135136
-- Iteration 7 --
136-
137-
Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
138-
bool(false)
137+
The length of each segment must be greater than zero
139138
Done

0 commit comments

Comments
 (0)