Patch 63834.patch for Class/Object related Bug #63834
Patch version 2012-12-31 11:11 UTC
Return to Bug #63834 |
Download this patch
Patch Revisions:
Developer: krakjoe@php.net
diff -uNr virgin/Zend/zend_builtin_functions.c patched/Zend/zend_builtin_functions.c
--- virgin/Zend/zend_builtin_functions.c 2012-12-31 11:08:51.608126963 +0000
+++ patched/Zend/zend_builtin_functions.c 2012-12-31 11:07:15.363598508 +0000
@@ -44,6 +44,7 @@
static ZEND_FUNCTION(define);
static ZEND_FUNCTION(defined);
static ZEND_FUNCTION(get_class);
+static ZEND_FUNCTION(get_calling_class);
static ZEND_FUNCTION(get_called_class);
static ZEND_FUNCTION(get_parent_class);
static ZEND_FUNCTION(method_exists);
@@ -255,6 +256,7 @@
ZEND_FE(define, arginfo_define)
ZEND_FE(defined, arginfo_defined)
ZEND_FE(get_class, arginfo_get_class)
+ ZEND_FE(get_calling_class, arginfo_zend__void)
ZEND_FE(get_called_class, arginfo_zend__void)
ZEND_FE(get_parent_class, arginfo_get_class)
ZEND_FE(method_exists, arginfo_method_exists)
@@ -771,6 +773,25 @@
}
/* }}} */
+/* {{{ proto string get_calling_class()
+ Retrieves the class name of the calling scope */
+ZEND_FUNCTION(get_calling_class)
+{
+ zend_execute_data *ex;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
+ ex = EG(current_execute_data)->prev_execute_data;
+
+ if (ex && ex->current_scope) {
+ RETURN_STRINGL(ex->current_scope->name, ex->current_scope->name_length, 1);
+ } else zend_error(E_WARNING, "get_calling_class() called from outside a class");
+
+ RETURN_FALSE;
+} /* }}} */
+
/* {{{ proto string get_called_class()
Retrieves the "Late Static Binding" class name */
ZEND_FUNCTION(get_called_class)
|