1--TEST-- 2ZE2 class constants and scope 3--SKIPIF-- 4<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> 5--FILE-- 6<?php 7 8class ErrorCodes { 9 const FATAL = "Fatal error\n"; 10 const WARNING = "Warning\n"; 11 const INFO = "Informational message\n"; 12 13 static function print_fatal_error_codes() { 14 echo "FATAL = " . FATAL . "\n"; 15 echo "self::FATAL = " . self::FATAL; 16 } 17} 18 19class ErrorCodesDerived extends ErrorCodes { 20 const FATAL = "Worst error\n"; 21 static function print_fatal_error_codes() { 22 echo "self::FATAL = " . self::FATAL; 23 echo "parent::FATAL = " . parent::FATAL; 24 } 25} 26 27/* Call the static function and move into the ErrorCodes scope */ 28ErrorCodes::print_fatal_error_codes(); 29ErrorCodesDerived::print_fatal_error_codes(); 30 31?> 32--EXPECTF-- 33Notice: Use of undefined constant FATAL - assumed 'FATAL' in %sconstants_scope_001.php on line %d 34FATAL = FATAL 35self::FATAL = Fatal error 36self::FATAL = Worst error 37parent::FATAL = Fatal error 38