File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -529,7 +529,7 @@ PHP_METHOD(SplFixedArray, __construct)
529
529
}
530
530
531
531
if (size < 0 ) {
532
- zend_throw_exception_ex ( spl_ce_InvalidArgumentException , 0 , "array size cannot be less than zero " );
532
+ zend_argument_value_error ( 1 , "must be greater than or equal to 0 " );
533
533
RETURN_THROWS ();
534
534
}
535
535
@@ -704,7 +704,7 @@ PHP_METHOD(SplFixedArray, setSize)
704
704
}
705
705
706
706
if (size < 0 ) {
707
- zend_throw_exception_ex ( spl_ce_InvalidArgumentException , 0 , "array size cannot be less than zero " );
707
+ zend_argument_value_error ( 1 , "must be greater than or equal to 0 " );
708
708
RETURN_THROWS ();
709
709
}
710
710
Original file line number Diff line number Diff line change @@ -12,16 +12,16 @@ var_dump($a->count());
12
12
/* negative init value */
13
13
try {
14
14
$ b = new SplFixedArray (-10 );
15
- } catch (Exception $ e ) {
16
- var_dump ( $ e ->getMessage ()) ;
15
+ } catch (\ ValueError $ e ) {
16
+ echo $ e ->getMessage () . \ PHP_EOL ;
17
17
}
18
18
19
19
/* resize and negative value */
20
20
$ b = new SplFixedArray ();
21
21
try {
22
22
$ b ->setSize (-5 );
23
- } catch (Exception $ e ) {
24
- var_dump ( $ e ->getMessage ()) ;
23
+ } catch (\ ValueError $ e ) {
24
+ echo $ e ->getMessage () . \ PHP_EOL ;
25
25
}
26
26
27
27
/* calling __construct() twice */
@@ -63,8 +63,8 @@ var_dump(empty($a["3"]));
63
63
--EXPECTF--
64
64
int(0)
65
65
int(0)
66
- string(35) "array size cannot be less than zero"
67
- string(35) "array size cannot be less than zero"
66
+ SplFixedArray::__construct(): Argument #1 ($ size) must be greater than or equal to 0
67
+ SplFixedArray::setSize(): Argument #1 ($ size) must be greater than or equal to 0
68
68
NULL
69
69
int(0)
70
70
int(0)
You can’t perform that action at this time.
0 commit comments