TypePHP 编译器
https://swoole.com/aot/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
2.0 KiB
82 lines
2.0 KiB
--TEST--
|
|
Test array_fill_keys() function : variation of parameter
|
|
--SKIPIF--
|
|
<?php die("skip AOT array_fill_keys key handling differs from PHP"); ?>
|
|
--FILE--
|
|
<?php
|
|
class classA
|
|
{
|
|
public function __toString(): string {
|
|
return "Class A object";
|
|
}
|
|
}
|
|
function main()
|
|
{
|
|
/* Testing with unexpected argument types */
|
|
echo "*** Testing array_fill_keys() : parameter variations ***\n";
|
|
$fp = fopen(__FILE__, "r");
|
|
$bool = false;
|
|
$float = 2.4;
|
|
$array = array("one");
|
|
$nullVal = null;
|
|
$unset_var = 10;
|
|
unset($unset_var);
|
|
$obj = new classA();
|
|
echo "\n-- Testing array_fill_keys() function with float --\n";
|
|
var_dump(array_fill_keys($array, $float));
|
|
echo "\n-- Testing array_fill_keys() function with null --\n";
|
|
var_dump(array_fill_keys($array, $nullVal));
|
|
echo "\n-- Testing array_fill_keys() function with object --\n";
|
|
var_dump(array_fill_keys($array, $obj));
|
|
echo "\n-- Testing array_fill_keys() function with boolean --\n";
|
|
var_dump(array_fill_keys($array, $bool));
|
|
echo "\n-- Testing array_fill_keys() function with resource --\n";
|
|
var_dump(array_fill_keys($array, $fp));
|
|
echo "\n-- Testing array_fill_keys() function with unset var --\n";
|
|
var_dump(array_fill_keys($array, $unset_var));
|
|
fclose($fp);
|
|
echo "Done";
|
|
}
|
|
?>
|
|
--EXPECTF--
|
|
*** Testing array_fill_keys() : parameter variations ***
|
|
|
|
-- Testing array_fill_keys() function with float --
|
|
array(1) {
|
|
["one"]=>
|
|
float(2.4)
|
|
}
|
|
|
|
-- Testing array_fill_keys() function with null --
|
|
array(1) {
|
|
["one"]=>
|
|
NULL
|
|
}
|
|
|
|
-- Testing array_fill_keys() function with object --
|
|
array(1) {
|
|
["one"]=>
|
|
object(classA)#%d (0) {
|
|
}
|
|
}
|
|
|
|
-- Testing array_fill_keys() function with boolean --
|
|
array(1) {
|
|
["one"]=>
|
|
bool(false)
|
|
}
|
|
|
|
-- Testing array_fill_keys() function with resource --
|
|
array(1) {
|
|
["one"]=>
|
|
resource(%d) of type (stream)
|
|
}
|
|
|
|
-- Testing array_fill_keys() function with unset var --
|
|
|
|
Warning: Undefined variable $unset_var in %s on line %d
|
|
array(1) {
|
|
["one"]=>
|
|
NULL
|
|
}
|
|
Done
|
|
|