xref: /PHP-7.2/Zend/tests/bug70918.phpt (revision 7d80ab2e)
1--TEST--
2Bug #70918 (Segfault using static outside of class scope)
3--FILE--
4<?php
5try {
6	static::x;
7} catch (Error $e) {
8	var_dump($e->getMessage());
9}
10
11try {
12	parent::x;
13} catch (Error $e) {
14	var_dump($e->getMessage());
15}
16
17try {
18	self::x;
19} catch (Error $e) {
20	var_dump($e->getMessage());
21}
22
23try {
24	new static;
25} catch (Error $e) {
26	var_dump($e->getMessage());
27}
28
29try {
30	static::x();
31} catch (Error $e) {
32	var_dump($e->getMessage());
33}
34
35try {
36	static::$i;
37} catch (Error $e) {
38	var_dump($e->getMessage());
39}
40?>
41--EXPECT--
42string(52) "Cannot access static:: when no class scope is active"
43string(52) "Cannot access parent:: when no class scope is active"
44string(50) "Cannot access self:: when no class scope is active"
45string(52) "Cannot access static:: when no class scope is active"
46string(52) "Cannot access static:: when no class scope is active"
47string(52) "Cannot access static:: when no class scope is active"
48