php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | |
Patch 63834-2.patch for Class/Object related Bug #63834Patch version 2012-12-31 11:49 UTC Return to Bug #63834 | Download this patchThis patch renders other patches obsolete Obsolete patches: Patch Revisions:Developer: krakjoe@php.net--- virgin/Zend/zend_builtin_functions.c 2012-12-31 11:30:58.558277790 +0000 +++ patched/Zend/zend_builtin_functions.c 2012-12-31 11:31:07.471326573 +0000 @@ -44,6 +44,8 @@ static ZEND_FUNCTION(define); static ZEND_FUNCTION(defined); static ZEND_FUNCTION(get_class); +static ZEND_FUNCTION(get_calling_method); +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 +257,8 @@ ZEND_FE(define, arginfo_define) ZEND_FE(defined, arginfo_defined) ZEND_FE(get_class, arginfo_get_class) + ZEND_FE(get_calling_method, arginfo_zend__void) + 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 +775,45 @@ } /* }}} */ +/* {{{ proto string get_calling_method() + Retrieves the function name of the calling method */ +ZEND_FUNCTION(get_calling_method) +{ + zend_execute_data *ex; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + ex = EG(current_execute_data)->prev_execute_data; + + if (ex && ex->function_state.function) { + RETURN_STRING(ex->function_state.function->common.function_name, 1); + } + + RETURN_FALSE; +} +/* }}} */ + +/* {{{ 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); + } + + RETURN_FALSE; +} /* }}} */ + /* {{{ proto string get_called_class() Retrieves the "Late Static Binding" class name */ ZEND_FUNCTION(get_called_class) |
Copyright © 2001-2024 The PHP Group All rights reserved. |
Last updated: Sun Dec 22 00:01:30 2024 UTC |