summaryrefslogtreecommitdiff
path: root/Zend/zend_constants.h
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-01-10 11:34:05 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-01-17 10:05:06 +0100
commit9ec1ee5976f4c0131943cc8863a344caf5492773 (patch)
treec557dd0e451bd525befd7199eaa71c1f9bcdb212 /Zend/zend_constants.h
parentae706e51e1fc2a9992ffc83fe653a5224c2144d6 (diff)
downloadphp-git-9ec1ee5976f4c0131943cc8863a344caf5492773.tar.gz
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.
Diffstat (limited to 'Zend/zend_constants.h')
-rw-r--r--Zend/zend_constants.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h
index 75be4c32b2..9b5a63a026 100644
--- a/Zend/zend_constants.h
+++ b/Zend/zend_constants.h
@@ -25,6 +25,7 @@
#define CONST_CS 0 /* No longer used -- always case sensitive */
#define CONST_PERSISTENT (1<<0) /* Persistent */
#define CONST_NO_FILE_CACHE (1<<1) /* Can't be saved in file cache */
+#define CONST_DEPRECATED (1<<2) /* Deprecated */
#define PHP_USER_CONSTANT 0x7fffff /* a constant defined in user space */
@@ -86,9 +87,10 @@ ZEND_API int zend_register_constant(zend_constant *c);
void zend_copy_constants(HashTable *target, HashTable *sourc);
#endif
-ZEND_API zval *_zend_get_special_const(const char *name, size_t name_len);
+ZEND_API zend_constant *_zend_get_special_const(const char *name, size_t name_len);
-static zend_always_inline zval *zend_get_special_const(const char *name, size_t name_len) {
+static zend_always_inline zend_constant *zend_get_special_const(
+ const char *name, size_t name_len) {
if (name_len == 4 || name_len == 5) {
return _zend_get_special_const(name, name_len);
}