mirror of
https://github.com/php/php-src.git
synced 2024-12-12 03:15:29 +08:00
9ec1ee5976
Internal constants can be marked as CONST_DEPRECATED, in which case accessing them will throw a deprecation warning. For now this is only supported on global constants, not class constants. Complain to me if you need to deprecate a class constant... Closes GH-5072.
26 lines
526 B
PHP
26 lines
526 B
PHP
--TEST--
|
|
Internal constant deprecation
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded('zend-test')) die('skip requires zend-test');
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
|
|
var_dump(ZEND_TEST_DEPRECATED);
|
|
var_dump(constant('ZEND_TEST_DEPRECATED'));
|
|
|
|
const X = ZEND_TEST_DEPRECATED;
|
|
var_dump(X);
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Deprecated: Constant ZEND_TEST_DEPRECATED is deprecated in %s on line %d
|
|
int(42)
|
|
|
|
Deprecated: Constant ZEND_TEST_DEPRECATED is deprecated in %s on line %d
|
|
int(42)
|
|
|
|
Deprecated: Constant ZEND_TEST_DEPRECATED is deprecated in %s on line %d
|
|
int(42)
|