summaryrefslogtreecommitdiff
path: root/Zend/tests/type_declarations/internal_function_strict_mode.phpt
blob: 8b70bbae1a42af5ead437541d6740950d343a962 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
--TEST--
Scalar type - internal function strict mode
--FILE--
<?php
declare(strict_types=1);

echo "*** Trying Ord With Integer" . PHP_EOL;
try {
	var_dump(ord(1));
} catch (TypeError $e) {
	echo "*** Caught " . $e->getMessage() . PHP_EOL;
}

echo "*** Trying Array Map With Invalid Callback" . PHP_EOL;
try {
	array_map([null, "bar"], []);
} catch (TypeError $e) {
	echo "*** Caught " . $e->getMessage() . PHP_EOL;
}

echo "*** Trying Strlen With Float" . PHP_EOL;
try {
	var_dump(strlen(1.5));
} catch (TypeError $e) {
	echo "*** Caught " . $e->getMessage() . PHP_EOL;
}

?>
--EXPECTF--
*** Trying Ord With Integer
*** Caught ord() expects parameter 1 to be string, int given
*** Trying Array Map With Invalid Callback
*** Caught array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object
*** Trying Strlen With Float
*** Caught strlen() expects parameter 1 to be string, float given