xref: /PHP-7.4/Zend/tests/exception_014.phpt (revision e97d5fab)
1--TEST--
2Exceptions on improper access to static class properties
3--FILE--
4<?php
5class C {
6	private $p = 0;
7}
8
9$x = new C;
10try {
11	var_dump($x->p);
12} catch (Error $e) {
13	echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n";
14}
15
16var_dump($x->p);
17?>
18--EXPECTF--
19Exception: Cannot access private property C::$p in %sexception_014.php on line %d
20
21Fatal error: Uncaught Error: Cannot access private property C::$p in %sexception_014.php:%d
22Stack trace:
23#0 {main}
24  thrown in %sexception_014.php on line %d
25