File tree Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -6068,8 +6068,8 @@ PHP_FUNCTION(strpbrk)
6068
6068
ZEND_PARSE_PARAMETERS_END ();
6069
6069
6070
6070
if (!ZSTR_LEN (char_list )) {
6071
- php_error_docref ( NULL , E_WARNING , "The character list cannot be empty" );
6072
- RETURN_FALSE ;
6071
+ zend_value_error ( "The character list cannot be empty" );
6072
+ return ;
6073
6073
}
6074
6074
6075
6075
for (haystack_ptr = ZSTR_VAL (haystack ); haystack_ptr < (ZSTR_VAL (haystack ) + ZSTR_LEN (haystack )); ++ haystack_ptr ) {
Original file line number Diff line number Diff line change @@ -8,18 +8,16 @@ Test strpbrk() function : error conditions
8
8
* Alias to functions:
9
9
*/
10
10
11
- echo "*** Testing strpbrk() : error conditions *** \n" ;
12
-
13
11
$ haystack = 'This is a Simple text. ' ;
14
12
15
- echo "\n-- Testing strpbrk() function with empty second argument -- \n" ;
16
- var_dump ( strpbrk ($ haystack , '' ) );
13
+ echo "-- Testing strpbrk() function with empty second argument -- \n" ;
14
+ try {
15
+ strpbrk ($ haystack , '' );
16
+ } catch (\ValueError $ e ) {
17
+ echo $ e ->getMessage () . "\n" ;
18
+ }
17
19
18
20
?>
19
- --EXPECTF--
20
- *** Testing strpbrk() : error conditions ***
21
-
21
+ --EXPECT--
22
22
-- Testing strpbrk() function with empty second argument --
23
-
24
- Warning: strpbrk(): The character list cannot be empty in %s on line %d
25
- bool(false)
23
+ The character list cannot be empty
You can’t perform that action at this time.
0 commit comments