mirror of
https://github.com/php/php-src.git
synced 2025-01-05 18:33:56 +08:00
a75c195000
Squashed commit of the following: commitf11ca0e7a5
Author: Dmitry Stogov <dmitry@zend.com> Date: Tue Dec 8 12:38:42 2015 +0300 Fixed test expectation commit211f873f54
Author: Dmitry Stogov <dmitry@zend.com> Date: Tue Dec 8 12:28:38 2015 +0300 Embed zend_class_constant.flags into zend_class_constants.value.u2.access_flags commit51deab84b2
Author: Dmitry Stogov <dmitry@zend.com> Date: Mon Dec 7 11:18:55 2015 +0300 Fixed issues found by Nikita commit544dbd5b47
Author: Dmitry Stogov <dmitry@zend.com> Date: Sat Dec 5 02:41:05 2015 +0300 Refactored immplementation of https://wiki.php.net/rfc/class_const_visibility @reeze created an RFC here and I emailed internals here and didn't get any responses positive/negative.
29 lines
495 B
PHP
29 lines
495 B
PHP
--TEST--
|
|
Only public and protected class constants should be inherited
|
|
--FILE--
|
|
<?php
|
|
class A {
|
|
public const X = 1;
|
|
protected const Y = 2;
|
|
private const Z = 3;
|
|
}
|
|
class B extends A {
|
|
static public function checkConstants() {
|
|
var_dump(self::X);
|
|
var_dump(self::Y);
|
|
var_dump(self::Z);
|
|
}
|
|
}
|
|
|
|
B::checkConstants();
|
|
?>
|
|
--EXPECTF--
|
|
int(1)
|
|
int(2)
|
|
|
|
Fatal error: Uncaught Error: Undefined class constant 'Z' in %s:11
|
|
Stack trace:
|
|
#0 %s(15): B::checkConstants()
|
|
#1 {main}
|
|
thrown in %s on line 11
|