1
0
mirror of https://github.com/php/php-src.git synced 2026-04-20 14:31:06 +02:00
Files
archived-php-src/ext/opcache/tests/invalid_new_dce.phpt
Christoph M. Becker 3e25ddb07b Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Add missing SKIPIFs
2019-07-01 18:12:28 +02:00

43 lines
852 B
PHP

--TEST--
Throwings NEWs should not be DCEd
--INI--
opcache.enable_cli=1
opcache.optimization_level=-1
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
abstract class Foo {}
interface Bar {}
trait Baz {}
class Abc {
const BAR = Abc::BAR;
}
function test1() {
$x = new Foo;
}
function test2() {
$x = new Bar;
}
function test3() {
$x = new Baz;
}
function test4() {
$x = new Abc;
}
try { test1(); } catch (Error $e) { echo $e->getMessage(), "\n"; }
try { test2(); } catch (Error $e) { echo $e->getMessage(), "\n"; }
try { test3(); } catch (Error $e) { echo $e->getMessage(), "\n"; }
try { test4(); } catch (Error $e) { echo $e->getMessage(), "\n"; }
?>
--EXPECT--
Cannot instantiate abstract class Foo
Cannot instantiate interface Bar
Cannot instantiate trait Baz
Cannot declare self-referencing constant 'Abc::BAR'