php-src/Zend/tests/self_instanceof_outside_class.phpt
Nikita Popov 56f1106162 Use FETCH_CLASS_EXCEPTION for instanceof
This does not collide with NO_AUTOLOAD -- missing classes will be
silenced, but invalid use of self etc will result in an exception
instead of a fatal error.
2015-12-14 17:50:20 +01:00

18 lines
268 B
PHP

--TEST--
instanceof self outside a class
--FILE--
<?php
$fn = function() {
try {
new stdClass instanceof self;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
};
$fn();
?>
--EXPECT--
Cannot access self:: when no class scope is active