From 5d1ffcec05f271d4e7002b7e11064b8e7c994fd8 Mon Sep 17 00:00:00 2001 From: Joe Hoyle Date: Tue, 18 Jul 2023 22:42:40 +0200 Subject: [PATCH] Add helper to get global constants (#222) ExecutorGlobals::constants() will return a hash map of the available constants. --- src/zend/globals.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/zend/globals.rs b/src/zend/globals.rs index 7ba76c4..0f2cae8 100644 --- a/src/zend/globals.rs +++ b/src/zend/globals.rs @@ -50,6 +50,11 @@ impl ExecutorGlobals { unsafe { self.class_table.as_ref() } } + /// Attempts to retrieve the global constants table. + pub fn constants(&self) -> Option<&ZendHashTable> { + unsafe { self.zend_constants.as_ref() } + } + /// Attempts to extract the last PHP exception captured by the interpreter. /// Returned inside a [`ZBox`]. ///