php-src/Zend/tests/const_deprecation.phpt
Nikita Popov 9ec1ee5976 Add support for deprecating constants
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.
2020-01-17 10:05:06 +01:00

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)