1
0
mirror of https://github.com/php/php-src.git synced 2026-04-26 17:38:14 +02:00
Files
archived-php-src/ext/standard/tests/class_object/property_exists_error.phpt
T
2020-03-31 16:32:58 +02:00

28 lines
817 B
PHP

--TEST--
Test property_exists() function : error conditions
--FILE--
<?php
/* Prototype : bool property_exists(mixed object_or_class, string property_name)
* Description: Checks if the object or class has a property
* Source code: Zend/zend_builtin_functions.c
* Alias to functions:
*/
echo "*** Testing property_exists() : error conditions ***\n";
echo "\n-- Testing property_exists() function with incorrect arguments --\n";
$property_name = 'string_val';
try {
var_dump( property_exists(10, $property_name) );
} catch (\TypeError $e) {
echo $e->getMessage() . \PHP_EOL;
}
?>
--EXPECT--
*** Testing property_exists() : error conditions ***
-- Testing property_exists() function with incorrect arguments --
property_exists(): Argument #1 ($object_or_class) must be of type object|string, int given