@ -0,0 +1,16 @@
--TEST--
errmsg: Non-abstract method must contain body
--FILE--
<?php
abstract class test {
}
class Impl extends Test {
function Foo();
echo "Done\n";
?>
--EXPECTF--
Fatal error: Non-abstract method Impl::Foo() must contain body in %s on line %d
@ -0,0 +1,14 @@
errmsg: function cannot be declared private
abstract private function foo() {
Fatal error: Abstract function test::foo() cannot be declared private in %s on line %d
@ -0,0 +1,19 @@
errmsg: cannot reassign $this (by ref)
class test {
function foo() {
$a = new test;
$this = &$a;
$t = new test;
$t->foo();
Fatal error: Cannot re-assign $this in %s on line %d
@ -0,0 +1,15 @@
errmsg: can't use function return value in write context
return "blah";
foo() = 1;
Fatal error: Can't use function return value in write context in %s on line %d
@ -0,0 +1,18 @@
errmsg: can't use method return value in write context
$t->foo() = 1;
Fatal error: Can't use method return value in write context in %s on line %d
@ -0,0 +1,12 @@
errmsg: can't use [] for reading
$a = array();
$b = $a[];
Fatal error: Cannot use [] for reading in %s on line %d
errmsg: can't use [] for reading - 2
isset($a[]);
errmsg: can't use [] for unsetting
unset($a[]);
Fatal error: Cannot use [] for unsetting in %s on line %d
@ -0,0 +1,13 @@
errmsg: multiple access type modifiers are not allowed (properties)
public private $var;
Fatal error: Multiple access type modifiers are not allowed in %s on line %d
errmsg: multiple access type modifiers are not allowed (methods)
private protected function foo() {}
errmsg: cannot redeclare (method)
function foo() {}
Fatal error: Cannot redeclare test::foo() in %s on line %d
@ -0,0 +1,11 @@
errmsg: __autoload() must take exactly 1 argument
function __autoload($a, $b) {}
Fatal error: __autoload() must take exactly 1 argument in %s on line %d
errmsg: default value for parameters with array type hint can only be an array or NULL
function foo(array $a = "s") {
Fatal error: Default value for parameters with array type hint can only be an array or NULL in %s on line %d
@ -0,0 +1,17 @@
errmsg: cannot call __clone() method on objects
function __clone() {
$t->__clone();
Fatal error: Cannot call __clone() method on objects - use 'clone $obj' instead in %s on line %d
errmsg: __clone() cannot accept any arguments
function __clone($var) {
Fatal error: Method test::__clone() cannot accept any arguments in %s on line %d
errmsg: __isset() must take exactly 1 argument
function __isset() {
Fatal error: Method test::__isset() must take exactly 1 argument in %s on line %d
errmsg: __unset() must take exactly 1 argument
function __unset() {
Fatal error: Method test::__unset() must take exactly 1 argument in %s on line %d
errmsg: static abstract function
static abstract function foo ();
Fatal error: Static function test::foo() cannot be abstract in %s on line %d
errmsg: __destruct() cannot take arguments
function __destruct($var) {
Fatal error: Destructor test::__destruct() cannot take arguments in %s on line %d
errmsg: disabled function
--INI--
disable_functions=phpinfo
phpinfo();
Warning: phpinfo() has been disabled for security reasons in %s on line %d
Done
errmsg: disabled class
disable_classes=stdclass
class test extends stdclass {
Fatal error: Class 'stdclass' not found in %s on line %d
errmsg: only variables can be passed by reference
function foo (&$var) {
foo(1);
Fatal error: Only variables can be passed by reference in %s on line %d
errmsg: access level must be the same or weaker
class test1 {
protected $var;
class test extends test1 {
private $var;
Fatal error: Access level to test::$var must be protected (as in class test1) or weaker in %s on line %d
errmsg: cannot change initial value of property
static protected $var = 1;
static $var = 10;
Fatal error: Cannot change initial value of property static protected test1::$var in class test in %s on line %d
@ -0,0 +1,20 @@
errmsg: cannot inherit previously inherited constant
interface test1 {
const FOO = 10;
interface test2 {
class test implements test1, test2 {
Fatal error: Cannot inherit previously-inherited constant FOO from interface test2 in %s on line %d
errmsg: cannot redeclare class
class stdclass {
Fatal error: Cannot redeclare class stdclass in %s on line %d
errmsg: class declarations may not be nested
class test2 {
Fatal error: Class declarations may not be nested in %s on line %d
errmsg: cannot use 'self' as class name
class self {
Fatal error: Cannot use 'self' as class name as it is reserved in %s on line %d
errmsg: cannot use 'parent' as class name
class parent {
Fatal error: Cannot use 'parent' as class name as it is reserved in %s on line %d
errmsg: cannot use 'self' as parent class name
class test extends self {
errmsg: cannot use 'parent' as parent class name
class test extends parent {
errmsg: __construct() cannot be static
static function __construct() {
Fatal error: Constructor test::__construct() cannot be static in %s on line %d
errmsg: __destruct() cannot be static
static function __destruct() {
Fatal error: Destructor test::__destruct() cannot be static in %s on line %d
errmsg: __clone() cannot be static
static function __clone() {
Fatal error: Clone method test::__clone() cannot be static in %s on line %d
errmsg: cannot use 'self' as interface name
class test implements self {
Fatal error: Cannot use 'self' as interface name as it is reserved in %s on line %d
errmsg: cannot use 'parent' as interface name
class test implements parent {
Fatal error: Cannot use 'parent' as interface name as it is reserved in %s on line %d
errmsg: properties cannot be abstract
abstract $var = 1;
Fatal error: Properties cannot be declared abstract in %s on line %d
errmsg: properties cannot be final
final $var = 1;
Fatal error: Cannot declare property test::$var final, the final modifier is allowed only for methods in %s on line %d
errmsg: cannot redeclare property
var $var;
Fatal error: Cannot redeclare test::$var in %s on line %d
errmsg: arrays are not allowed in class constants
const TEST = array(1,2,3);
Fatal error: Arrays are not allowed in class constants in %s on line %d
errmsg: instanceof expects an object instance, constant given
var_dump("abc" instanceof stdclass);
Fatal error: instanceof expects an object instance, constant given in %s on line %d
errmsg: key element cannot be a reference
$a = array(1,2,3);
foreach ($a as &$k=>$v) {
Fatal error: Key element cannot be a reference in %s on line %d
errmsg: cannot create references to temp array
foreach (array(1,2,3) as $k=>&$v) {
Fatal error: Cannot create references to elements of a temporary array expression in %s on line %d