php-src/ext/spl/tests/SplFixedArray__construct_param_array.phpt
Nikita Popov 122d759618 Always throw TypeException on throwing zpp failures
Introduces a ZEND_PARSE_PARAMS_THROW flag for zpp, which forces to
report FAILURE errors using a TypeException instead of a Warning,
like it would happen in strict mode.

Adds a zend_parse_parameters_throw() convenience function, which
invokes zpp with this flag.

Converts all cases I could identify, where we currently have
throwing zpp usage in constructors and replaces them with this API.
Error handling is still replaced to EH_THROW in some cases to handle
other, domain-specific errors in constructors.
2015-04-06 11:27:34 +02:00

17 lines
361 B
PHP

--TEST--
SplFixedArray::__construct() with array passed as integer.
--CREDITS--
PHPNW Test Fest 2009 - Jordan Hatch
--FILE--
<?php
try {
$array = new SplFixedArray( array("string", 1) );
} catch (TypeException $iae) {
echo "Ok - ".$iae->getMessage().PHP_EOL;
}
?>
--EXPECTF--
Ok - SplFixedArray::__construct() expects parameter 1 to be integer, array given