Skip to content

Commit 24fe9e8

Browse files
committed
retrieve ClassEntry for called scope
1 parent 29afca2 commit 24fe9e8

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

phper-sys/php_wrapper.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,10 @@ zval *phper_get_this(zend_execute_data *execute_data) {
348348
return getThis();
349349
}
350350

351+
zend_class_entry *phper_get_called_scope(zend_execute_data *execute_data) {
352+
return zend_get_called_scope(execute_data);
353+
}
354+
351355
size_t phper_zend_object_properties_size(zend_class_entry *ce) {
352356
return zend_object_properties_size(ce);
353357
}

phper/src/values.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
1313
use crate::{
1414
arrays::{ZArr, ZArray},
15+
classes::ClassEntry,
1516
errors::ExpectTypeError,
1617
functions::{ZFunc, call_internal},
1718
objects::{StateObject, ZObj, ZObject},
@@ -192,10 +193,14 @@ impl ExecuteData {
192193
}
193194

194195
/// Gets associated called scope if it exists
195-
pub fn get_called_scope(&mut self) -> Option<&ZStr> {
196+
pub fn get_called_scope(&mut self) -> Option<&ClassEntry> {
196197
unsafe {
197-
let val = ZVal::from_ptr(phper_get_called_scope(&mut self.inner));
198-
val.as_z_str()
198+
let ptr = phper_get_called_scope(&mut self.inner);
199+
if ptr.is_null() {
200+
None
201+
} else {
202+
Some(ClassEntry::from_ptr(ptr))
203+
}
199204
}
200205
}
201206

0 commit comments

Comments
 (0)