Back to index

php5  5.3.10
Classes | Defines | Typedefs | Enumerations | Functions | Variables
php_reflection.c File Reference
#include "php.h"
#include "php_ini.h"
#include "php_reflection.h"
#include "ext/standard/info.h"
#include "zend.h"
#include "zend_API.h"
#include "zend_exceptions.h"
#include "zend_operators.h"
#include "zend_constants.h"
#include "zend_ini.h"
#include "zend_interfaces.h"
#include "zend_closures.h"

Go to the source code of this file.

Classes

struct  _string
struct  _property_reference
struct  _parameter_reference
struct  reflection_object

Defines

#define METHOD_NOTSTATIC(ce)
#define _DO_THROW(msg)
#define RETURN_ON_EXCEPTION
#define GET_REFLECTION_OBJECT_PTR(target)
#define REGISTER_REFLECTION_CLASS_CONST_LONG(class_name, const_name, value)   zend_declare_class_constant_long(reflection_ ## class_name ## _ptr, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC);

Typedefs

typedef struct _string string
typedef struct _property_reference property_reference
typedef struct _parameter_reference parameter_reference

Enumerations

enum  reflection_type_t {
  REF_TYPE_OTHER, REF_TYPE_FUNCTION, REF_TYPE_PARAMETER, REF_TYPE_PROPERTY,
  REF_TYPE_DYNAMIC_PROPERTY
}

Functions

static void string_init (string *str)
static stringstring_printf (string *str, const char *format,...)
static stringstring_write (string *str, char *buf, int len)
static stringstring_append (string *str, string *append)
static void string_free (string *str)
static void _default_get_entry (zval *object, char *name, int name_len, zval *return_value TSRMLS_DC)
static void reflection_register_implement (zend_class_entry *class_entry, zend_class_entry *interface_entry TSRMLS_DC)
static zend_function_copy_function (zend_function *fptr TSRMLS_DC)
static void _free_function (zend_function *fptr TSRMLS_DC)
static void reflection_free_objects_storage (void *object TSRMLS_DC)
static zend_object_value reflection_objects_new (zend_class_entry *class_type TSRMLS_DC)
static zval * reflection_instantiate (zend_class_entry *pce, zval *object TSRMLS_DC)
static void _const_string (string *str, char *name, zval *value, char *indent TSRMLS_DC)
static void _function_string (string *str, zend_function *fptr, zend_class_entry *scope, char *indent TSRMLS_DC)
static void _property_string (string *str, zend_property_info *prop, char *prop_name, char *indent TSRMLS_DC)
static void _class_string (string *str, zend_class_entry *ce, zval *obj, char *indent TSRMLS_DC)
static void _extension_string (string *str, zend_module_entry *module, char *indent TSRMLS_DC)
static zend_op * _get_recv_op (zend_op_array *op_array, zend_uint offset)
static void _parameter_string (string *str, zend_function *fptr, struct _zend_arg_info *arg_info, zend_uint offset, zend_uint required, char *indent TSRMLS_DC)
static void _function_parameter_string (string *str, zend_function *fptr, char *indent TSRMLS_DC)
static void _function_closure_string (string *str, zend_function *fptr, char *indent TSRMLS_DC)
static int _extension_ini_string (zend_ini_entry *ini_entry TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
static int _extension_class_string (zend_class_entry **pce TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
static int _extension_const_string (zend_constant *constant TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
static void _function_check_flag (INTERNAL_FUNCTION_PARAMETERS, int mask)
PHPAPI void zend_reflection_class_factory (zend_class_entry *ce, zval *object TSRMLS_DC)
static void reflection_extension_factory (zval *object, const char *name_str TSRMLS_DC)
static void reflection_parameter_factory (zend_function *fptr, zval *closure_object, struct _zend_arg_info *arg_info, zend_uint offset, zend_uint required, zval *object TSRMLS_DC)
static void reflection_function_factory (zend_function *function, zval *closure_object, zval *object TSRMLS_DC)
static void reflection_method_factory (zend_class_entry *ce, zend_function *method, zval *closure_object, zval *object TSRMLS_DC)
static void reflection_property_factory (zend_class_entry *ce, zend_property_info *prop, zval *object TSRMLS_DC)
static void _reflection_export (INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *ce_ptr, int ctor_argc)
 ZEND_METHOD (reflection, __clone)
 ZEND_METHOD (reflection, export)
 ZEND_METHOD (reflection, getModifierNames)
 ZEND_METHOD (reflection_function, export)
 ZEND_METHOD (reflection_function, __construct)
 ZEND_METHOD (reflection_function, __toString)
 ZEND_METHOD (reflection_function, getName)
 ZEND_METHOD (reflection_function, isClosure)
 ZEND_METHOD (reflection_function, isInternal)
 ZEND_METHOD (reflection_function, isUserDefined)
 ZEND_METHOD (reflection_function, isDisabled)
 ZEND_METHOD (reflection_function, getFileName)
 ZEND_METHOD (reflection_function, getStartLine)
 ZEND_METHOD (reflection_function, getEndLine)
 ZEND_METHOD (reflection_function, getDocComment)
 ZEND_METHOD (reflection_function, getStaticVariables)
 ZEND_METHOD (reflection_function, invoke)
static int _zval_array_to_c_array (zval **arg, zval ****params TSRMLS_DC)
 ZEND_METHOD (reflection_function, invokeArgs)
 ZEND_METHOD (reflection_function, returnsReference)
 ZEND_METHOD (reflection_function, getNumberOfParameters)
 ZEND_METHOD (reflection_function, getNumberOfRequiredParameters)
 ZEND_METHOD (reflection_function, getParameters)
 ZEND_METHOD (reflection_function, getExtension)
 ZEND_METHOD (reflection_function, getExtensionName)
 ZEND_METHOD (reflection_parameter, export)
 ZEND_METHOD (reflection_parameter, __construct)
 ZEND_METHOD (reflection_parameter, __toString)
 ZEND_METHOD (reflection_parameter, getName)
 ZEND_METHOD (reflection_parameter, getDeclaringFunction)
 ZEND_METHOD (reflection_parameter, getDeclaringClass)
 ZEND_METHOD (reflection_parameter, getClass)
 ZEND_METHOD (reflection_parameter, isArray)
 ZEND_METHOD (reflection_parameter, allowsNull)
 ZEND_METHOD (reflection_parameter, isPassedByReference)
 ZEND_METHOD (reflection_parameter, getPosition)
 ZEND_METHOD (reflection_parameter, isOptional)
 ZEND_METHOD (reflection_parameter, isDefaultValueAvailable)
 ZEND_METHOD (reflection_parameter, getDefaultValue)
 ZEND_METHOD (reflection_method, export)
 ZEND_METHOD (reflection_method, __construct)
 ZEND_METHOD (reflection_method, __toString)
 ZEND_METHOD (reflection_method, invoke)
 ZEND_METHOD (reflection_method, invokeArgs)
 ZEND_METHOD (reflection_method, isFinal)
 ZEND_METHOD (reflection_method, isAbstract)
 ZEND_METHOD (reflection_method, isPublic)
 ZEND_METHOD (reflection_method, isPrivate)
 ZEND_METHOD (reflection_method, isProtected)
 ZEND_METHOD (reflection_method, isStatic)
 ZEND_METHOD (reflection_function, isDeprecated)
 ZEND_METHOD (reflection_function, inNamespace)
 ZEND_METHOD (reflection_function, getNamespaceName)
 ZEND_METHOD (reflection_function, getShortName)
 ZEND_METHOD (reflection_method, isConstructor)
 ZEND_METHOD (reflection_method, isDestructor)
 ZEND_METHOD (reflection_method, getModifiers)
 ZEND_METHOD (reflection_method, getDeclaringClass)
 ZEND_METHOD (reflection_method, getPrototype)
 ZEND_METHOD (reflection_method, setAccessible)
 ZEND_METHOD (reflection_class, export)
static void reflection_class_object_ctor (INTERNAL_FUNCTION_PARAMETERS, int is_object)
 ZEND_METHOD (reflection_class, __construct)
 ZEND_METHOD (reflection_class, getStaticProperties)
 ZEND_METHOD (reflection_class, getStaticPropertyValue)
 ZEND_METHOD (reflection_class, setStaticPropertyValue)
 ZEND_METHOD (reflection_class, getDefaultProperties)
 ZEND_METHOD (reflection_class, __toString)
 ZEND_METHOD (reflection_class, getName)
 ZEND_METHOD (reflection_class, isInternal)
 ZEND_METHOD (reflection_class, isUserDefined)
 ZEND_METHOD (reflection_class, getFileName)
 ZEND_METHOD (reflection_class, getStartLine)
 ZEND_METHOD (reflection_class, getEndLine)
 ZEND_METHOD (reflection_class, getDocComment)
 ZEND_METHOD (reflection_class, getConstructor)
 ZEND_METHOD (reflection_class, hasMethod)
 ZEND_METHOD (reflection_class, getMethod)
static void _addmethod (zend_function *mptr, zend_class_entry *ce, zval *retval, long filter, zval *obj TSRMLS_DC)
static int _addmethod_va (zend_function *mptr TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
 ZEND_METHOD (reflection_class, getMethods)
 ZEND_METHOD (reflection_class, hasProperty)
 ZEND_METHOD (reflection_class, getProperty)
static int _addproperty (zend_property_info *pptr TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
static int _adddynproperty (zval **pptr TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
 ZEND_METHOD (reflection_class, getProperties)
 ZEND_METHOD (reflection_class, hasConstant)
 ZEND_METHOD (reflection_class, getConstants)
 ZEND_METHOD (reflection_class, getConstant)
static void _class_check_flag (INTERNAL_FUNCTION_PARAMETERS, int mask)
 ZEND_METHOD (reflection_class, isInstantiable)
 ZEND_METHOD (reflection_class, isInterface)
 ZEND_METHOD (reflection_class, isFinal)
 ZEND_METHOD (reflection_class, isAbstract)
 ZEND_METHOD (reflection_class, getModifiers)
 ZEND_METHOD (reflection_class, isInstance)
 ZEND_METHOD (reflection_class, newInstance)
 ZEND_METHOD (reflection_class, newInstanceArgs)
 ZEND_METHOD (reflection_class, getInterfaces)
 ZEND_METHOD (reflection_class, getInterfaceNames)
 ZEND_METHOD (reflection_class, getParentClass)
 ZEND_METHOD (reflection_class, isSubclassOf)
 ZEND_METHOD (reflection_class, implementsInterface)
 ZEND_METHOD (reflection_class, isIterateable)
 ZEND_METHOD (reflection_class, getExtension)
 ZEND_METHOD (reflection_class, getExtensionName)
 ZEND_METHOD (reflection_class, inNamespace)
 ZEND_METHOD (reflection_class, getNamespaceName)
 ZEND_METHOD (reflection_class, getShortName)
 ZEND_METHOD (reflection_object, export)
 ZEND_METHOD (reflection_object, __construct)
 ZEND_METHOD (reflection_property, export)
 ZEND_METHOD (reflection_property, __construct)
 ZEND_METHOD (reflection_property, __toString)
 ZEND_METHOD (reflection_property, getName)
static void _property_check_flag (INTERNAL_FUNCTION_PARAMETERS, int mask)
 ZEND_METHOD (reflection_property, isPublic)
 ZEND_METHOD (reflection_property, isPrivate)
 ZEND_METHOD (reflection_property, isProtected)
 ZEND_METHOD (reflection_property, isStatic)
 ZEND_METHOD (reflection_property, isDefault)
 ZEND_METHOD (reflection_property, getModifiers)
 ZEND_METHOD (reflection_property, getValue)
 ZEND_METHOD (reflection_property, setValue)
 ZEND_METHOD (reflection_property, getDeclaringClass)
 ZEND_METHOD (reflection_property, getDocComment)
 ZEND_METHOD (reflection_property, setAccessible)
 ZEND_METHOD (reflection_extension, export)
 ZEND_METHOD (reflection_extension, __construct)
 ZEND_METHOD (reflection_extension, __toString)
 ZEND_METHOD (reflection_extension, getName)
 ZEND_METHOD (reflection_extension, getVersion)
 ZEND_METHOD (reflection_extension, getFunctions)
static int _addconstant (zend_constant *constant TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
 ZEND_METHOD (reflection_extension, getConstants)
static int _addinientry (zend_ini_entry *ini_entry TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
 ZEND_METHOD (reflection_extension, getINIEntries)
static int add_extension_class (zend_class_entry **pce TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
 ZEND_METHOD (reflection_extension, getClasses)
 ZEND_METHOD (reflection_extension, getClassNames)
 ZEND_METHOD (reflection_extension, getDependencies)
 ZEND_METHOD (reflection_extension, info)
static void _reflection_write_property (zval *object, zval *member, zval *value TSRMLS_DC)
 PHP_MINIT_FUNCTION (reflection)
 PHP_MINFO_FUNCTION (reflection)

Variables

PHPAPI zend_class_entry * reflector_ptr
PHPAPI zend_class_entry * reflection_exception_ptr
PHPAPI zend_class_entry * reflection_ptr
PHPAPI zend_class_entry * reflection_function_abstract_ptr
PHPAPI zend_class_entry * reflection_function_ptr
PHPAPI zend_class_entry * reflection_parameter_ptr
PHPAPI zend_class_entry * reflection_class_ptr
PHPAPI zend_class_entry * reflection_object_ptr
PHPAPI zend_class_entry * reflection_method_ptr
PHPAPI zend_class_entry * reflection_property_ptr
PHPAPI zend_class_entry * reflection_extension_ptr
static zend_object_handlers reflection_object_handlers
static const zend_function_entry reflection_exception_functions []
static const zend_function_entry reflection_functions []
static const zend_function_entry reflector_functions []
static const zend_function_entry reflection_function_abstract_functions []
static const zend_function_entry reflection_function_functions []
static const zend_function_entry reflection_method_functions []
static const zend_function_entry reflection_class_functions []
static const zend_function_entry reflection_object_functions []
static const zend_function_entry reflection_property_functions []
static const zend_function_entry reflection_parameter_functions []
static const zend_function_entry reflection_extension_functions []
const zend_function_entry reflection_ext_functions []
static zend_object_handlers * zend_std_obj_handlers
zend_module_entry reflection_module_entry

Class Documentation

struct _string

Definition at line 109 of file php_reflection.c.

Class Members
int alloced
int len
char * string
struct _property_reference

Definition at line 176 of file php_reflection.c.

Collaboration diagram for _property_reference:
Class Members
zend_class_entry * ce
zend_property_info prop
struct _parameter_reference

Definition at line 182 of file php_reflection.c.

Collaboration diagram for _parameter_reference:
Class Members
struct _zend_arg_info * arg_info
zend_function * fptr
zend_uint offset
zend_uint required
struct reflection_object

Definition at line 198 of file php_reflection.c.

Collaboration diagram for reflection_object:
Class Members
zend_class_entry * ce
unsigned int ignore_visibility:1
zval * obj
void * ptr
reflection_type_t ref_type
zend_object zo

Define Documentation

#define _DO_THROW (   msg)
Value:

Definition at line 87 of file php_reflection.c.

Value:
intern = (reflection_object *) zend_object_store_get_object(getThis() TSRMLS_CC);                       \
       if (intern == NULL || intern->ptr == NULL) {                                                            \
		RETURN_ON_EXCEPTION                                                                                 \
		php_error_docref(NULL TSRMLS_CC, E_ERROR, "Internal error: Failed to retrieve the reflection object");                    \
       }                                                                                                       \
       target = intern->ptr;                                                                                   \

Definition at line 96 of file php_reflection.c.

#define METHOD_NOTSTATIC (   ce)
Value:
if (!this_ptr || !instanceof_function(Z_OBJCE_P(this_ptr), ce TSRMLS_CC)) {                             \
              php_error_docref(NULL TSRMLS_CC, E_ERROR, "%s() cannot be called statically", get_active_function_name(TSRMLS_C));        \
              return;                                                                                             \
       }                                                                                                       \

Definition at line 80 of file php_reflection.c.

#define REGISTER_REFLECTION_CLASS_CONST_LONG (   class_name,
  const_name,
  value 
)    zend_declare_class_constant_long(reflection_ ## class_name ## _ptr, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC);

Definition at line 105 of file php_reflection.c.

Value:
if (EG(exception) && Z_OBJCE_P(EG(exception)) == reflection_exception_ptr) {                            \
              return;                                                                                             \
       }

Definition at line 91 of file php_reflection.c.


Typedef Documentation

typedef struct _string string

Enumeration Type Documentation

Enumerator:
REF_TYPE_OTHER 
REF_TYPE_FUNCTION 
REF_TYPE_PARAMETER 
REF_TYPE_PROPERTY 
REF_TYPE_DYNAMIC_PROPERTY 

Definition at line 189 of file php_reflection.c.


Function Documentation

static int _addconstant ( zend_constant *constant  TSRMLS_DC,
int  num_args,
va_list  args,
zend_hash_key hash_key 
) [static]

Definition at line 4877 of file php_reflection.c.

{
       zval *const_val;
       zval *retval = va_arg(args, zval*);
       int number = va_arg(args, int);

       if (number == constant->module_number) {
              ALLOC_ZVAL(const_val);
              *const_val = constant->value;
              zval_copy_ctor(const_val);
              INIT_PZVAL(const_val);
              add_assoc_zval_ex(retval, constant->name, constant->name_len, const_val);
       }
       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int _adddynproperty ( zval **pptr  TSRMLS_DC,
int  num_args,
va_list  args,
zend_hash_key hash_key 
) [static]

Definition at line 3664 of file php_reflection.c.

{
       zval *property;
       zend_class_entry *ce = *va_arg(args, zend_class_entry**);
       zval *retval = va_arg(args, zval*), member;

       if (hash_key->arKey[0] == '\0') {
              return 0; /* non public cannot be dynamic */
       }

       ZVAL_STRINGL(&member, hash_key->arKey, hash_key->nKeyLength-1, 0);
       if (zend_get_property_info(ce, &member, 1 TSRMLS_CC) == &EG(std_property_info)) {
              MAKE_STD_ZVAL(property);
              EG(std_property_info).flags = ZEND_ACC_IMPLICIT_PUBLIC;
              reflection_property_factory(ce, &EG(std_property_info), property TSRMLS_CC);
              add_next_index_zval(retval, property);
       }
       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int _addinientry ( zend_ini_entry *ini_entry  TSRMLS_DC,
int  num_args,
va_list  args,
zend_hash_key hash_key 
) [static]

Definition at line 4911 of file php_reflection.c.

{
       zval *retval = va_arg(args, zval*);
       int number = va_arg(args, int);

       if (number == ini_entry->module_number) {
              if (ini_entry->value) {
                     add_assoc_stringl(retval, ini_entry->name, ini_entry->value, ini_entry->value_length, 1);
              } else {
                     add_assoc_null(retval, ini_entry->name);
              }
       }
       return ZEND_HASH_APPLY_KEEP;
}

Here is the caller graph for this function:

static void _addmethod ( zend_function mptr,
zend_class_entry *  ce,
zval *  retval,
long  filter,
zval *obj  TSRMLS_DC 
) [static]

Definition at line 3466 of file php_reflection.c.

{
       zval *method;
       uint len = strlen(mptr->common.function_name);
       zend_function *closure;

       if (mptr->common.fn_flags & filter) {
              ALLOC_ZVAL(method);
              if (ce == zend_ce_closure && obj && (len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
                     && memcmp(mptr->common.function_name, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
                     && (closure = zend_get_closure_invoke_method(obj TSRMLS_CC)) != NULL)
              {
                     mptr = closure;
              }
              /* don't assign closure_object since we only reflect the invoke handler
                 method and not the closure definition itself, even if we have a
                 closure */
              reflection_method_factory(ce, mptr, NULL, method TSRMLS_CC);
              add_next_index_zval(retval, method);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int _addmethod_va ( zend_function *mptr  TSRMLS_DC,
int  num_args,
va_list  args,
zend_hash_key hash_key 
) [static]

Definition at line 3490 of file php_reflection.c.

{
       zend_class_entry *ce = *va_arg(args, zend_class_entry**);
       zval *retval = va_arg(args, zval*);
       long filter = va_arg(args, long);
       zval *obj = va_arg(args, zval *);
       
       _addmethod(mptr, ce, retval, filter, obj TSRMLS_CC);
       return ZEND_HASH_APPLY_KEEP;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int _addproperty ( zend_property_info *pptr  TSRMLS_DC,
int  num_args,
va_list  args,
zend_hash_key hash_key 
) [static]

Definition at line 3643 of file php_reflection.c.

{
       zval *property;
       zend_class_entry *ce = *va_arg(args, zend_class_entry**);
       zval *retval = va_arg(args, zval*);
       long filter = va_arg(args, long);

       if (pptr->flags      & ZEND_ACC_SHADOW) {
              return 0;
       }
       
       if (pptr->flags      & filter) {
              ALLOC_ZVAL(property);
              reflection_property_factory(ce, pptr, property TSRMLS_CC);
              add_next_index_zval(retval, property);
       }
       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void _class_check_flag ( INTERNAL_FUNCTION_PARAMETERS  ,
int  mask 
) [static]

Definition at line 3782 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(ce);
       RETVAL_BOOL(ce->ce_flags & mask);
}

Here is the caller graph for this function:

static void _class_string ( string str,
zend_class_entry *  ce,
zval *  obj,
char *indent  TSRMLS_DC 
) [static]

Definition at line 342 of file php_reflection.c.

{
       int count, count_static_props = 0, count_static_funcs = 0, count_shadow_props = 0;
       string sub_indent;
       
       string_init(&sub_indent);
       string_printf(&sub_indent, "%s    ", indent);

       /* TBD: Repair indenting of doc comment (or is this to be done in the parser?) */
       if (ce->type == ZEND_USER_CLASS && ce->doc_comment) {
              string_printf(str, "%s%s", indent, ce->doc_comment);
              string_write(str, "\n", 1);
       }

       if (obj) {
              string_printf(str, "%sObject of class [ ", indent);
       } else {
              string_printf(str, "%s%s [ ", indent, (ce->ce_flags & ZEND_ACC_INTERFACE) ? "Interface" : "Class");
       }
       string_printf(str, (ce->type == ZEND_USER_CLASS) ? "<user" : "<internal");
       if (ce->module) {
              string_printf(str, ":%s", ce->module->name);
       }
       string_printf(str, "> ");
       if (ce->get_iterator != NULL) {
              string_printf(str, "<iterateable> ");
       }
       if (ce->ce_flags & ZEND_ACC_INTERFACE) {
              string_printf(str, "interface ");
       } else {
              if (ce->ce_flags & (ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) {
                     string_printf(str, "abstract ");
              }
              if (ce->ce_flags & ZEND_ACC_FINAL_CLASS) {
                     string_printf(str, "final ");
              } 
              string_printf(str, "class ");
       }
       string_printf(str, "%s", ce->name);
       if (ce->parent) {
              string_printf(str, " extends %s", ce->parent->name);
       }

       if (ce->num_interfaces) {
              zend_uint i;

              if (ce->ce_flags & ZEND_ACC_INTERFACE) {
                     string_printf(str, " extends %s", ce->interfaces[0]->name);
              } else {
                     string_printf(str, " implements %s", ce->interfaces[0]->name);
              }
              for (i = 1; i < ce->num_interfaces; ++i) {
                     string_printf(str, ", %s", ce->interfaces[i]->name);
              }
       }
       string_printf(str, " ] {\n");

       /* The information where a class is declared is only available for user classes */
       if (ce->type == ZEND_USER_CLASS) {
              string_printf(str, "%s  @@ %s %d-%d\n", indent, ce->filename,
                                          ce->line_start, ce->line_end);
       }

       /* Constants */
       if (&ce->constants_table) {
              zend_hash_apply_with_argument(&ce->constants_table, (apply_func_arg_t) zval_update_constant, (void*)1 TSRMLS_CC);
              string_printf(str, "\n");
              count = zend_hash_num_elements(&ce->constants_table);
              string_printf(str, "%s  - Constants [%d] {\n", indent, count);
              if (count > 0) {
                     HashPosition pos;
                     zval **value;
                     char *key;
                     uint key_len;
                     ulong num_index;

                     zend_hash_internal_pointer_reset_ex(&ce->constants_table, &pos);

                     while (zend_hash_get_current_data_ex(&ce->constants_table, (void **) &value, &pos) == SUCCESS) {
                            zend_hash_get_current_key_ex(&ce->constants_table, &key, &key_len, &num_index, 0, &pos);

                            _const_string(str, key, *value, indent TSRMLS_CC);
                            zend_hash_move_forward_ex(&ce->constants_table, &pos);
                     }
              }
              string_printf(str, "%s  }\n", indent);
       }

       /* Static properties */
       if (&ce->properties_info) {
              /* counting static properties */          
              count = zend_hash_num_elements(&ce->properties_info);
              if (count > 0) {
                     HashPosition pos;
                     zend_property_info *prop;

                     zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos);

                     while (zend_hash_get_current_data_ex(&ce->properties_info, (void **) &prop, &pos) == SUCCESS) {
                            if(prop->flags & ZEND_ACC_SHADOW) {
                                   count_shadow_props++;
                            } else if (prop->flags & ZEND_ACC_STATIC) {
                                   count_static_props++;
                            }
                            zend_hash_move_forward_ex(&ce->properties_info, &pos);
                     }
              }

              /* static properties */            
              string_printf(str, "\n%s  - Static properties [%d] {\n", indent, count_static_props);
              if (count_static_props > 0) {
                     HashPosition pos;
                     zend_property_info *prop;

                     zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos);

                     while (zend_hash_get_current_data_ex(&ce->properties_info, (void **) &prop, &pos) == SUCCESS) {
                            if ((prop->flags & ZEND_ACC_STATIC) && !(prop->flags & ZEND_ACC_SHADOW)) {
                                   _property_string(str, prop, NULL, sub_indent.string TSRMLS_CC);
                            }

                            zend_hash_move_forward_ex(&ce->properties_info, &pos);
                     }
              }
              string_printf(str, "%s  }\n", indent);
       }
       
       /* Static methods */
       if (&ce->function_table) {
              /* counting static methods */             
              count = zend_hash_num_elements(&ce->function_table);
              if (count > 0) {
                     HashPosition pos;
                     zend_function *mptr;

                     zend_hash_internal_pointer_reset_ex(&ce->function_table, &pos);

                     while (zend_hash_get_current_data_ex(&ce->function_table, (void **) &mptr, &pos) == SUCCESS) {
                            if (mptr->common.fn_flags & ZEND_ACC_STATIC
                                   && ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce))
                            {
                                   count_static_funcs++;
                            }
                            zend_hash_move_forward_ex(&ce->function_table, &pos);
                     }
              }

              /* static methods */        
              string_printf(str, "\n%s  - Static methods [%d] {", indent, count_static_funcs);
              if (count_static_funcs > 0) {
                     HashPosition pos;
                     zend_function *mptr;

                     zend_hash_internal_pointer_reset_ex(&ce->function_table, &pos);

                     while (zend_hash_get_current_data_ex(&ce->function_table, (void **) &mptr, &pos) == SUCCESS) {
                            if (mptr->common.fn_flags & ZEND_ACC_STATIC
                                   && ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce))
                            {
                                   string_printf(str, "\n");
                                   _function_string(str, mptr, ce, sub_indent.string TSRMLS_CC);
                            }
                            zend_hash_move_forward_ex(&ce->function_table, &pos);
                     }
              } else {
                     string_printf(str, "\n");
              }
              string_printf(str, "%s  }\n", indent);
       }

       /* Default/Implicit properties */
       if (&ce->properties_info) {
              count = zend_hash_num_elements(&ce->properties_info) - count_static_props - count_shadow_props;
              string_printf(str, "\n%s  - Properties [%d] {\n", indent, count);
              if (count > 0) {
                     HashPosition pos;
                     zend_property_info *prop;

                     zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos);

                     while (zend_hash_get_current_data_ex(&ce->properties_info, (void **) &prop, &pos) == SUCCESS) {
                            if (!(prop->flags & (ZEND_ACC_STATIC|ZEND_ACC_SHADOW))) {
                                   _property_string(str, prop, NULL, sub_indent.string TSRMLS_CC);
                            }
                            zend_hash_move_forward_ex(&ce->properties_info, &pos);
                     }
              }
              string_printf(str, "%s  }\n", indent);
       }

       if (obj && Z_OBJ_HT_P(obj)->get_properties) {
              string       dyn;
              HashTable    *properties = Z_OBJ_HT_P(obj)->get_properties(obj TSRMLS_CC);
              HashPosition pos;
              zval         **prop;

              string_init(&dyn);
              count = 0;

              if (properties && zend_hash_num_elements(properties)) {
                     zend_hash_internal_pointer_reset_ex(properties, &pos);

                     while (zend_hash_get_current_data_ex(properties, (void **) &prop, &pos) == SUCCESS) {
                            char  *prop_name;
                            uint  prop_name_size;
                            ulong index;

                            if (zend_hash_get_current_key_ex(properties, &prop_name, &prop_name_size, &index, 1, &pos) == HASH_KEY_IS_STRING) {
                                   if (prop_name_size && prop_name[0]) { /* skip all private and protected properties */
                                          if (!zend_hash_quick_exists(&ce->properties_info, prop_name, prop_name_size, zend_get_hash_value(prop_name, prop_name_size))) {
                                                 count++;
                                                 _property_string(&dyn, NULL, prop_name, sub_indent.string TSRMLS_CC); 
                                          }
                                   }
                                   efree(prop_name);
                            }
                            zend_hash_move_forward_ex(properties, &pos);
                     }
              }

              string_printf(str, "\n%s  - Dynamic properties [%d] {\n", indent, count);
              string_append(str, &dyn);
              string_printf(str, "%s  }\n", indent);
              string_free(&dyn);
       }

       /* Non static methods */
       if (&ce->function_table) {
              count = zend_hash_num_elements(&ce->function_table) - count_static_funcs;
              if (count > 0) {
                     HashPosition pos;
                     zend_function *mptr;
                     string dyn;

                     count = 0;
                     string_init(&dyn);
                     zend_hash_internal_pointer_reset_ex(&ce->function_table, &pos);

                     while (zend_hash_get_current_data_ex(&ce->function_table, (void **) &mptr, &pos) == SUCCESS) {
                            if ((mptr->common.fn_flags & ZEND_ACC_STATIC) == 0
                                   && ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce))
                            {
                                   char *key;
                                   uint key_len;
                                   ulong num_index;
                                   uint len = strlen(mptr->common.function_name);

                                   /* Do not display old-style inherited constructors */
                                   if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0
                                          || mptr->common.scope == ce
                                          || zend_hash_get_current_key_ex(&ce->function_table, &key, &key_len, &num_index, 0, &pos) != HASH_KEY_IS_STRING
                                          || zend_binary_strcasecmp(key, key_len-1, mptr->common.function_name, len) == 0)
                                   {
                                          zend_function *closure;
                                          /* see if this is a closure */
                                          if (ce == zend_ce_closure && obj && (len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
                                                 && memcmp(mptr->common.function_name, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
                                                 && (closure = zend_get_closure_invoke_method(obj TSRMLS_CC)) != NULL)
                                          {
                                                 mptr = closure;
                                          } else {
                                                 closure = NULL;
                                          }
                                          string_printf(&dyn, "\n");
                                          _function_string(&dyn, mptr, ce, sub_indent.string TSRMLS_CC);
                                          count++;
                                          _free_function(closure TSRMLS_CC);
                                   }
                            }
                            zend_hash_move_forward_ex(&ce->function_table, &pos);
                     }
                     string_printf(str, "\n%s  - Methods [%d] {", indent, count);
                     if (!count) {
                            string_printf(str, "\n");
                     }
                     string_append(str, &dyn);
                     string_free(&dyn);
              } else {
                     string_printf(str, "\n%s  - Methods [0] {\n", indent);
              }
              string_printf(str, "%s  }\n", indent);
       }
       
       string_printf(str, "%s}\n", indent);
       string_free(&sub_indent);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void _const_string ( string str,
char *  name,
zval *  value,
char *indent  TSRMLS_DC 
) [static]

Definition at line 631 of file php_reflection.c.

{
       char *type;
       zval value_copy;
       int use_copy;

       type = zend_zval_type_name(value);

       zend_make_printable_zval(value, &value_copy, &use_copy);
       if (use_copy) {
              value = &value_copy;
       }

       string_printf(str, "%s    Constant [ %s %s ] { %s }\n",
                                   indent, type, name, Z_STRVAL_P(value));

       if (use_copy) {
              zval_dtor(value);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static zend_function* _copy_function ( zend_function *fptr  TSRMLS_DC) [static]

Definition at line 242 of file php_reflection.c.

{
       if (fptr
              && fptr->type == ZEND_INTERNAL_FUNCTION
              && (fptr->internal_function.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0)
       {
              zend_function *copy_fptr;
              copy_fptr = emalloc(sizeof(zend_function));
              memcpy(copy_fptr, fptr, sizeof(zend_function));
              copy_fptr->internal_function.function_name = estrdup(fptr->internal_function.function_name);
              return copy_fptr;
       } else {
              /* no copy needed */
              return fptr;
       }
}

Here is the caller graph for this function:

static void _default_get_entry ( zval *  object,
char *  name,
int  name_len,
zval *return_value  TSRMLS_DC 
) [static]

Definition at line 209 of file php_reflection.c.

{
       zval **value;

       if (zend_hash_find(Z_OBJPROP_P(object), name, name_len, (void **) &value) == FAILURE) {
              RETURN_FALSE;
       }

       MAKE_COPY_ZVAL(value, return_value);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int _extension_class_string ( zend_class_entry **pce  TSRMLS_DC,
int  num_args,
va_list  args,
zend_hash_key hash_key 
) [static]

Definition at line 976 of file php_reflection.c.

{
       string *str = va_arg(args, string *);
       char *indent = va_arg(args, char *);
       struct _zend_module_entry *module = va_arg(args, struct _zend_module_entry*);
       int *num_classes = va_arg(args, int*);

       if ((*pce)->module && !strcasecmp((*pce)->module->name, module->name)) {
              string_printf(str, "\n");
              _class_string(str, *pce, NULL, indent TSRMLS_CC);
              (*num_classes)++;
       }
       return ZEND_HASH_APPLY_KEEP;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int _extension_const_string ( zend_constant *constant  TSRMLS_DC,
int  num_args,
va_list  args,
zend_hash_key hash_key 
) [static]

Definition at line 991 of file php_reflection.c.

{
       string *str = va_arg(args, string *);
       char *indent = va_arg(args, char *);
       struct _zend_module_entry *module = va_arg(args, struct _zend_module_entry*);
       int *num_classes = va_arg(args, int*);

       if (constant->module_number  == module->module_number) {
              _const_string(str, constant->name, &constant->value, indent TSRMLS_CC);
              (*num_classes)++;
       }
       return ZEND_HASH_APPLY_KEEP;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int _extension_ini_string ( zend_ini_entry *ini_entry  TSRMLS_DC,
int  num_args,
va_list  args,
zend_hash_key hash_key 
) [static]

Definition at line 941 of file php_reflection.c.

{
       string *str = va_arg(args, string *);
       char *indent = va_arg(args, char *);
       int number = va_arg(args, int);
       char *comma = "";

       if (number == ini_entry->module_number) {
              string_printf(str, "    %sEntry [ %s <", indent, ini_entry->name);
              if (ini_entry->modifiable == ZEND_INI_ALL) {
                     string_printf(str, "ALL");
              } else {
                     if (ini_entry->modifiable & ZEND_INI_USER) {
                            string_printf(str, "USER");
                            comma = ",";
                     }
                     if (ini_entry->modifiable & ZEND_INI_PERDIR) {
                            string_printf(str, "%sPERDIR", comma);
                            comma = ",";
                     }
                     if (ini_entry->modifiable & ZEND_INI_SYSTEM) {
                            string_printf(str, "%sSYSTEM", comma);
                     }
              }

              string_printf(str, "> ]\n");
              string_printf(str, "    %s  Current = '%s'\n", indent, ini_entry->value ? ini_entry->value : "");
              if (ini_entry->modified) {
                     string_printf(str, "    %s  Default = '%s'\n", indent, ini_entry->orig_value ? ini_entry->orig_value : "");
              }
              string_printf(str, "    %s}\n", indent);
       }
       return ZEND_HASH_APPLY_KEEP;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void _extension_string ( string str,
zend_module_entry *  module,
char *indent  TSRMLS_DC 
) [static]

Definition at line 1006 of file php_reflection.c.

{
       string_printf(str, "%sExtension [ ", indent);
       if (module->type == MODULE_PERSISTENT) {
              string_printf(str, "<persistent>");
       }
       if (module->type == MODULE_TEMPORARY) {
              string_printf(str, "<temporary>" );
       }
       string_printf(str, " extension #%d %s version %s ] {\n",
                                   module->module_number, module->name,
                                   (module->version == NO_VERSION_YET) ? "<no_version>" : module->version);

       if (module->deps) {
              const zend_module_dep* dep = module->deps;

              string_printf(str, "\n  - Dependencies {\n");

              while(dep->name) {
                     string_printf(str, "%s    Dependency [ %s (", indent, dep->name);
                     
                     switch(dep->type) {
                     case MODULE_DEP_REQUIRED:
                            string_write(str, "Required", sizeof("Required") - 1);
                            break;
                     case MODULE_DEP_CONFLICTS:
                            string_write(str, "Conflicts", sizeof("Conflicts") - 1);
                            break;
                     case MODULE_DEP_OPTIONAL:
                            string_write(str, "Optional", sizeof("Optional") - 1);
                            break;
                     default:
                            string_write(str, "Error", sizeof("Error") - 1); /* shouldn't happen */
                            break;
                     }

                     if (dep->rel) {      
                            string_printf(str, " %s", dep->rel);
                     }
                     if (dep->version) {  
                            string_printf(str, " %s", dep->version);
                     }
                     string_write(str, ") ]\n", sizeof(") ]\n") - 1);
                     dep++;
              }
              string_printf(str, "%s  }\n", indent);
       }

       {
              string str_ini;
              string_init(&str_ini);
              zend_hash_apply_with_arguments(EG(ini_directives) TSRMLS_CC, (apply_func_args_t) _extension_ini_string, 3, &str_ini, indent, module->module_number);
              if (str_ini.len > 1) {
                     string_printf(str, "\n  - INI {\n");
                     string_append(str, &str_ini);
                     string_printf(str, "%s  }\n", indent);
              }
              string_free(&str_ini);
       }

       {
              string str_constants;
              int num_constants = 0;
              
              string_init(&str_constants);
              zend_hash_apply_with_arguments(EG(zend_constants) TSRMLS_CC, (apply_func_args_t) _extension_const_string, 4, &str_constants, indent, module, &num_constants);
              if (num_constants) {
                     string_printf(str, "\n  - Constants [%d] {\n", num_constants);
                     string_append(str, &str_constants);
                     string_printf(str, "%s  }\n", indent);
              }
              string_free(&str_constants);
       }

       if (module->functions && module->functions->fname) {
              zend_function *fptr;
              const zend_function_entry *func = module->functions;

              string_printf(str, "\n  - Functions {\n");

              /* Is there a better way of doing this? */
              while (func->fname) {
                     int fname_len = strlen(func->fname);
                     char *lc_name = zend_str_tolower_dup(func->fname, fname_len);
                     
                     if (zend_hash_find(EG(function_table), lc_name, fname_len+1, (void**) &fptr) == FAILURE) {
                            php_error_docref(NULL TSRMLS_CC, E_WARNING, "Internal error: Cannot find extension function %s in global function table", func->fname);
                            func++;
                            efree(lc_name);
                            continue;
                     }
                     
                     _function_string(str, fptr, NULL, "    " TSRMLS_CC);
                     efree(lc_name);
                     func++;
              }
              string_printf(str, "%s  }\n", indent);
       }
       
       {
              string str_classes;
              string sub_indent;
              int num_classes = 0;
              
              string_init(&sub_indent);
              string_printf(&sub_indent, "%s    ", indent);
              string_init(&str_classes);
              zend_hash_apply_with_arguments(EG(class_table) TSRMLS_CC, (apply_func_args_t) _extension_class_string, 4, &str_classes, sub_indent.string, module, &num_classes);
              if (num_classes) {
                     string_printf(str, "\n  - Classes [%d] {", num_classes);
                     string_append(str, &str_classes);
                     string_printf(str, "%s  }\n", indent);
              }
              string_free(&str_classes);
              string_free(&sub_indent);
       }

       string_printf(str, "%s}\n", indent);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void _free_function ( zend_function *fptr  TSRMLS_DC) [static]

Definition at line 260 of file php_reflection.c.

{
       if (fptr
              && fptr->type == ZEND_INTERNAL_FUNCTION
              && (fptr->internal_function.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0)
       {
              efree(fptr->internal_function.function_name);
              efree(fptr);
       }
}

Here is the caller graph for this function:

static void _function_check_flag ( INTERNAL_FUNCTION_PARAMETERS  ,
int  mask 
) [static]

Definition at line 1128 of file php_reflection.c.

{
       reflection_object *intern;
       zend_function *mptr;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(mptr);
       RETURN_BOOL(mptr->common.fn_flags & mask);
}

Here is the caller graph for this function:

static void _function_closure_string ( string str,
zend_function fptr,
char *indent  TSRMLS_DC 
) [static]

Definition at line 763 of file php_reflection.c.

{
       zend_uint i, count;
       ulong num_index;
       char *key;
       uint key_len;
       HashTable *static_variables;
       HashPosition pos;

       if (fptr->type != ZEND_USER_FUNCTION || !fptr->op_array.static_variables) {
              return;
       }

       static_variables = fptr->op_array.static_variables;
       count = zend_hash_num_elements(static_variables);

       if (!count) {
              return;
       }

       string_printf(str, "\n");
       string_printf(str, "%s- Bound Variables [%d] {\n", indent, zend_hash_num_elements(static_variables));
       zend_hash_internal_pointer_reset_ex(static_variables, &pos);
       i = 0;
       while (i < count) {
              zend_hash_get_current_key_ex(static_variables, &key, &key_len, &num_index, 0, &pos);
              string_printf(str, "%s    Variable #%d [ $%s ]\n", indent, i++, key);
              zend_hash_move_forward_ex(static_variables, &pos);
       }
       string_printf(str, "%s}\n", indent);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void _function_parameter_string ( string str,
zend_function fptr,
char *indent  TSRMLS_DC 
) [static]

Definition at line 741 of file php_reflection.c.

{
       struct _zend_arg_info *arg_info = fptr->common.arg_info;
       zend_uint i, required = fptr->common.required_num_args;

       if (!arg_info) {
              return;
       }

       string_printf(str, "\n");
       string_printf(str, "%s- Parameters [%d] {\n", indent, fptr->common.num_args);
       for (i = 0; i < fptr->common.num_args; i++) {
              string_printf(str, "%s  ", indent);
              _parameter_string(str, fptr, arg_info, i, required, indent TSRMLS_CC);
              string_write(str, "\n", sizeof("\n")-1);
              arg_info++;
       }
       string_printf(str, "%s}\n", indent);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void _function_string ( string str,
zend_function fptr,
zend_class_entry *  scope,
char *indent  TSRMLS_DC 
) [static]

Definition at line 797 of file php_reflection.c.

{
       string param_indent;
       zend_function *overwrites;
       char *lc_name;
       unsigned int lc_name_len;

       /* TBD: Repair indenting of doc comment (or is this to be done in the parser?)
        * What's "wrong" is that any whitespace before the doc comment start is 
        * swallowed, leading to an unaligned comment.
        */
       if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.doc_comment) {
              string_printf(str, "%s%s\n", indent, fptr->op_array.doc_comment);
       }

       string_write(str, indent, strlen(indent));
       string_printf(str, fptr->common.fn_flags & ZEND_ACC_CLOSURE ? "Closure [ " : (fptr->common.scope ? "Method [ " : "Function [ "));
       string_printf(str, (fptr->type == ZEND_USER_FUNCTION) ? "<user" : "<internal");
       if (fptr->common.fn_flags & ZEND_ACC_DEPRECATED) {
              string_printf(str, ", deprecated");
       }
       if (fptr->type == ZEND_INTERNAL_FUNCTION && ((zend_internal_function*)fptr)->module) {
              string_printf(str, ":%s", ((zend_internal_function*)fptr)->module->name);
       }

       if (scope && fptr->common.scope) {
              if (fptr->common.scope != scope) {
                     string_printf(str, ", inherits %s", fptr->common.scope->name);
              } else if (fptr->common.scope->parent) {
                     lc_name_len = strlen(fptr->common.function_name);
                     lc_name = zend_str_tolower_dup(fptr->common.function_name, lc_name_len);
                     if (zend_hash_find(&fptr->common.scope->parent->function_table, lc_name, lc_name_len + 1, (void**) &overwrites) == SUCCESS) {
                            if (fptr->common.scope != overwrites->common.scope) {
                                   string_printf(str, ", overwrites %s", overwrites->common.scope->name);
                            }
                     }
                     efree(lc_name);
              }
       }
       if (fptr->common.prototype && fptr->common.prototype->common.scope) {
              string_printf(str, ", prototype %s", fptr->common.prototype->common.scope->name);
       }
       if (fptr->common.fn_flags & ZEND_ACC_CTOR) {
              string_printf(str, ", ctor");
       }
       if (fptr->common.fn_flags & ZEND_ACC_DTOR) {
              string_printf(str, ", dtor");
       }
       string_printf(str, "> ");

       if (fptr->common.fn_flags & ZEND_ACC_ABSTRACT) {
              string_printf(str, "abstract ");
       }
       if (fptr->common.fn_flags & ZEND_ACC_FINAL) {
              string_printf(str, "final ");
       }
       if (fptr->common.fn_flags & ZEND_ACC_STATIC) {
              string_printf(str, "static ");
       }

       if (fptr->common.scope) {
              /* These are mutually exclusive */
              switch (fptr->common.fn_flags & ZEND_ACC_PPP_MASK) {
                     case ZEND_ACC_PUBLIC:
                            string_printf(str, "public ");
                            break;
                     case ZEND_ACC_PRIVATE:
                            string_printf(str, "private ");
                            break;
                     case ZEND_ACC_PROTECTED:
                            string_printf(str, "protected ");
                            break;
                     default:
                            string_printf(str, "<visibility error> ");
                            break;
              }
              string_printf(str, "method ");
       } else {
              string_printf(str, "function ");
       }

       if (fptr->op_array.return_reference) {
              string_printf(str, "&");
       }
       string_printf(str, "%s ] {\n", fptr->common.function_name);
       /* The information where a function is declared is only available for user classes */
       if (fptr->type == ZEND_USER_FUNCTION) {
              string_printf(str, "%s  @@ %s %d - %d\n", indent, 
                                          fptr->op_array.filename,
                                          fptr->op_array.line_start,
                                          fptr->op_array.line_end);
       }
       string_init(&param_indent);
       string_printf(&param_indent, "%s  ", indent);
       if (fptr->common.fn_flags & ZEND_ACC_CLOSURE) {
              _function_closure_string(str, fptr, param_indent.string TSRMLS_CC);
       }
       _function_parameter_string(str, fptr, param_indent.string TSRMLS_CC);
       string_free(&param_indent);
       string_printf(str, "%s}\n", indent);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static zend_op* _get_recv_op ( zend_op_array *  op_array,
zend_uint  offset 
) [static]

Definition at line 654 of file php_reflection.c.

{
       zend_op *op = op_array->opcodes;
       zend_op *end = op + op_array->last;

       ++offset;
       while (op < end) {
              if ((op->opcode == ZEND_RECV || op->opcode == ZEND_RECV_INIT)
                     && op->op1.u.constant.value.lval == (long)offset)
              {
                     return op;
              }
              ++op;
       }
       return NULL;
}

Here is the caller graph for this function:

static void _parameter_string ( string str,
zend_function fptr,
struct _zend_arg_info arg_info,
zend_uint  offset,
zend_uint  required,
char *indent  TSRMLS_DC 
) [static]

Definition at line 673 of file php_reflection.c.

{
       string_printf(str, "Parameter #%d [ ", offset);
       if (offset >= required) {
              string_printf(str, "<optional> ");
       } else {
              string_printf(str, "<required> ");
       }
       if (arg_info->class_name) {
              string_printf(str, "%s ", arg_info->class_name);
              if (arg_info->allow_null) {
                     string_printf(str, "or NULL ");
              }
       } else if (arg_info->array_type_hint) {
              string_printf(str, "array ");
              if (arg_info->allow_null) {
                     string_printf(str, "or NULL ");
              }
       }
       if (arg_info->pass_by_reference) {
              string_write(str, "&", sizeof("&")-1);
       }
       if (arg_info->name) {
              string_printf(str, "$%s", arg_info->name);
       } else {
              string_printf(str, "$param%d", offset);
       }
       if (fptr->type == ZEND_USER_FUNCTION && offset >= required) {
              zend_op *precv = _get_recv_op((zend_op_array*)fptr, offset);
              if (precv && precv->opcode == ZEND_RECV_INIT && precv->op2.op_type != IS_UNUSED) {
                     zval *zv, zv_copy;
                     int use_copy;
                     string_write(str, " = ", sizeof(" = ")-1);
                     ALLOC_ZVAL(zv);
                     *zv = precv->op2.u.constant;
                     zval_copy_ctor(zv);
                     INIT_PZVAL(zv);
                     zval_update_constant_ex(&zv, (void*)1, fptr->common.scope TSRMLS_CC);
                     if (Z_TYPE_P(zv) == IS_BOOL) {
                            if (Z_LVAL_P(zv)) {
                                   string_write(str, "true", sizeof("true")-1);
                            } else {
                                   string_write(str, "false", sizeof("false")-1);
                            }
                     } else if (Z_TYPE_P(zv) == IS_NULL) {
                            string_write(str, "NULL", sizeof("NULL")-1);
                     } else if (Z_TYPE_P(zv) == IS_STRING) {
                            string_write(str, "'", sizeof("'")-1);
                            string_write(str, Z_STRVAL_P(zv), MIN(Z_STRLEN_P(zv), 15));
                            if (Z_STRLEN_P(zv) > 15) {
                                   string_write(str, "...", sizeof("...")-1);
                            }
                            string_write(str, "'", sizeof("'")-1);
                     } else {
                            zend_make_printable_zval(zv, &zv_copy, &use_copy);
                            string_write(str, Z_STRVAL(zv_copy), Z_STRLEN(zv_copy));
                            if (use_copy) {
                                   zval_dtor(&zv_copy);
                            }
                     }
                     zval_ptr_dtor(&zv);
              }
       }
       string_write(str, " ]", sizeof(" ]")-1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void _property_check_flag ( INTERNAL_FUNCTION_PARAMETERS  ,
int  mask 
) [static]

Definition at line 4478 of file php_reflection.c.

Here is the caller graph for this function:

static void _property_string ( string str,
zend_property_info prop,
char *  prop_name,
char *indent  TSRMLS_DC 
) [static]

Definition at line 901 of file php_reflection.c.

{
       char *class_name;

       string_printf(str, "%sProperty [ ", indent);
       if (!prop) {
              string_printf(str, "<dynamic> public $%s", prop_name);
       } else {
              if (!(prop->flags & ZEND_ACC_STATIC)) {
                     if (prop->flags & ZEND_ACC_IMPLICIT_PUBLIC) {
                            string_write(str, "<implicit> ", sizeof("<implicit> ") - 1);
                     } else {
                            string_write(str, "<default> ", sizeof("<default> ") - 1);
                     }
              }
       
              /* These are mutually exclusive */
              switch (prop->flags & ZEND_ACC_PPP_MASK) {
                     case ZEND_ACC_PUBLIC:
                            string_printf(str, "public ");
                            break;
                     case ZEND_ACC_PRIVATE:
                            string_printf(str, "private ");
                            break;
                     case ZEND_ACC_PROTECTED:
                            string_printf(str, "protected ");
                            break;
              }
              if(prop->flags & ZEND_ACC_STATIC) {
                     string_printf(str, "static ");
              }

              zend_unmangle_property_name(prop->name, prop->name_length, &class_name, &prop_name);
              string_printf(str, "$%s", prop_name);
       }

       string_printf(str, " ]\n");
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void _reflection_export ( INTERNAL_FUNCTION_PARAMETERS  ,
zend_class_entry *  ce_ptr,
int  ctor_argc 
) [static]

Definition at line 1313 of file php_reflection.c.

{
       zval *reflector_ptr;
       zval output, *output_ptr = &output;
       zval *argument_ptr, *argument2_ptr;
       zval *retval_ptr, **params[2];
       int result;
       int return_output = 0;
       zend_fcall_info fci;
       zend_fcall_info_cache fcc;
       zval fname;

       if (ctor_argc == 1) {
              if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &argument_ptr, &return_output) == FAILURE) {
                     return;
              }
       } else {
              if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|b", &argument_ptr, &argument2_ptr, &return_output) == FAILURE) {
                     return;
              }
       }

       INIT_PZVAL(&output);

       /* Create object */
       MAKE_STD_ZVAL(reflector_ptr);
       if (object_and_properties_init(reflector_ptr, ce_ptr, NULL) == FAILURE) {
              _DO_THROW("Could not create reflector");
       }

       /* Call __construct() */
       params[0] = &argument_ptr;
       params[1] = &argument2_ptr;

       fci.size = sizeof(fci);
       fci.function_table = NULL;
       fci.function_name = NULL;
       fci.symbol_table = NULL;
       fci.object_ptr = reflector_ptr;
       fci.retval_ptr_ptr = &retval_ptr;
       fci.param_count = ctor_argc;
       fci.params = params;
       fci.no_separation = 1;

       fcc.initialized = 1;
       fcc.function_handler = ce_ptr->constructor;
       fcc.calling_scope = ce_ptr;
       fcc.called_scope = Z_OBJCE_P(reflector_ptr);
       fcc.object_ptr = reflector_ptr;

       result = zend_call_function(&fci, &fcc TSRMLS_CC);
       
       if (retval_ptr) {
              zval_ptr_dtor(&retval_ptr);
       }

       if (EG(exception)) {
              zval_ptr_dtor(&reflector_ptr);
              return;
       }
       if (result == FAILURE) {
              zval_ptr_dtor(&reflector_ptr);
              _DO_THROW("Could not create reflector");
       }

       /* Call static reflection::export */
       ZVAL_BOOL(&output, return_output);
       params[0] = &reflector_ptr;
       params[1] = &output_ptr;

       ZVAL_STRINGL(&fname, "reflection::export", sizeof("reflection::export") - 1, 0);
       fci.function_table = &reflection_ptr->function_table;
       fci.function_name = &fname;
       fci.object_ptr = NULL;
       fci.retval_ptr_ptr = &retval_ptr;
       fci.param_count = 2;
       fci.params = params;
       fci.no_separation = 1;

       result = zend_call_function(&fci, NULL TSRMLS_CC);

       if (result == FAILURE && EG(exception) == NULL) {
              zval_ptr_dtor(&reflector_ptr);
              zval_ptr_dtor(&retval_ptr);
              _DO_THROW("Could not execute reflection::export()");
       }

       if (return_output) {
              COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
       } else {
              zval_ptr_dtor(&retval_ptr);
       }

       /* Destruct reflector which is no longer needed */
       zval_ptr_dtor(&reflector_ptr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void _reflection_write_property ( zval *  object,
zval *  member,
zval *value  TSRMLS_DC 
) [static]

Definition at line 5441 of file php_reflection.c.

{
       if ((Z_TYPE_P(member) == IS_STRING)
              && zend_hash_exists(&Z_OBJCE_P(object)->default_properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1)
              && ((Z_STRLEN_P(member) == sizeof("name") - 1  && !memcmp(Z_STRVAL_P(member), "name",  sizeof("name")))
                     || (Z_STRLEN_P(member) == sizeof("class") - 1 && !memcmp(Z_STRVAL_P(member), "class", sizeof("class")))))
       {
              zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                     "Cannot set read-only property %s::$%s", Z_OBJCE_P(object)->name, Z_STRVAL_P(member));
       }
       else
       {
              zend_std_obj_handlers->write_property(object, member, value TSRMLS_CC);             
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int _zval_array_to_c_array ( zval **  arg,
zval ****params  TSRMLS_DC 
) [static]

Definition at line 1795 of file php_reflection.c.

{
       *(*params)++ = arg;
       return ZEND_HASH_APPLY_KEEP;
} /* }}} */

Here is the caller graph for this function:

static int add_extension_class ( zend_class_entry **pce  TSRMLS_DC,
int  num_args,
va_list  args,
zend_hash_key hash_key 
) [static]

Definition at line 4945 of file php_reflection.c.

{
       zval *class_array = va_arg(args, zval*), *zclass;
       struct _zend_module_entry *module = va_arg(args, struct _zend_module_entry*);
       int add_reflection_class = va_arg(args, int);

       if ((*pce)->module && !strcasecmp((*pce)->module->name, module->name)) {
              if (add_reflection_class) {
                     ALLOC_ZVAL(zclass);
                     zend_reflection_class_factory(*pce, zclass TSRMLS_CC);
                     add_assoc_zval_ex(class_array, (*pce)->name, (*pce)->name_length + 1, zclass);
              } else {
                     add_next_index_stringl(class_array, (*pce)->name, (*pce)->name_length, 1);
              }
       }
       return ZEND_HASH_APPLY_KEEP;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PHP_MINFO_FUNCTION ( reflection  )

Definition at line 5543 of file php_reflection.c.

{
       php_info_print_table_start();
       php_info_print_table_header(2, "Reflection", "enabled");

       php_info_print_table_row(2, "Version", "$Revision: 321634 $");

       php_info_print_table_end();
} /* }}} */

Here is the call graph for this function:

PHP_MINIT_FUNCTION ( reflection  )

Definition at line 5458 of file php_reflection.c.

{
       zend_class_entry _reflection_entry;

       zend_std_obj_handlers = zend_get_std_object_handlers();
       memcpy(&reflection_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
       reflection_object_handlers.clone_obj = NULL;
       reflection_object_handlers.write_property = _reflection_write_property;

       INIT_CLASS_ENTRY(_reflection_entry, "ReflectionException", reflection_exception_functions);
       reflection_exception_ptr = zend_register_internal_class_ex(&_reflection_entry, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);

       INIT_CLASS_ENTRY(_reflection_entry, "Reflection", reflection_functions);
       reflection_ptr = zend_register_internal_class(&_reflection_entry TSRMLS_CC);

       INIT_CLASS_ENTRY(_reflection_entry, "Reflector", reflector_functions);
       reflector_ptr = zend_register_internal_interface(&_reflection_entry TSRMLS_CC);

       INIT_CLASS_ENTRY(_reflection_entry, "ReflectionFunctionAbstract", reflection_function_abstract_functions);
       _reflection_entry.create_object = reflection_objects_new;
       reflection_function_abstract_ptr = zend_register_internal_class(&_reflection_entry TSRMLS_CC);
       reflection_register_implement(reflection_function_abstract_ptr, reflector_ptr TSRMLS_CC);
       zend_declare_property_string(reflection_function_abstract_ptr, "name", sizeof("name")-1, "", ZEND_ACC_ABSTRACT TSRMLS_CC);

       INIT_CLASS_ENTRY(_reflection_entry, "ReflectionFunction", reflection_function_functions);
       _reflection_entry.create_object = reflection_objects_new;
       reflection_function_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_function_abstract_ptr, NULL TSRMLS_CC);
       zend_declare_property_string(reflection_function_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);

       REGISTER_REFLECTION_CLASS_CONST_LONG(function, "IS_DEPRECATED", ZEND_ACC_DEPRECATED);

       INIT_CLASS_ENTRY(_reflection_entry, "ReflectionParameter", reflection_parameter_functions);
       _reflection_entry.create_object = reflection_objects_new;
       reflection_parameter_ptr = zend_register_internal_class(&_reflection_entry TSRMLS_CC);
       reflection_register_implement(reflection_parameter_ptr, reflector_ptr TSRMLS_CC);
       zend_declare_property_string(reflection_parameter_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);

       INIT_CLASS_ENTRY(_reflection_entry, "ReflectionMethod", reflection_method_functions);
       _reflection_entry.create_object = reflection_objects_new;
       reflection_method_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_function_abstract_ptr, NULL TSRMLS_CC);
       zend_declare_property_string(reflection_method_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
       zend_declare_property_string(reflection_method_ptr, "class", sizeof("class")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);

       REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_STATIC", ZEND_ACC_STATIC);
       REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_PUBLIC", ZEND_ACC_PUBLIC);
       REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_PROTECTED", ZEND_ACC_PROTECTED);
       REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_PRIVATE", ZEND_ACC_PRIVATE);
       REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_ABSTRACT", ZEND_ACC_ABSTRACT);
       REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_FINAL", ZEND_ACC_FINAL);

       INIT_CLASS_ENTRY(_reflection_entry, "ReflectionClass", reflection_class_functions);
       _reflection_entry.create_object = reflection_objects_new;
       reflection_class_ptr = zend_register_internal_class(&_reflection_entry TSRMLS_CC);
       reflection_register_implement(reflection_class_ptr, reflector_ptr TSRMLS_CC);
       zend_declare_property_string(reflection_class_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);

       REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_IMPLICIT_ABSTRACT", ZEND_ACC_IMPLICIT_ABSTRACT_CLASS);
       REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_EXPLICIT_ABSTRACT", ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
       REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_FINAL", ZEND_ACC_FINAL_CLASS);

       INIT_CLASS_ENTRY(_reflection_entry, "ReflectionObject", reflection_object_functions);
       _reflection_entry.create_object = reflection_objects_new;
       reflection_object_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_class_ptr, NULL TSRMLS_CC);

       INIT_CLASS_ENTRY(_reflection_entry, "ReflectionProperty", reflection_property_functions);
       _reflection_entry.create_object = reflection_objects_new;
       reflection_property_ptr = zend_register_internal_class(&_reflection_entry TSRMLS_CC);
       reflection_register_implement(reflection_property_ptr, reflector_ptr TSRMLS_CC);
       zend_declare_property_string(reflection_property_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);
       zend_declare_property_string(reflection_property_ptr, "class", sizeof("class")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);

       REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_STATIC", ZEND_ACC_STATIC);
       REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_PUBLIC", ZEND_ACC_PUBLIC);
       REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_PROTECTED", ZEND_ACC_PROTECTED);
       REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_PRIVATE", ZEND_ACC_PRIVATE);

       INIT_CLASS_ENTRY(_reflection_entry, "ReflectionExtension", reflection_extension_functions);
       _reflection_entry.create_object = reflection_objects_new;
       reflection_extension_ptr = zend_register_internal_class(&_reflection_entry TSRMLS_CC);
       reflection_register_implement(reflection_extension_ptr, reflector_ptr TSRMLS_CC);
       zend_declare_property_string(reflection_extension_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC);

       return SUCCESS;
} /* }}} */

Here is the call graph for this function:

static void reflection_class_object_ctor ( INTERNAL_FUNCTION_PARAMETERS  ,
int  is_object 
) [static]

Definition at line 3012 of file php_reflection.c.

{
       zval *argument;
       zval *object;
       zval *classname;
       reflection_object *intern;
       zend_class_entry **ce;

       if (is_object) {
              if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &argument) == FAILURE) {
                     return;
              }
       } else {
              if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/", &argument) == FAILURE) {
                     return;
              }
       }

       object = getThis();
       intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
       if (intern == NULL) {
              return;
       }
       
       if (Z_TYPE_P(argument) == IS_OBJECT) {
              MAKE_STD_ZVAL(classname);
              ZVAL_STRINGL(classname, Z_OBJCE_P(argument)->name, Z_OBJCE_P(argument)->name_length, 1);
              zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &classname, sizeof(zval *), NULL);
              intern->ptr = Z_OBJCE_P(argument);
              if (is_object) {
                     intern->obj = argument;
                     zval_add_ref(&argument);
              }
       } else { 
              convert_to_string_ex(&argument);
              if (zend_lookup_class(Z_STRVAL_P(argument), Z_STRLEN_P(argument), &ce TSRMLS_CC) == FAILURE) {
                     if (!EG(exception)) {
                            zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(argument));
                     }
                     return;
              }

              MAKE_STD_ZVAL(classname);
              ZVAL_STRINGL(classname, (*ce)->name, (*ce)->name_length, 1);
              zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &classname, sizeof(zval *), NULL);

              intern->ptr = *ce;
       }
       intern->ref_type = REF_TYPE_OTHER;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void reflection_extension_factory ( zval *  object,
const char *name_str  TSRMLS_DC 
) [static]

Definition at line 1159 of file php_reflection.c.

{
       reflection_object *intern;
       zval *name;
       int name_len = strlen(name_str);
       char *lcname;
       struct _zend_module_entry *module;
       ALLOCA_FLAG(use_heap)

       lcname = do_alloca(name_len + 1, use_heap);
       zend_str_tolower_copy(lcname, name_str, name_len);
       if (zend_hash_find(&module_registry, lcname, name_len + 1, (void **)&module) == FAILURE) {
              free_alloca(lcname, use_heap);
              return;
       }
       free_alloca(lcname, use_heap);

       reflection_instantiate(reflection_extension_ptr, object TSRMLS_CC);
       intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
       MAKE_STD_ZVAL(name);
       ZVAL_STRINGL(name, module->name, name_len, 1);
       intern->ptr = module;
       intern->ref_type = REF_TYPE_OTHER;
       intern->ce = NULL;
       zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void reflection_free_objects_storage ( void *object  TSRMLS_DC) [static]

Definition at line 272 of file php_reflection.c.

{
       reflection_object *intern = (reflection_object *) object;
       parameter_reference *reference;
       property_reference *prop_reference;

       if (intern->ptr) {
              switch (intern->ref_type) {
              case REF_TYPE_PARAMETER:
                     reference = (parameter_reference*)intern->ptr;
                     _free_function(reference->fptr TSRMLS_CC);
                     efree(intern->ptr);
                     break;
              case REF_TYPE_FUNCTION:
                     _free_function(intern->ptr TSRMLS_CC);
                     break;
              case REF_TYPE_PROPERTY:
                     efree(intern->ptr);
                     break;
              case REF_TYPE_DYNAMIC_PROPERTY:
                     prop_reference = (property_reference*)intern->ptr;
                     efree(prop_reference->prop.name);
                     efree(intern->ptr);
                     break;
              case REF_TYPE_OTHER:
                     break;
              }
       }
       intern->ptr = NULL;
       if (intern->obj) {
              zval_ptr_dtor(&intern->obj);
       }
       zend_objects_free_object_storage(object TSRMLS_CC);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void reflection_function_factory ( zend_function function,
zval *  closure_object,
zval *object  TSRMLS_DC 
) [static]

Definition at line 1219 of file php_reflection.c.

{
       reflection_object *intern;
       zval *name;

       if (closure_object) {
              Z_ADDREF_P(closure_object);
       }
       MAKE_STD_ZVAL(name);
       ZVAL_STRING(name, function->common.function_name, 1);

       reflection_instantiate(reflection_function_ptr, object TSRMLS_CC);
       intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
       intern->ptr = function;
       intern->ref_type = REF_TYPE_FUNCTION;
       intern->ce = NULL;
       intern->obj = closure_object;
       zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static zval* reflection_instantiate ( zend_class_entry *  pce,
zval *object  TSRMLS_DC 
) [static]

Definition at line 323 of file php_reflection.c.

{
       if (!object) {
              ALLOC_ZVAL(object);
       }
       Z_TYPE_P(object) = IS_OBJECT;
       object_init_ex(object, pce);
       Z_SET_REFCOUNT_P(object, 1);
       Z_SET_ISREF_P(object);
       return object;
}

Here is the caller graph for this function:

static void reflection_method_factory ( zend_class_entry *  ce,
zend_function method,
zval *  closure_object,
zval *object  TSRMLS_DC 
) [static]

Definition at line 1241 of file php_reflection.c.

{
       reflection_object *intern;
       zval *name;
       zval *classname;

       if (closure_object) {
              Z_ADDREF_P(closure_object);
       }
       MAKE_STD_ZVAL(name);
       MAKE_STD_ZVAL(classname);
       ZVAL_STRING(name, method->common.function_name, 1);
       ZVAL_STRINGL(classname, method->common.scope->name, method->common.scope->name_length, 1);
       reflection_instantiate(reflection_method_ptr, object TSRMLS_CC);
       intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
       intern->ptr = method;
       intern->ref_type = REF_TYPE_FUNCTION;
       intern->ce = ce;
       intern->obj = closure_object;
       zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL);
       zend_hash_update(Z_OBJPROP_P(object), "class", sizeof("class"), (void **) &classname, sizeof(zval *), NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static zend_object_value reflection_objects_new ( zend_class_entry *class_type  TSRMLS_DC) [static]

Definition at line 307 of file php_reflection.c.

{
       zval tmp;
       zend_object_value retval;
       reflection_object *intern;

       intern = ecalloc(1, sizeof(reflection_object));
       intern->zo.ce = class_type;

       zend_object_std_init(&intern->zo, class_type TSRMLS_CC);
       zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
       retval.handle = zend_objects_store_put(intern, NULL, reflection_free_objects_storage, NULL TSRMLS_CC);
       retval.handlers = &reflection_object_handlers;
       return retval;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void reflection_parameter_factory ( zend_function fptr,
zval *  closure_object,
struct _zend_arg_info arg_info,
zend_uint  offset,
zend_uint  required,
zval *object  TSRMLS_DC 
) [static]

Definition at line 1188 of file php_reflection.c.

{
       reflection_object *intern;
       parameter_reference *reference;
       zval *name;

       if (closure_object) {
              Z_ADDREF_P(closure_object);
       }
       MAKE_STD_ZVAL(name);
       if (arg_info->name) {
              ZVAL_STRINGL(name, arg_info->name, arg_info->name_len, 1);
       } else {
              ZVAL_NULL(name);
       }
       reflection_instantiate(reflection_parameter_ptr, object TSRMLS_CC);
       intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
       reference = (parameter_reference*) emalloc(sizeof(parameter_reference));
       reference->arg_info = arg_info;
       reference->offset = offset;
       reference->required = required;
       reference->fptr = fptr;
       intern->ptr = reference;
       intern->ref_type = REF_TYPE_PARAMETER;
       intern->ce = fptr->common.scope;
       intern->obj = closure_object;
       zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void reflection_property_factory ( zend_class_entry *  ce,
zend_property_info prop,
zval *object  TSRMLS_DC 
) [static]

Definition at line 1266 of file php_reflection.c.

{
       reflection_object *intern;
       zval *name;
       zval *classname;
       property_reference *reference;
       char *class_name, *prop_name;

       zend_unmangle_property_name(prop->name, prop->name_length, &class_name, &prop_name);

       if (!(prop->flags & ZEND_ACC_PRIVATE)) {
              /* we have to search the class hierarchy for this (implicit) public or protected property */
              zend_class_entry *tmp_ce = ce, *store_ce = ce;
              zend_property_info *tmp_info = NULL;

              while (tmp_ce && zend_hash_find(&tmp_ce->properties_info, prop_name, strlen(prop_name) + 1, (void **) &tmp_info) != SUCCESS) {
                     ce = tmp_ce;
                     tmp_ce = tmp_ce->parent;
              }

              if (tmp_info && !(tmp_info->flags & ZEND_ACC_SHADOW)) { /* found something and it's not a parent's private */
                     prop = tmp_info;
              } else { /* not found, use initial value */
                     ce = store_ce;
              }
       }

       MAKE_STD_ZVAL(name);
       MAKE_STD_ZVAL(classname);
       ZVAL_STRING(name, prop_name, 1);
       ZVAL_STRINGL(classname, prop->ce->name, prop->ce->name_length, 1);

       reflection_instantiate(reflection_property_ptr, object TSRMLS_CC);
       intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
       reference = (property_reference*) emalloc(sizeof(property_reference));
       reference->ce = ce;
       reference->prop = *prop;
       intern->ptr = reference;
       intern->ref_type = REF_TYPE_PROPERTY;
       intern->ce = ce;
       intern->ignore_visibility = 0;
       zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL);
       zend_hash_update(Z_OBJPROP_P(object), "class", sizeof("class"), (void **) &classname, sizeof(zval *), NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void reflection_register_implement ( zend_class_entry *  class_entry,
zend_class_entry *interface_entry  TSRMLS_DC 
) [static]

Definition at line 234 of file php_reflection.c.

{
       zend_uint num_interfaces = ++class_entry->num_interfaces;

       class_entry->interfaces = (zend_class_entry **) realloc(class_entry->interfaces, sizeof(zend_class_entry *) * num_interfaces);
       class_entry->interfaces[num_interfaces - 1] = interface_entry;
}

Here is the caller graph for this function:

static string* string_append ( string str,
string append 
) [static]

Definition at line 158 of file php_reflection.c.

{
       if (append->len > 1) {
              string_write(str, append->string, append->len - 1);
       }
       return str;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void string_free ( string str) [static]

Definition at line 166 of file php_reflection.c.

{
       efree(str->string);
       str->len = 0;
       str->alloced = 0;
       str->string = NULL;
}

Here is the caller graph for this function:

static void string_init ( string str) [static]

Definition at line 115 of file php_reflection.c.

{
       str->string = (char *) emalloc(1024);
       str->len = 1;
       str->alloced = 1024;
       *str->string = '\0';
}

Here is the caller graph for this function:

static string* string_printf ( string str,
const char *  format,
  ... 
) [static]

Definition at line 123 of file php_reflection.c.

{
       int len;
       va_list arg;
       char *s_tmp;

       va_start(arg, format);
       len = zend_vspprintf(&s_tmp, 0, format, arg);
       if (len) {
              register int nlen = (str->len + len + (1024 - 1)) & ~(1024 - 1);
              if (str->alloced < nlen) {
                     str->alloced = nlen;
                     str->string = erealloc(str->string, str->alloced);
              }
              memcpy(str->string + str->len - 1, s_tmp, len + 1);
              str->len += len;
       }
       efree(s_tmp);
       va_end(arg);
       return str;
}

Here is the caller graph for this function:

static string* string_write ( string str,
char *  buf,
int  len 
) [static]

Definition at line 145 of file php_reflection.c.

{
       register int nlen = (str->len + len + (1024 - 1)) & ~(1024 - 1);
       if (str->alloced < nlen) {
              str->alloced = nlen;
              str->string = erealloc(str->string, str->alloced);
       }
       memcpy(str->string + str->len - 1, buf, len);
       str->len += len;
       str->string[str->len - 1] = '\0';
       return str;
}

Here is the caller graph for this function:

ZEND_METHOD ( reflection  ,
__clone   
)

Definition at line 1412 of file php_reflection.c.

{
       /* Should never be executable */
       _DO_THROW("Cannot clone object using __clone()");
}
ZEND_METHOD ( reflection  ,
export   
)

Definition at line 1421 of file php_reflection.c.

{
       zval *object, fname, *retval_ptr;
       int result;
       zend_bool return_output = 0;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|b", &object, reflector_ptr, &return_output) == FAILURE) {
              return;
       }

       /* Invoke the __toString() method */
       ZVAL_STRINGL(&fname, "__tostring", sizeof("__tostring") - 1, 1);
       result= call_user_function_ex(NULL, &object, &fname, &retval_ptr, 0, NULL, 0, NULL TSRMLS_CC);
       zval_dtor(&fname);

       if (result == FAILURE) {
              _DO_THROW("Invocation of method __toString() failed");
              /* Returns from this function */
       }

       if (!retval_ptr) {
              php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::__toString() did not return anything", Z_OBJCE_P(object)->name);
              RETURN_FALSE;
       }

       if (return_output) {
              COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
       } else {
              /* No need for _r variant, return of __toString should always be a string */
              zend_print_zval(retval_ptr, 0);
              zend_printf("\n");
              zval_ptr_dtor(&retval_ptr);
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection  ,
getModifierNames   
)

Definition at line 1459 of file php_reflection.c.

{
       long modifiers;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &modifiers) == FAILURE) {
              return;
       }

       array_init(return_value);

       if (modifiers & (ZEND_ACC_ABSTRACT | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) {
              add_next_index_stringl(return_value, "abstract", sizeof("abstract")-1, 1);
       }
       if (modifiers & (ZEND_ACC_FINAL | ZEND_ACC_FINAL_CLASS)) {
              add_next_index_stringl(return_value, "final", sizeof("final")-1, 1);
       }
       if (modifiers & ZEND_ACC_IMPLICIT_PUBLIC) {
              add_next_index_stringl(return_value, "public", sizeof("public")-1, 1);
       }

       /* These are mutually exclusive */
       switch (modifiers & ZEND_ACC_PPP_MASK) {
              case ZEND_ACC_PUBLIC:
                     add_next_index_stringl(return_value, "public", sizeof("public")-1, 1);
                     break;
              case ZEND_ACC_PRIVATE:
                     add_next_index_stringl(return_value, "private", sizeof("private")-1, 1);
                     break;
              case ZEND_ACC_PROTECTED:
                     add_next_index_stringl(return_value, "protected", sizeof("protected")-1, 1);
                     break;
       }

       if (modifiers & ZEND_ACC_STATIC) {
              add_next_index_stringl(return_value, "static", sizeof("static")-1, 1);
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_function  ,
export   
)

Definition at line 1500 of file php_reflection.c.

Here is the call graph for this function:

ZEND_METHOD ( reflection_function  ,
__construct   
)

Definition at line 1508 of file php_reflection.c.

{
       zval *name;
       zval *object;
       zval *closure = NULL;
       char *lcname;
       reflection_object *intern;
       zend_function *fptr;
       char *name_str;
       int name_len;

       object = getThis();
       intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
       if (intern == NULL) {
              return;
       }

       if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "O", &closure, zend_ce_closure) == SUCCESS) {
              fptr = (zend_function*)zend_get_closure_method_def(closure TSRMLS_CC);
              Z_ADDREF_P(closure);
       } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len) == SUCCESS) {
              char *nsname;

              lcname = zend_str_tolower_dup(name_str, name_len);

              /* Ignore leading "\" */
              nsname = lcname;
              if (lcname[0] == '\\') {
                     nsname = &lcname[1];
                     name_len--;
              }
              
              if (zend_hash_find(EG(function_table), nsname, name_len + 1, (void **)&fptr) == FAILURE) {
                     efree(lcname);
                     zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                            "Function %s() does not exist", name_str);
                     return;
              }
              efree(lcname);
       } else {
              return;
       }

       MAKE_STD_ZVAL(name);
       ZVAL_STRING(name, fptr->common.function_name, 1);
       zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL);
       intern->ptr = fptr;
       intern->ref_type = REF_TYPE_FUNCTION;
       intern->obj = closure;
       intern->ce = NULL;
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_function  ,
__toString   
)

Definition at line 1563 of file php_reflection.c.

{
       reflection_object *intern;
       zend_function *fptr;
       string str;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(fptr);
       string_init(&str);
       _function_string(&str, fptr, intern->ce, "" TSRMLS_CC);
       RETURN_STRINGL(str.string, str.len - 1, 0);
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_function  ,
getName   
)

Definition at line 1581 of file php_reflection.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       _default_get_entry(getThis(), "name", sizeof("name"), return_value TSRMLS_CC);
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_function  ,
isClosure   
)

Definition at line 1592 of file php_reflection.c.

ZEND_METHOD ( reflection_function  ,
isInternal   
)

Definition at line 1607 of file php_reflection.c.

ZEND_METHOD ( reflection_function  ,
isUserDefined   
)

Definition at line 1622 of file php_reflection.c.

ZEND_METHOD ( reflection_function  ,
isDisabled   
)

Definition at line 1637 of file php_reflection.c.

ZEND_METHOD ( reflection_function  ,
getFileName   
)

Definition at line 1650 of file php_reflection.c.

{
       reflection_object *intern;
       zend_function *fptr;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(fptr);
       if (fptr->type == ZEND_USER_FUNCTION) {
              RETURN_STRING(fptr->op_array.filename, 1);
       }
       RETURN_FALSE;
}
ZEND_METHOD ( reflection_function  ,
getStartLine   
)

Definition at line 1668 of file php_reflection.c.

{
       reflection_object *intern;
       zend_function *fptr;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(fptr);
       if (fptr->type == ZEND_USER_FUNCTION) {
              RETURN_LONG(fptr->op_array.line_start);
       }
       RETURN_FALSE;
}
ZEND_METHOD ( reflection_function  ,
getEndLine   
)

Definition at line 1686 of file php_reflection.c.

{
       reflection_object *intern;
       zend_function *fptr;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(fptr);
       if (fptr->type == ZEND_USER_FUNCTION) {
              RETURN_LONG(fptr->op_array.line_end);
       }
       RETURN_FALSE;
}
ZEND_METHOD ( reflection_function  ,
getDocComment   
)

Definition at line 1704 of file php_reflection.c.

{
       reflection_object *intern;
       zend_function *fptr;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(fptr);
       if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.doc_comment) {
              RETURN_STRINGL(fptr->op_array.doc_comment, fptr->op_array.doc_comment_len, 1);
       }
       RETURN_FALSE;
}
ZEND_METHOD ( reflection_function  ,
getStaticVariables   
)

Definition at line 1722 of file php_reflection.c.

{
       zval *tmp_copy;
       reflection_object *intern;
       zend_function *fptr;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(fptr);

       /* Return an empty array in case no static variables exist */
       array_init(return_value);
       if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.static_variables != NULL) {
              zend_hash_apply_with_argument(fptr->op_array.static_variables, (apply_func_arg_t) zval_update_constant, (void*)1 TSRMLS_CC);
              zend_hash_copy(Z_ARRVAL_P(return_value), fptr->op_array.static_variables, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *));
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_function  ,
invoke   
)

Definition at line 1744 of file php_reflection.c.

{
       zval *retval_ptr;
       zval ***params = NULL;
       int result, num_args = 0;
       zend_fcall_info fci;
       zend_fcall_info_cache fcc;
       reflection_object *intern;
       zend_function *fptr;
       
       METHOD_NOTSTATIC(reflection_function_ptr);
       GET_REFLECTION_OBJECT_PTR(fptr);

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "*", &params, &num_args) == FAILURE) {
              return;
       }

       fci.size = sizeof(fci);
       fci.function_table = NULL;
       fci.function_name = NULL;
       fci.symbol_table = NULL;
       fci.object_ptr = NULL;
       fci.retval_ptr_ptr = &retval_ptr;
       fci.param_count = num_args;
       fci.params = params;
       fci.no_separation = 1;

       fcc.initialized = 1;
       fcc.function_handler = fptr;
       fcc.calling_scope = EG(scope);
       fcc.called_scope = NULL;
       fcc.object_ptr = NULL;

       result = zend_call_function(&fci, &fcc TSRMLS_CC);

       if (num_args) {
              efree(params);
       }

       if (result == FAILURE) {
              zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                     "Invocation of function %s() failed", fptr->common.function_name);
              return;
       }

       if (retval_ptr) {
              COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_function  ,
invokeArgs   
)

Definition at line 1803 of file php_reflection.c.

{
       zval *retval_ptr;
       zval ***params;
       int result;
       int argc;
       zend_fcall_info fci;
       zend_fcall_info_cache fcc;
       reflection_object *intern;
       zend_function *fptr;
       zval *param_array;
       
       METHOD_NOTSTATIC(reflection_function_ptr);
       GET_REFLECTION_OBJECT_PTR(fptr);

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &param_array) == FAILURE) {
              return;
       }

       argc = zend_hash_num_elements(Z_ARRVAL_P(param_array));
       
       params = safe_emalloc(sizeof(zval **), argc, 0);
       zend_hash_apply_with_argument(Z_ARRVAL_P(param_array), (apply_func_arg_t)_zval_array_to_c_array, &params TSRMLS_CC);   
       params -= argc;

       fci.size = sizeof(fci);
       fci.function_table = NULL;
       fci.function_name = NULL;
       fci.symbol_table = NULL;
       fci.object_ptr = NULL;
       fci.retval_ptr_ptr = &retval_ptr;
       fci.param_count = argc;
       fci.params = params;
       fci.no_separation = 1;

       fcc.initialized = 1;
       fcc.function_handler = fptr;
       fcc.calling_scope = EG(scope);
       fcc.called_scope = NULL;
       fcc.object_ptr = NULL;

       result = zend_call_function(&fci, &fcc TSRMLS_CC);

       efree(params);

       if (result == FAILURE) {
              zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                     "Invocation of function %s() failed", fptr->common.function_name);
              return;
       }

       if (retval_ptr) {
              COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_function  ,
returnsReference   
)
ZEND_METHOD ( reflection_function  ,
getNumberOfParameters   
)
ZEND_METHOD ( reflection_function  ,
getNumberOfRequiredParameters   
)
ZEND_METHOD ( reflection_function  ,
getParameters   
)

Definition at line 1904 of file php_reflection.c.

{
       reflection_object *intern;
       zend_function *fptr;
       zend_uint i;
       struct _zend_arg_info *arg_info;

       METHOD_NOTSTATIC(reflection_function_abstract_ptr);
       GET_REFLECTION_OBJECT_PTR(fptr);

       arg_info= fptr->common.arg_info;

       array_init(return_value);
       for (i = 0; i < fptr->common.num_args; i++) {
              zval *parameter;   

              ALLOC_ZVAL(parameter);
              reflection_parameter_factory(_copy_function(fptr TSRMLS_CC), intern->obj, arg_info, i, fptr->common.required_num_args, parameter TSRMLS_CC);
              add_next_index_zval(return_value, parameter);

              arg_info++;
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_function  ,
getExtension   
)

Definition at line 1931 of file php_reflection.c.

{
       reflection_object *intern;
       zend_function *fptr;
       zend_internal_function *internal;

       METHOD_NOTSTATIC(reflection_function_abstract_ptr);
       GET_REFLECTION_OBJECT_PTR(fptr);

       if (fptr->type != ZEND_INTERNAL_FUNCTION) {
              RETURN_NULL();
       }

       internal = (zend_internal_function *)fptr;
       if (internal->module) {
              reflection_extension_factory(return_value, internal->module->name TSRMLS_CC);
       } else {
              RETURN_NULL();
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_function  ,
getExtensionName   
)

Definition at line 1955 of file php_reflection.c.

{
       reflection_object *intern;
       zend_function *fptr;
       zend_internal_function *internal;

       METHOD_NOTSTATIC(reflection_function_abstract_ptr);
       GET_REFLECTION_OBJECT_PTR(fptr);

       if (fptr->type != ZEND_INTERNAL_FUNCTION) {
              RETURN_FALSE;
       }

       internal = (zend_internal_function *)fptr;
       if (internal->module) {
              RETURN_STRING(internal->module->name, 1);
       } else {
              RETURN_FALSE;
       }
}
ZEND_METHOD ( reflection_parameter  ,
export   
)

Definition at line 1979 of file php_reflection.c.

Here is the call graph for this function:

ZEND_METHOD ( reflection_parameter  ,
__construct   
)

Definition at line 1987 of file php_reflection.c.

{
       parameter_reference *ref;
       zval *reference, **parameter;
       zval *object;
       zval *name;
       reflection_object *intern;
       zend_function *fptr;
       struct _zend_arg_info *arg_info;
       int position;
       zend_class_entry *ce = NULL;
       zend_bool is_closure = 0;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zZ", &reference, &parameter) == FAILURE) {
              return;
       }

       object = getThis();
       intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
       if (intern == NULL) {
              return;
       }
       
       /* First, find the function */
       switch (Z_TYPE_P(reference)) {
              case IS_STRING: {
                            unsigned int lcname_len;
                            char *lcname;

                            lcname_len = Z_STRLEN_P(reference);
                            lcname = zend_str_tolower_dup(Z_STRVAL_P(reference), lcname_len);
                            if (zend_hash_find(EG(function_table), lcname, lcname_len + 1, (void**) &fptr) == FAILURE) {
                                   efree(lcname);
                                   zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                                          "Function %s() does not exist", Z_STRVAL_P(reference));
                                   return;
                            }
                            efree(lcname);
                     }
                     ce = fptr->common.scope;
                     break;

              case IS_ARRAY: {
                            zval **classref;
                            zval **method;
                            zend_class_entry **pce;
                            unsigned int lcname_len;
                            char *lcname;
                            
                            if ((zend_hash_index_find(Z_ARRVAL_P(reference), 0, (void **) &classref) == FAILURE)
                                   || (zend_hash_index_find(Z_ARRVAL_P(reference), 1, (void **) &method) == FAILURE))
                            {
                                   _DO_THROW("Expected array($object, $method) or array($classname, $method)");
                                   /* returns out of this function */
                            }

                            if (Z_TYPE_PP(classref) == IS_OBJECT) {
                                   ce = Z_OBJCE_PP(classref);
                            } else {
                                   convert_to_string_ex(classref);
                                   if (zend_lookup_class(Z_STRVAL_PP(classref), Z_STRLEN_PP(classref), &pce TSRMLS_CC) == FAILURE) {
                                          zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
                                                        "Class %s does not exist", Z_STRVAL_PP(classref));
                                          return;
                                   }
                                   ce = *pce;
                            }
                            
                            convert_to_string_ex(method);
                            lcname_len = Z_STRLEN_PP(method);
                            lcname = zend_str_tolower_dup(Z_STRVAL_PP(method), lcname_len);
                            if (ce == zend_ce_closure && Z_TYPE_PP(classref) == IS_OBJECT
                                   && (lcname_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
                                   && memcmp(lcname, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
                                   && (fptr = zend_get_closure_invoke_method(*classref TSRMLS_CC)) != NULL)
                            {
                                   /* nothign to do. don't set is_closure since is the invoke handler,
                                      not the closure itself */
                            } else if (zend_hash_find(&ce->function_table, lcname, lcname_len + 1, (void **) &fptr) == FAILURE) {
                                   efree(lcname);
                                   zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                                          "Method %s::%s() does not exist", ce->name, Z_STRVAL_PP(method));
                                   return;
                            }
                            efree(lcname);
                     }
                     break;
              
              case IS_OBJECT: {
                            ce = Z_OBJCE_P(reference);
                            
                            if (instanceof_function(ce, zend_ce_closure TSRMLS_CC)) {
                                   fptr = (zend_function *)zend_get_closure_method_def(reference TSRMLS_CC);
                                   Z_ADDREF_P(reference);
                                   is_closure = 1;
                            } else if (zend_hash_find(&ce->function_table, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME), (void **)&fptr) == FAILURE) {
                                   zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
                                          "Method %s::%s() does not exist", ce->name, ZEND_INVOKE_FUNC_NAME);
                                   return;
                            }
                     }
                     break;
                     
              default:
                     _DO_THROW("The parameter class is expected to be either a string, an array(class, method) or a callable object");
                     /* returns out of this function */
       }
       
       /* Now, search for the parameter */
       arg_info = fptr->common.arg_info;
       if (Z_TYPE_PP(parameter) == IS_LONG) {
              position= Z_LVAL_PP(parameter);
              if (position < 0 || (zend_uint)position >= fptr->common.num_args) {
                     if (fptr->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) {
                            if (fptr->type != ZEND_OVERLOADED_FUNCTION) {
                                   efree(fptr->common.function_name);
                            }
                            efree(fptr);
                     }
                     if (is_closure) {
                            zval_ptr_dtor(&reference);
                     }
                     _DO_THROW("The parameter specified by its offset could not be found");
                     /* returns out of this function */
              }
       } else {
              zend_uint i;

              position= -1;
              convert_to_string_ex(parameter);
              for (i = 0; i < fptr->common.num_args; i++) {
                     if (arg_info[i].name && strcmp(arg_info[i].name, Z_STRVAL_PP(parameter)) == 0) {
                            position= i;
                            break;
                     }
              }
              if (position == -1) {
                     if (fptr->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) {
                            if (fptr->type != ZEND_OVERLOADED_FUNCTION) {
                                   efree(fptr->common.function_name);
                            }
                            efree(fptr);
                     }
                     if (is_closure) {
                            zval_ptr_dtor(&reference);
                     }
                     _DO_THROW("The parameter specified by its name could not be found");
                     /* returns out of this function */
              }
       }
       
       MAKE_STD_ZVAL(name);
       if (arg_info[position].name) {
              ZVAL_STRINGL(name, arg_info[position].name, arg_info[position].name_len, 1);
       } else {
              ZVAL_NULL(name);
       }
       zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL);

       ref = (parameter_reference*) emalloc(sizeof(parameter_reference));
       ref->arg_info = &arg_info[position];
       ref->offset = (zend_uint)position;
       ref->required = fptr->common.required_num_args;
       ref->fptr = fptr;
       /* TODO: copy fptr */
       intern->ptr = ref;
       intern->ref_type = REF_TYPE_PARAMETER;
       intern->ce = ce;
       if (reference && is_closure) {
              intern->obj = reference;
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_parameter  ,
__toString   
)

Definition at line 2163 of file php_reflection.c.

{
       reflection_object *intern;
       parameter_reference *param;
       string str;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(param);
       string_init(&str);
       _parameter_string(&str, param->fptr, param->arg_info, param->offset, param->required, "" TSRMLS_CC);
       RETURN_STRINGL(str.string, str.len - 1, 0);
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_parameter  ,
getName   
)

Definition at line 2181 of file php_reflection.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       _default_get_entry(getThis(), "name", sizeof("name"), return_value TSRMLS_CC);
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_parameter  ,
getDeclaringFunction   
)

Definition at line 2192 of file php_reflection.c.

{
       reflection_object *intern;
       parameter_reference *param;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(param);

       if (!param->fptr->common.scope) {
              reflection_function_factory(_copy_function(param->fptr TSRMLS_CC), intern->obj, return_value TSRMLS_CC);
       } else {
              reflection_method_factory(param->fptr->common.scope, _copy_function(param->fptr TSRMLS_CC), intern->obj, return_value TSRMLS_CC);
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_parameter  ,
getDeclaringClass   
)

Definition at line 2212 of file php_reflection.c.

{
       reflection_object *intern;
       parameter_reference *param;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(param);

       if (param->fptr->common.scope) {
              zend_reflection_class_factory(param->fptr->common.scope, return_value TSRMLS_CC);
       }      
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_parameter  ,
getClass   
)

Definition at line 2230 of file php_reflection.c.

{
       reflection_object *intern;
       parameter_reference *param;
       zend_class_entry **pce, *ce;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(param);

       if (param->arg_info->class_name) {
              /* Class name is stored as a string, we might also get "self" or "parent"
               * - For "self", simply use the function scope. If scope is NULL then
               *   the function is global and thus self does not make any sense
               *
               * - For "parent", use the function scope's parent. If scope is NULL then
               *   the function is global and thus parent does not make any sense.
               *   If the parent is NULL then the class does not extend anything and
               *   thus parent does not make any sense, either.
               *
               * TODO: Think about moving these checks to the compiler or some sort of
               * lint-mode.
               */
              if (0 == strncmp(param->arg_info->class_name, "self", sizeof("self")- 1)) {
                     ce = param->fptr->common.scope;
                     if (!ce) {
                            zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                                   "Parameter uses 'self' as type hint but function is not a class member!");
                            return;
                     }
                     pce= &ce;
              } else if (0 == strncmp(param->arg_info->class_name, "parent", sizeof("parent")- 1)) {
                     ce = param->fptr->common.scope;
                     if (!ce) {
                            zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                                   "Parameter uses 'parent' as type hint but function is not a class member!");
                            return;
                     }
                     if (!ce->parent) {
                            zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                                   "Parameter uses 'parent' as type hint although class does not have a parent!");
                            return;
                     }
                     pce= &ce->parent;
              } else if (zend_lookup_class(param->arg_info->class_name, param->arg_info->class_name_len, &pce TSRMLS_CC) == FAILURE) {
                     zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                            "Class %s does not exist", param->arg_info->class_name);
                     return;
              }
              zend_reflection_class_factory(*pce, return_value TSRMLS_CC);
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_parameter  ,
isArray   
)

Definition at line 2287 of file php_reflection.c.

ZEND_METHOD ( reflection_parameter  ,
allowsNull   
)

Definition at line 2303 of file php_reflection.c.

ZEND_METHOD ( reflection_parameter  ,
isPassedByReference   
)

Definition at line 2319 of file php_reflection.c.

ZEND_METHOD ( reflection_parameter  ,
getPosition   
)

Definition at line 2335 of file php_reflection.c.

ZEND_METHOD ( reflection_parameter  ,
isOptional   
)

Definition at line 2351 of file php_reflection.c.

ZEND_METHOD ( reflection_parameter  ,
isDefaultValueAvailable   
)

Definition at line 2367 of file php_reflection.c.

{
       reflection_object *intern;
       parameter_reference *param;
       zend_op *precv;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(param);

       if (param->fptr->type != ZEND_USER_FUNCTION)
       {
              RETURN_FALSE;
       }
       if (param->offset < param->required) {
              RETURN_FALSE;
       }
       precv = _get_recv_op((zend_op_array*)param->fptr, param->offset);
       if (!precv || precv->opcode != ZEND_RECV_INIT || precv->op2.op_type == IS_UNUSED) {
              RETURN_FALSE;
       }
       RETURN_TRUE;
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_parameter  ,
getDefaultValue   
)

Definition at line 2395 of file php_reflection.c.

{
       reflection_object *intern;
       parameter_reference *param;
       zend_op *precv;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(param);

       if (param->fptr->type != ZEND_USER_FUNCTION)
       {
              zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Cannot determine default value for internal functions");
              return;
       }
       if (param->offset < param->required) {
              zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Parameter is not optional"); 
              return;
       }
       precv = _get_recv_op((zend_op_array*)param->fptr, param->offset);
       if (!precv || precv->opcode != ZEND_RECV_INIT || precv->op2.op_type == IS_UNUSED) {
              zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Internal error"); 
              return;
       }

       *return_value = precv->op2.u.constant;
       INIT_PZVAL(return_value);
       if (Z_TYPE_P(return_value) != IS_CONSTANT && Z_TYPE_P(return_value) != IS_CONSTANT_ARRAY) {
              zval_copy_ctor(return_value);
       }
       zval_update_constant_ex(&return_value, (void*)0, param->fptr->common.scope TSRMLS_CC);
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_method  ,
export   
)

Definition at line 2432 of file php_reflection.c.

Here is the call graph for this function:

ZEND_METHOD ( reflection_method  ,
__construct   
)

Definition at line 2440 of file php_reflection.c.

{
       zval *name, *classname;
       zval *object, *orig_obj;
       reflection_object *intern;
       char *lcname;
       zend_class_entry **pce;
       zend_class_entry *ce;
       zend_function *mptr;
       char *name_str, *tmp;
       int name_len, tmp_len;
       zval ztmp;

       if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "zs", &classname, &name_str, &name_len) == FAILURE) {
              if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len) == FAILURE) {
                     return;
              }
              if ((tmp = strstr(name_str, "::")) == NULL) {
                     zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Invalid method name %s", name_str); 
                     return;
              }
              classname = &ztmp;
              tmp_len = tmp - name_str;
              ZVAL_STRINGL(classname, name_str, tmp_len, 1);
              name_len = name_len - (tmp_len + 2);
              name_str = tmp + 2;
              orig_obj = NULL;
       } else if (Z_TYPE_P(classname) == IS_OBJECT) {
              orig_obj = classname;
       } else {
              orig_obj = NULL;
       }

       object = getThis();
       intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
       if (intern == NULL) {
              return;
       }
       
       /* Find the class entry */
       switch (Z_TYPE_P(classname)) {
              case IS_STRING:
                     if (zend_lookup_class(Z_STRVAL_P(classname), Z_STRLEN_P(classname), &pce TSRMLS_CC) == FAILURE) {
                            zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
                                          "Class %s does not exist", Z_STRVAL_P(classname)); 
                            if (classname == &ztmp) {
                                   zval_dtor(&ztmp);
                            }
                            return;
                     }
                     ce = *pce;
                     break;

              case IS_OBJECT:
                     ce = Z_OBJCE_P(classname);
                     break;

              default:
                     if (classname == &ztmp) {
                            zval_dtor(&ztmp);
                     }
                     _DO_THROW("The parameter class is expected to be either a string or an object");
                     /* returns out of this function */
       }

       if (classname == &ztmp) {
              zval_dtor(&ztmp);
       }

       lcname = zend_str_tolower_dup(name_str, name_len);

       if (ce == zend_ce_closure && orig_obj && (name_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
              && memcmp(lcname, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
              && (mptr = zend_get_closure_invoke_method(orig_obj TSRMLS_CC)) != NULL)
       {
              /* do nothing, mptr already set */
       } else if (zend_hash_find(&ce->function_table, lcname, name_len + 1, (void **) &mptr) == FAILURE) {
              efree(lcname);
              zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                     "Method %s::%s() does not exist", ce->name, name_str);
              return;
       }
       efree(lcname);

       MAKE_STD_ZVAL(classname);
       ZVAL_STRINGL(classname, mptr->common.scope->name, mptr->common.scope->name_length, 1);

       zend_hash_update(Z_OBJPROP_P(object), "class", sizeof("class"), (void **) &classname, sizeof(zval *), NULL);
       
       MAKE_STD_ZVAL(name);
       ZVAL_STRING(name, mptr->common.function_name, 1);
       zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL);
       intern->ptr = mptr;
       intern->ref_type = REF_TYPE_FUNCTION;
       intern->ce = ce;
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_method  ,
__toString   
)

Definition at line 2540 of file php_reflection.c.

{
       reflection_object *intern;
       zend_function *mptr;
       string str;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(mptr);
       string_init(&str);
       _function_string(&str, mptr, intern->ce, "" TSRMLS_CC);
       RETURN_STRINGL(str.string, str.len - 1, 0);
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_method  ,
invoke   
)

Definition at line 2558 of file php_reflection.c.

{
       zval *retval_ptr;
       zval ***params = NULL;
       zval *object_ptr;
       reflection_object *intern;
       zend_function *mptr;
       int result, num_args = 0;
       zend_fcall_info fci;
       zend_fcall_info_cache fcc;
       zend_class_entry *obj_ce;
       
       METHOD_NOTSTATIC(reflection_method_ptr);

       GET_REFLECTION_OBJECT_PTR(mptr);

       if ((!(mptr->common.fn_flags & ZEND_ACC_PUBLIC)
               || (mptr->common.fn_flags & ZEND_ACC_ABSTRACT))
               && intern->ignore_visibility == 0)
       {
              if (mptr->common.fn_flags & ZEND_ACC_ABSTRACT) {
                     zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                            "Trying to invoke abstract method %s::%s()", 
                            mptr->common.scope->name, mptr->common.function_name);
              } else {
                     zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
                            "Trying to invoke %s method %s::%s() from scope %s", 
                            mptr->common.fn_flags & ZEND_ACC_PROTECTED ? "protected" : "private",
                            mptr->common.scope->name, mptr->common.function_name,
                            Z_OBJCE_P(getThis())->name);
              }
              return;
       }

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &params, &num_args) == FAILURE) {
              return;
       }
       
       /* In case this is a static method, we should'nt pass an object_ptr
        * (which is used as calling context aka $this). We can thus ignore the
        * first parameter.
        *
        * Else, we verify that the given object is an instance of the class.
        */
       if (mptr->common.fn_flags & ZEND_ACC_STATIC) {
              object_ptr = NULL;
              obj_ce = mptr->common.scope;
       } else {
              if (Z_TYPE_PP(params[0]) != IS_OBJECT) {
                     efree(params);
                     _DO_THROW("Non-object passed to Invoke()");
                     /* Returns from this function */
              }

              obj_ce = Z_OBJCE_PP(params[0]);

              if (!instanceof_function(obj_ce, mptr->common.scope TSRMLS_CC)) {
                     if (params) {
                            efree(params);
                     }
                     _DO_THROW("Given object is not an instance of the class this method was declared in");
                     /* Returns from this function */
              }
       
              object_ptr = *params[0];
       }
       
       fci.size = sizeof(fci);
       fci.function_table = NULL;
       fci.function_name = NULL;
       fci.symbol_table = NULL;
       fci.object_ptr = object_ptr;
       fci.retval_ptr_ptr = &retval_ptr;
       fci.param_count = num_args - 1;
       fci.params = params + 1;
       fci.no_separation = 1;

       fcc.initialized = 1;
       fcc.function_handler = mptr;
       fcc.calling_scope = obj_ce;
       fcc.called_scope = intern->ce;
       fcc.object_ptr = object_ptr;

       result = zend_call_function(&fci, &fcc TSRMLS_CC);
       
       if (params) {
              efree(params);
       }

       if (result == FAILURE) {
              zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                     "Invocation of method %s::%s() failed", mptr->common.scope->name, mptr->common.function_name);
              return;
       }

       if (retval_ptr) {
              COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_method  ,
invokeArgs   
)

Definition at line 2661 of file php_reflection.c.

{
       zval *retval_ptr;
       zval ***params;
       zval *object;
       reflection_object *intern;
       zend_function *mptr;
       int argc;
       int result;
       zend_fcall_info fci;
       zend_fcall_info_cache fcc;
       zend_class_entry *obj_ce;
       zval *param_array;
       
       METHOD_NOTSTATIC(reflection_method_ptr);

       GET_REFLECTION_OBJECT_PTR(mptr);

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o!a", &object, &param_array) == FAILURE) {
              return;
       }

       if ((!(mptr->common.fn_flags & ZEND_ACC_PUBLIC)
               || (mptr->common.fn_flags & ZEND_ACC_ABSTRACT))
               && intern->ignore_visibility == 0)
       {
              if (mptr->common.fn_flags & ZEND_ACC_ABSTRACT) {
                     zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                            "Trying to invoke abstract method %s::%s()", 
                            mptr->common.scope->name, mptr->common.function_name);
              } else {
                     zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
                            "Trying to invoke %s method %s::%s() from scope %s", 
                            mptr->common.fn_flags & ZEND_ACC_PROTECTED ? "protected" : "private",
                            mptr->common.scope->name, mptr->common.function_name,
                            Z_OBJCE_P(getThis())->name);
              }
              return;
       }

       argc = zend_hash_num_elements(Z_ARRVAL_P(param_array));
       
       params = safe_emalloc(sizeof(zval **), argc, 0);
       zend_hash_apply_with_argument(Z_ARRVAL_P(param_array), (apply_func_arg_t)_zval_array_to_c_array, &params TSRMLS_CC);   
       params -= argc;
       
       /* In case this is a static method, we should'nt pass an object_ptr
        * (which is used as calling context aka $this). We can thus ignore the
        * first parameter.
        *
        * Else, we verify that the given object is an instance of the class.
        */
       if (mptr->common.fn_flags & ZEND_ACC_STATIC) {
              object = NULL;
              obj_ce = mptr->common.scope;
       } else {
              if (!object) {
                     efree(params);
                     zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
                            "Trying to invoke non static method %s::%s() without an object", 
                            mptr->common.scope->name, mptr->common.function_name);
                     return;
              }
              
              obj_ce = Z_OBJCE_P(object);

              if (!instanceof_function(obj_ce, mptr->common.scope TSRMLS_CC)) {
                     efree(params);
                     _DO_THROW("Given object is not an instance of the class this method was declared in");
                     /* Returns from this function */
              }
       }
       
       fci.size = sizeof(fci);
       fci.function_table = NULL;
       fci.function_name = NULL;
       fci.symbol_table = NULL;
       fci.object_ptr = object;
       fci.retval_ptr_ptr = &retval_ptr;
       fci.param_count = argc;
       fci.params = params;
       fci.no_separation = 1;

       fcc.initialized = 1;
       fcc.function_handler = mptr;
       fcc.calling_scope = obj_ce;
       fcc.called_scope = obj_ce;
       fcc.object_ptr = object;

       result = zend_call_function(&fci, &fcc TSRMLS_CC);
       
       efree(params);

       if (result == FAILURE) {
              zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                     "Invocation of method %s::%s() failed", mptr->common.scope->name, mptr->common.function_name);
              return;
       }

       if (retval_ptr) {
              COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_method  ,
isFinal   
)

Definition at line 2768 of file php_reflection.c.

Here is the call graph for this function:

ZEND_METHOD ( reflection_method  ,
isAbstract   
)

Definition at line 2776 of file php_reflection.c.

Here is the call graph for this function:

ZEND_METHOD ( reflection_method  ,
isPublic   
)

Definition at line 2784 of file php_reflection.c.

Here is the call graph for this function:

ZEND_METHOD ( reflection_method  ,
isPrivate   
)

Definition at line 2792 of file php_reflection.c.

Here is the call graph for this function:

ZEND_METHOD ( reflection_method  ,
isProtected   
)

Definition at line 2800 of file php_reflection.c.

Here is the call graph for this function:

ZEND_METHOD ( reflection_method  ,
isStatic   
)

Definition at line 2808 of file php_reflection.c.

Here is the call graph for this function:

ZEND_METHOD ( reflection_function  ,
isDeprecated   
)

Definition at line 2816 of file php_reflection.c.

Here is the call graph for this function:

ZEND_METHOD ( reflection_function  ,
inNamespace   
)

Definition at line 2824 of file php_reflection.c.

{
       zval **name;
       char *colon;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       if (zend_hash_find(Z_OBJPROP_P(getThis()), "name", sizeof("name"), (void **) &name) == FAILURE) {
              RETURN_FALSE;
       }
       if (Z_TYPE_PP(name) == IS_STRING
              && (colon = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name)))
              && colon > Z_STRVAL_PP(name))
       {
              RETURN_TRUE;
       }
       RETURN_FALSE;
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_function  ,
getNamespaceName   
)

Definition at line 2847 of file php_reflection.c.

{
       zval **name;
       char *backslash;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       if (zend_hash_find(Z_OBJPROP_P(getThis()), "name", sizeof("name"), (void **) &name) == FAILURE) {
              RETURN_FALSE;
       }
       if (Z_TYPE_PP(name) == IS_STRING
              && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name)))
              && backslash > Z_STRVAL_PP(name))
       {
              RETURN_STRINGL(Z_STRVAL_PP(name), backslash - Z_STRVAL_PP(name), 1);
       }
       RETURN_EMPTY_STRING();
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_function  ,
getShortName   
)

Definition at line 2870 of file php_reflection.c.

{
       zval **name;
       char *backslash;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       if (zend_hash_find(Z_OBJPROP_P(getThis()), "name", sizeof("name"), (void **) &name) == FAILURE) {
              RETURN_FALSE;
       }
       if (Z_TYPE_PP(name) == IS_STRING
              && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name)))
              && backslash > Z_STRVAL_PP(name))
       {
              RETURN_STRINGL(backslash + 1, Z_STRLEN_PP(name) - (backslash - Z_STRVAL_PP(name) + 1), 1);
       }
       RETURN_ZVAL(*name, 1, 0);
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_method  ,
isConstructor   
)

Definition at line 2893 of file php_reflection.c.

{
       reflection_object *intern;
       zend_function *mptr;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(mptr);
       /* we need to check if the ctor is the ctor of the class level we we 
        * looking at since we might be looking at an inherited old style ctor
        * defined in base class. */
       RETURN_BOOL(mptr->common.fn_flags & ZEND_ACC_CTOR && intern->ce->constructor && intern->ce->constructor->common.scope == mptr->common.scope);
}
ZEND_METHOD ( reflection_method  ,
isDestructor   
)

Definition at line 2911 of file php_reflection.c.

ZEND_METHOD ( reflection_method  ,
getModifiers   
)

Definition at line 2926 of file php_reflection.c.

{
       reflection_object *intern;
       zend_function *mptr;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(mptr);

       RETURN_LONG(mptr->common.fn_flags);
}
ZEND_METHOD ( reflection_method  ,
getDeclaringClass   
)

Definition at line 2942 of file php_reflection.c.

Here is the call graph for this function:

ZEND_METHOD ( reflection_method  ,
getPrototype   
)

Definition at line 2960 of file php_reflection.c.

{
       reflection_object *intern;
       zend_function *mptr;

       METHOD_NOTSTATIC(reflection_method_ptr);
       GET_REFLECTION_OBJECT_PTR(mptr);
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       
       if (!mptr->common.prototype) {
              zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                     "Method %s::%s does not have a prototype", intern->ce->name, mptr->common.function_name);
              return;
       }

       reflection_method_factory(mptr->common.prototype->common.scope, mptr->common.prototype, NULL, return_value TSRMLS_CC);
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_method  ,
setAccessible   
)

Definition at line 2984 of file php_reflection.c.

{
       reflection_object *intern;
       zend_bool visible;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &visible) == FAILURE) {
              return;
       }

       intern = (reflection_object *) zend_object_store_get_object(getThis() TSRMLS_CC);

       if (intern == NULL) {
              return;
       }

       intern->ignore_visibility = visible;
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
export   
)

Definition at line 3005 of file php_reflection.c.

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
__construct   
)

Definition at line 3066 of file php_reflection.c.

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
getStaticProperties   
)

Definition at line 3074 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;
       HashPosition pos;
       zval **value;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       
       GET_REFLECTION_OBJECT_PTR(ce);

       zend_update_class_constants(ce TSRMLS_CC);

       array_init(return_value);

       zend_hash_internal_pointer_reset_ex(CE_STATIC_MEMBERS(ce), &pos);

       while (zend_hash_get_current_data_ex(CE_STATIC_MEMBERS(ce), (void **) &value, &pos) == SUCCESS) {
              uint key_len;
              char *key;
              ulong num_index;

              if (zend_hash_get_current_key_ex(CE_STATIC_MEMBERS(ce), &key, &key_len, &num_index, 0, &pos) != FAILURE && key) {
                     char *prop_name, *class_name;
                     zval *prop_copy;

                     zend_unmangle_property_name(key, key_len-1, &class_name, &prop_name);

                     /* filter privates from base classes */
                     if (!(class_name && class_name[0] != '*' && strcmp(class_name, ce->name))) {
                            /* copy: enforce read only access */
                            ALLOC_ZVAL(prop_copy);
                            MAKE_COPY_ZVAL(value, prop_copy);

                            add_assoc_zval(return_value, prop_name, prop_copy);
                     }
              }
              zend_hash_move_forward_ex(CE_STATIC_MEMBERS(ce), &pos);
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
getStaticPropertyValue   
)

Definition at line 3120 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;
       char *name;
       int name_len;
       zval **prop, *def_value = NULL;
       
       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &name, &name_len, &def_value) == FAILURE) {
              return;
       }

       GET_REFLECTION_OBJECT_PTR(ce);

       zend_update_class_constants(ce TSRMLS_CC);
       prop = zend_std_get_static_property(ce, name, name_len, 1 TSRMLS_CC);
       if (!prop) {
              if (def_value) {
                     RETURN_ZVAL(def_value, 1, 0);
              } else {
                     zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                            "Class %s does not have a property named %s", ce->name, name);
              }
              return;
       } else {
              RETURN_ZVAL(*prop, 1, 0);
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
setStaticPropertyValue   
)

Definition at line 3152 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;
       char *name;
       int name_len;
       zval **variable_ptr, *value;
       int refcount;
       zend_uchar is_ref;
       
       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &name, &name_len, &value) == FAILURE) {
              return;
       }

       GET_REFLECTION_OBJECT_PTR(ce);

       zend_update_class_constants(ce TSRMLS_CC);
       variable_ptr = zend_std_get_static_property(ce, name, name_len, 1 TSRMLS_CC);
       if (!variable_ptr) {
              zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                            "Class %s does not have a property named %s", ce->name, name);
              return;
       }      
       refcount = Z_REFCOUNT_PP(variable_ptr);
       is_ref = Z_ISREF_PP(variable_ptr);
       zval_dtor(*variable_ptr);
       **variable_ptr = *value;
       zval_copy_ctor(*variable_ptr);
       Z_SET_REFCOUNT_PP(variable_ptr, refcount);
       Z_SET_ISREF_TO_PP(variable_ptr, is_ref);

}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
getDefaultProperties   
)

Definition at line 3188 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;
       int count, i;
       HashTable *ht_list[3];
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(ce);
       array_init(return_value);

       zend_update_class_constants(ce TSRMLS_CC);

       ht_list[0] = CE_STATIC_MEMBERS(ce);
       ht_list[1] = &ce->default_properties;
       ht_list[2] = NULL;

       for (i = 0; ht_list[i] != NULL; i++) {

              count = zend_hash_num_elements(ht_list[i]);
              if (count > 0) {
                     HashPosition pos;
                     zval **prop;

                     zend_hash_internal_pointer_reset_ex(ht_list[i], &pos);
                     while (zend_hash_get_current_data_ex(ht_list[i], (void **) &prop, &pos) == SUCCESS) {
                            char *key, *class_name, *prop_name;
                            uint key_len;
                            ulong num_index;
                            zval *prop_copy;

                            zend_hash_get_current_key_ex(ht_list[i], &key, &key_len, &num_index, 0, &pos);
                            zend_hash_move_forward_ex(ht_list[i], &pos);
                            zend_unmangle_property_name(key, key_len-1, &class_name, &prop_name);
                            if (class_name && class_name[0] != '*' && strcmp(class_name, ce->name)) {
                                   /* filter privates from base classes */
                                   continue;
                            }

                            /* copy: enforce read only access */
                            ALLOC_ZVAL(prop_copy);
                            MAKE_COPY_ZVAL(prop, prop_copy);

                            add_assoc_zval(return_value, prop_name, prop_copy);
                     }
              }
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
__toString   
)

Definition at line 3242 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;
       string str;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(ce);
       string_init(&str);
       _class_string(&str, ce, intern->obj, "" TSRMLS_CC);
       RETURN_STRINGL(str.string, str.len - 1, 0);
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
getName   
)

Definition at line 3260 of file php_reflection.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       _default_get_entry(getThis(), "name", sizeof("name"), return_value TSRMLS_CC);
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
isInternal   
)

Definition at line 3271 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(ce);
       RETURN_BOOL(ce->type == ZEND_INTERNAL_CLASS);
}
ZEND_METHOD ( reflection_class  ,
isUserDefined   
)

Definition at line 3286 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(ce);
       RETURN_BOOL(ce->type == ZEND_USER_CLASS);
}
ZEND_METHOD ( reflection_class  ,
getFileName   
)

Definition at line 3301 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(ce);
       if (ce->type == ZEND_USER_CLASS) {
              RETURN_STRING(ce->filename, 1);
       }
       RETURN_FALSE;
}
ZEND_METHOD ( reflection_class  ,
getStartLine   
)

Definition at line 3319 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(ce);
       if (ce->type == ZEND_USER_FUNCTION) {
              RETURN_LONG(ce->line_start);
       }
       RETURN_FALSE;
}
ZEND_METHOD ( reflection_class  ,
getEndLine   
)

Definition at line 3337 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(ce);
       if (ce->type == ZEND_USER_CLASS) {
              RETURN_LONG(ce->line_end);
       }
       RETURN_FALSE;
}
ZEND_METHOD ( reflection_class  ,
getDocComment   
)

Definition at line 3355 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(ce);
       if (ce->type == ZEND_USER_CLASS && ce->doc_comment) {
              RETURN_STRINGL(ce->doc_comment, ce->doc_comment_len, 1);
       }
       RETURN_FALSE;
}
ZEND_METHOD ( reflection_class  ,
getConstructor   
)

Definition at line 3373 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(ce);

       if (ce->constructor) {
              reflection_method_factory(ce, ce->constructor, NULL, return_value TSRMLS_CC);
       } else {
              RETURN_NULL();
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
hasMethod   
)

Definition at line 3393 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;
       char *name, *lc_name; 
       int name_len;

       METHOD_NOTSTATIC(reflection_class_ptr);
       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
              return;
       }

       GET_REFLECTION_OBJECT_PTR(ce);
       lc_name = zend_str_tolower_dup(name, name_len);
       if ((ce == zend_ce_closure && (name_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
              && memcmp(lc_name, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0)
              || zend_hash_exists(&ce->function_table, lc_name, name_len + 1)) {
              efree(lc_name);
              RETURN_TRUE;
       } else {
              efree(lc_name);
              RETURN_FALSE;
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
getMethod   
)

Definition at line 3421 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;
       zend_function *mptr;
       zval obj_tmp;
       char *name, *lc_name; 
       int name_len;

       METHOD_NOTSTATIC(reflection_class_ptr);
       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
              return;
       }

       GET_REFLECTION_OBJECT_PTR(ce);
       lc_name = zend_str_tolower_dup(name, name_len);
       if (ce == zend_ce_closure && intern->obj && (name_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
              && memcmp(lc_name, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
              && (mptr = zend_get_closure_invoke_method(intern->obj TSRMLS_CC)) != NULL)
       {
              /* don't assign closure_object since we only reflect the invoke handler
                 method and not the closure definition itself */
              reflection_method_factory(ce, mptr, NULL, return_value TSRMLS_CC);
              efree(lc_name);
       } else if (ce == zend_ce_closure && !intern->obj && (name_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1)
              && memcmp(lc_name, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0
              && object_init_ex(&obj_tmp, ce) == SUCCESS && (mptr = zend_get_closure_invoke_method(&obj_tmp TSRMLS_CC)) != NULL) {
              /* don't assign closure_object since we only reflect the invoke handler
                 method and not the closure definition itself */
              reflection_method_factory(ce, mptr, NULL, return_value TSRMLS_CC);
              zval_dtor(&obj_tmp);
              efree(lc_name);
       } else if (zend_hash_find(&ce->function_table, lc_name, name_len + 1, (void**) &mptr) == SUCCESS) {
              reflection_method_factory(ce, mptr, NULL, return_value TSRMLS_CC);
              efree(lc_name);
       } else {
              efree(lc_name);
              zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                            "Method %s does not exist", name);
              return;
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
getMethods   
)

Definition at line 3504 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;
       long filter = 0;
       int argc = ZEND_NUM_ARGS();

       METHOD_NOTSTATIC(reflection_class_ptr);
       if (argc) {
              if (zend_parse_parameters(argc TSRMLS_CC, "|l", &filter) == FAILURE) {
                     return;
              }
       } else {
              /* No parameters given, default to "return all" */
              filter = ZEND_ACC_PPP_MASK | ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL | ZEND_ACC_STATIC;
       }

       GET_REFLECTION_OBJECT_PTR(ce);

       array_init(return_value);
       zend_hash_apply_with_arguments(&ce->function_table TSRMLS_CC, (apply_func_args_t) _addmethod_va, 4, &ce, return_value, filter, intern->obj);
       if (intern->obj && instanceof_function(ce, zend_ce_closure TSRMLS_CC)) {
              zend_function *closure = zend_get_closure_invoke_method(intern->obj TSRMLS_CC);
              if (closure) {
                     _addmethod(closure, ce, return_value, filter, intern->obj TSRMLS_CC);
                     _free_function(closure TSRMLS_CC);
              }
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
hasProperty   
)

Definition at line 3537 of file php_reflection.c.

{
       reflection_object *intern;
       zend_property_info *property_info;
       zend_class_entry *ce;
       char *name; 
       int name_len;
       zval *property;

       METHOD_NOTSTATIC(reflection_class_ptr);
       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
              return;
       }

       GET_REFLECTION_OBJECT_PTR(ce);
       if (zend_hash_find(&ce->properties_info, name, name_len+1, (void **) &property_info) == SUCCESS) {
              if (property_info->flags & ZEND_ACC_SHADOW) {
                     RETURN_FALSE;
              }
              RETURN_TRUE;
       } else {
              if (intern->obj && Z_OBJ_HANDLER_P(intern->obj, has_property)) {
                     MAKE_STD_ZVAL(property);
                     ZVAL_STRINGL(property, name, name_len, 1);
                     if (Z_OBJ_HANDLER_P(intern->obj, has_property)(intern->obj, property, 2 TSRMLS_CC)) {
                            zval_ptr_dtor(&property);
                            RETURN_TRUE;
                     }
                     zval_ptr_dtor(&property);
              }
              RETURN_FALSE;
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
getProperty   
)

Definition at line 3574 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce, **pce;
       zend_property_info *property_info;
       char *name, *tmp, *classname; 
       int name_len, classname_len;

       METHOD_NOTSTATIC(reflection_class_ptr);
       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
              return;
       }

       GET_REFLECTION_OBJECT_PTR(ce);
       if (zend_hash_find(&ce->properties_info, name, name_len + 1, (void**) &property_info) == SUCCESS) {
              if ((property_info->flags & ZEND_ACC_SHADOW) == 0) {
                     reflection_property_factory(ce, property_info, return_value TSRMLS_CC);
                     return;
              }
       } else if (intern->obj) {
              /* Check for dynamic properties */
              if (zend_hash_exists(Z_OBJ_HT_P(intern->obj)->get_properties(intern->obj TSRMLS_CC), name, name_len+1)) {
                     zend_property_info property_info_tmp;
                     property_info_tmp.flags = ZEND_ACC_IMPLICIT_PUBLIC;
                     property_info_tmp.name = estrndup(name, name_len);
                     property_info_tmp.name_length = name_len;
                     property_info_tmp.h = zend_get_hash_value(name, name_len+1);
                     property_info_tmp.doc_comment = NULL;
                     property_info_tmp.ce = ce;

                     reflection_property_factory(ce, &property_info_tmp, return_value TSRMLS_CC);
                     intern = (reflection_object *) zend_object_store_get_object(return_value TSRMLS_CC);
                     intern->ref_type = REF_TYPE_DYNAMIC_PROPERTY;
                     return;
              }
       }
       if ((tmp = strstr(name, "::")) != NULL) {
              classname_len = tmp - name;
              classname = zend_str_tolower_dup(name, classname_len);
              classname[classname_len] = '\0';
              name_len = name_len - (classname_len + 2);
              name = tmp + 2;

              if (zend_lookup_class(classname, classname_len, &pce TSRMLS_CC) == FAILURE) {
                     if (!EG(exception)) {
                            zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Class %s does not exist", classname);
                     }
                     efree(classname);
                     return;
              }
              efree(classname);

              if (!instanceof_function(ce, *pce TSRMLS_CC)) {
                     zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Fully qualified property name %s::%s does not specify a base class of %s", (*pce)->name, name, ce->name);
                     return;
              }
              ce = *pce;

              if (zend_hash_find(&ce->properties_info, name, name_len + 1, (void**) &property_info) == SUCCESS && (property_info->flags & ZEND_ACC_SHADOW) == 0) {
                     reflection_property_factory(ce, property_info, return_value TSRMLS_CC);
                     return;
              }             
       }
       zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                     "Property %s does not exist", name);
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
getProperties   
)

Definition at line 3687 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;
       long filter = 0;
       int argc = ZEND_NUM_ARGS();

       METHOD_NOTSTATIC(reflection_class_ptr);
       if (argc) {
              if (zend_parse_parameters(argc TSRMLS_CC, "|l", &filter) == FAILURE) {
                     return;
              }
       } else {
              /* No parameters given, default to "return all" */
              filter = ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC;
       }

       GET_REFLECTION_OBJECT_PTR(ce);

       array_init(return_value);
       zend_hash_apply_with_arguments(&ce->properties_info TSRMLS_CC, (apply_func_args_t) _addproperty, 3, &ce, return_value, filter);

       if (intern->obj && (filter & ZEND_ACC_PUBLIC) != 0 && Z_OBJ_HT_P(intern->obj)->get_properties) {
              HashTable *properties = Z_OBJ_HT_P(intern->obj)->get_properties(intern->obj TSRMLS_CC);
              zend_hash_apply_with_arguments(properties TSRMLS_CC, (apply_func_args_t) _adddynproperty, 2, &ce, return_value);
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
hasConstant   
)

Definition at line 3718 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;
       char *name;
       int name_len;

       METHOD_NOTSTATIC(reflection_class_ptr);
       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
              return;
       }

       GET_REFLECTION_OBJECT_PTR(ce);
       if (zend_hash_exists(&ce->constants_table, name, name_len + 1)) {
              RETURN_TRUE;
       } else {
              RETURN_FALSE;
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
getConstants   
)

Definition at line 3741 of file php_reflection.c.

{
       zval *tmp_copy;
       reflection_object *intern;
       zend_class_entry *ce;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(ce);
       array_init(return_value);
       zend_hash_apply_with_argument(&ce->constants_table, (apply_func_arg_t)zval_update_constant_inline_change, ce TSRMLS_CC);
       zend_hash_copy(Z_ARRVAL_P(return_value), &ce->constants_table, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *));
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
getConstant   
)

Definition at line 3759 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;
       zval **value;
       char *name; 
       int name_len;

       METHOD_NOTSTATIC(reflection_class_ptr);
       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
              return;
       }

       GET_REFLECTION_OBJECT_PTR(ce);
       zend_hash_apply_with_argument(&ce->constants_table, (apply_func_arg_t)zval_update_constant_inline_change, ce TSRMLS_CC);
       if (zend_hash_find(&ce->constants_table, name, name_len + 1, (void **) &value) == FAILURE) {
              RETURN_FALSE;
       }
       MAKE_COPY_ZVAL(value, return_value);
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
isInstantiable   
)

Definition at line 3797 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(ce);
       if (ce->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS | ZEND_ACC_IMPLICIT_ABSTRACT_CLASS)) {
              RETURN_FALSE;
       }

       /* Basically, the class is instantiable. Though, if there is a constructor
        * and it is not publicly accessible, it isn't! */
       if (!ce->constructor) {
              RETURN_TRUE;
       }

       RETURN_BOOL(ce->constructor->common.fn_flags & ZEND_ACC_PUBLIC);
}
ZEND_METHOD ( reflection_class  ,
isInterface   
)

Definition at line 3822 of file php_reflection.c.

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
isFinal   
)

Definition at line 3830 of file php_reflection.c.

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
isAbstract   
)
ZEND_METHOD ( reflection_class  ,
getModifiers   
)

Definition at line 3846 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(ce);

       RETURN_LONG(ce->ce_flags);
}
ZEND_METHOD ( reflection_class  ,
isInstance   
)

Definition at line 3862 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;
       zval *object;

       METHOD_NOTSTATIC(reflection_class_ptr);
       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &object) == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(ce);     
       RETURN_BOOL(HAS_CLASS_ENTRY(*object) && instanceof_function(Z_OBJCE_P(object), ce TSRMLS_CC));
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
newInstance   
)

Definition at line 3879 of file php_reflection.c.

{
       zval *retval_ptr = NULL;
       reflection_object *intern;
       zend_class_entry *ce;
       
       METHOD_NOTSTATIC(reflection_class_ptr);
       GET_REFLECTION_OBJECT_PTR(ce);

       /* Run the constructor if there is one */
       if (ce->constructor) {
              zval ***params = NULL;
              int num_args = 0;
              zend_fcall_info fci;
              zend_fcall_info_cache fcc;

              if (!(ce->constructor->common.fn_flags & ZEND_ACC_PUBLIC)) {
                     zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Access to non-public constructor of class %s", ce->name);
                     return;
              }

              if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "*", &params, &num_args) == FAILURE) {
                     if (params) {
                            efree(params);
                     }
                     RETURN_FALSE;
              }

              object_init_ex(return_value, ce);

              fci.size = sizeof(fci);
              fci.function_table = EG(function_table);
              fci.function_name = NULL;
              fci.symbol_table = NULL;
              fci.object_ptr = return_value;
              fci.retval_ptr_ptr = &retval_ptr;
              fci.param_count = num_args;
              fci.params = params;
              fci.no_separation = 1;

              fcc.initialized = 1;
              fcc.function_handler = ce->constructor;
              fcc.calling_scope = EG(scope);
              fcc.called_scope = Z_OBJCE_P(return_value);
              fcc.object_ptr = return_value;

              if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
                     if (params) {
                            efree(params);
                     }
                     if (retval_ptr) {
                            zval_ptr_dtor(&retval_ptr);
                     }
                     php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invocation of %s's constructor failed", ce->name);
                     RETURN_NULL();
              }
              if (retval_ptr) {
                     zval_ptr_dtor(&retval_ptr);
              }
              if (params) {
                     efree(params);
              }
       } else if (!ZEND_NUM_ARGS()) {
              object_init_ex(return_value, ce);
       } else {
              zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %s does not have a constructor, so you cannot pass any constructor arguments", ce->name);
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
newInstanceArgs   
)

Definition at line 3951 of file php_reflection.c.

{
       zval *retval_ptr = NULL;
       reflection_object *intern;
       zend_class_entry *ce;
       int argc = 0;
       HashTable *args;
       
       
       METHOD_NOTSTATIC(reflection_class_ptr);
       GET_REFLECTION_OBJECT_PTR(ce);

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|h", &args) == FAILURE) {
              return;
       }
       if (ZEND_NUM_ARGS() > 0) {
              argc = args->nNumOfElements;
       }
       
       /* Run the constructor if there is one */
       if (ce->constructor) {
              zval ***params = NULL;
              zend_fcall_info fci;
              zend_fcall_info_cache fcc;

              if (!(ce->constructor->common.fn_flags & ZEND_ACC_PUBLIC)) {
                     zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Access to non-public constructor of class %s", ce->name);
                     return;
              }
              
              if (argc) {
                     params = safe_emalloc(sizeof(zval **), argc, 0);
                     zend_hash_apply_with_argument(args, (apply_func_arg_t)_zval_array_to_c_array, &params TSRMLS_CC); 
                     params -= argc;
              }

              object_init_ex(return_value, ce);

              fci.size = sizeof(fci);
              fci.function_table = EG(function_table);
              fci.function_name = NULL;
              fci.symbol_table = NULL;
              fci.object_ptr = return_value;
              fci.retval_ptr_ptr = &retval_ptr;
              fci.param_count = argc;
              fci.params = params;
              fci.no_separation = 1;

              fcc.initialized = 1;
              fcc.function_handler = ce->constructor;
              fcc.calling_scope = EG(scope);
              fcc.called_scope = Z_OBJCE_P(return_value);
              fcc.object_ptr = return_value;

              if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
                     if (params) {
                            efree(params);
                     }
                     if (retval_ptr) {
                            zval_ptr_dtor(&retval_ptr);
                     }
                     php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invocation of %s's constructor failed", ce->name);
                     RETURN_NULL();
              }
              if (retval_ptr) {
                     zval_ptr_dtor(&retval_ptr);
              }
              if (params) {
                     efree(params);
              }
       } else if (!ZEND_NUM_ARGS() || !argc) {
              object_init_ex(return_value, ce);
       } else {
              zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %s does not have a constructor, so you cannot pass any constructor arguments", ce->name);
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
getInterfaces   
)

Definition at line 4031 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(ce);

       /* Return an empty array if this class implements no interfaces */
       array_init(return_value);

       if (ce->num_interfaces) {
              zend_uint i;

              for (i=0; i < ce->num_interfaces; i++) {
                     zval *interface;
                     ALLOC_ZVAL(interface);
                     zend_reflection_class_factory(ce->interfaces[i], interface TSRMLS_CC);
                     add_assoc_zval_ex(return_value, ce->interfaces[i]->name, ce->interfaces[i]->name_length + 1, interface);
              }
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
getInterfaceNames   
)

Definition at line 4059 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;
       zend_uint i;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(ce);

       /* Return an empty array if this class implements no interfaces */
       array_init(return_value);

       for (i=0; i < ce->num_interfaces; i++) {
              add_next_index_stringl(return_value, ce->interfaces[i]->name, ce->interfaces[i]->name_length, 1);
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
getParentClass   
)

Definition at line 4081 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(ce);
       
       if (ce->parent) {
              zend_reflection_class_factory(ce->parent, return_value TSRMLS_CC);
       } else {
              RETURN_FALSE;
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
isSubclassOf   
)

Definition at line 4101 of file php_reflection.c.

{
       reflection_object *intern, *argument;
       zend_class_entry *ce, **pce, *class_ce;
       zval *class_name;

       METHOD_NOTSTATIC(reflection_class_ptr);
       GET_REFLECTION_OBJECT_PTR(ce);

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &class_name) == FAILURE) {
              return;
       }
       
       switch(class_name->type) {
              case IS_STRING:
                     if (zend_lookup_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), &pce TSRMLS_CC) == FAILURE) {
                            zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                                          "Class %s does not exist", Z_STRVAL_P(class_name));
                            return;
                     }
                     class_ce = *pce;
                     break;               
              case IS_OBJECT:
                     if (instanceof_function(Z_OBJCE_P(class_name), reflection_class_ptr TSRMLS_CC)) {
                            argument = (reflection_object *) zend_object_store_get_object(class_name TSRMLS_CC);
                            if (argument == NULL || argument->ptr == NULL) {
                                   php_error_docref(NULL TSRMLS_CC, E_ERROR, "Internal error: Failed to retrieve the argument's reflection object");
                                   /* Bails out */
                            }
                            class_ce = argument->ptr;
                            break;
                     }
                     /* no break */
              default:
                     zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                                   "Parameter one must either be a string or a ReflectionClass object");
                     return;
       }

       RETURN_BOOL((ce != class_ce && instanceof_function(ce, class_ce TSRMLS_CC)));
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
implementsInterface   
)

Definition at line 4146 of file php_reflection.c.

{
       reflection_object *intern, *argument;
       zend_class_entry *ce, *interface_ce, **pce;
       zval *interface;

       METHOD_NOTSTATIC(reflection_class_ptr);
       GET_REFLECTION_OBJECT_PTR(ce);

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &interface) == FAILURE) {
              return;
       }
       
       switch(interface->type) {
              case IS_STRING:
                     if (zend_lookup_class(Z_STRVAL_P(interface), Z_STRLEN_P(interface), &pce TSRMLS_CC) == FAILURE) {
                            zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                                          "Interface %s does not exist", Z_STRVAL_P(interface));
                            return;
                     }
                     interface_ce = *pce;
                     break;               
              case IS_OBJECT:
                     if (instanceof_function(Z_OBJCE_P(interface), reflection_class_ptr TSRMLS_CC)) {
                            argument = (reflection_object *) zend_object_store_get_object(interface TSRMLS_CC);
                            if (argument == NULL || argument->ptr == NULL) {
                                   php_error_docref(NULL TSRMLS_CC, E_ERROR, "Internal error: Failed to retrieve the argument's reflection object");
                                   /* Bails out */
                            }
                            interface_ce = argument->ptr;
                            break;
                     }
                     /* no break */
              default:
                     zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                                   "Parameter one must either be a string or a ReflectionClass object");
                     return;
       }

       if (!(interface_ce->ce_flags & ZEND_ACC_INTERFACE)) {
              zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                            "Interface %s is a Class", interface_ce->name);
              return;
       }
       RETURN_BOOL(instanceof_function(ce, interface_ce TSRMLS_CC));
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
isIterateable   
)

Definition at line 4196 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       METHOD_NOTSTATIC(reflection_class_ptr);
       GET_REFLECTION_OBJECT_PTR(ce);

       RETURN_BOOL(ce->get_iterator != NULL);
}
ZEND_METHOD ( reflection_class  ,
getExtension   
)

Definition at line 4214 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       METHOD_NOTSTATIC(reflection_class_ptr);
       GET_REFLECTION_OBJECT_PTR(ce);

       if (ce->module) {
              reflection_extension_factory(return_value, ce->module->name TSRMLS_CC);
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
getExtensionName   
)

Definition at line 4234 of file php_reflection.c.

{
       reflection_object *intern;
       zend_class_entry *ce;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       METHOD_NOTSTATIC(reflection_class_ptr);
       GET_REFLECTION_OBJECT_PTR(ce);

       if (ce->module) {
              RETURN_STRING(ce->module->name, 1);
       } else {
              RETURN_FALSE;
       }
}
ZEND_METHOD ( reflection_class  ,
inNamespace   
)

Definition at line 4256 of file php_reflection.c.

{
       zval **name;
       char *colon;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       if (zend_hash_find(Z_OBJPROP_P(getThis()), "name", sizeof("name"), (void **) &name) == FAILURE) {
              RETURN_FALSE;
       }
       if (Z_TYPE_PP(name) == IS_STRING
              && (colon = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name)))
              && colon > Z_STRVAL_PP(name))
       {
              RETURN_TRUE;
       }
       RETURN_FALSE;
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
getNamespaceName   
)

Definition at line 4279 of file php_reflection.c.

{
       zval **name;
       char *backslash;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       if (zend_hash_find(Z_OBJPROP_P(getThis()), "name", sizeof("name"), (void **) &name) == FAILURE) {
              RETURN_FALSE;
       }
       if (Z_TYPE_PP(name) == IS_STRING
              && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name)))
              && backslash > Z_STRVAL_PP(name))
       {
              RETURN_STRINGL(Z_STRVAL_PP(name), backslash - Z_STRVAL_PP(name), 1);
       }
       RETURN_EMPTY_STRING();
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_class  ,
getShortName   
)

Definition at line 4302 of file php_reflection.c.

{
       zval **name;
       char *backslash;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       if (zend_hash_find(Z_OBJPROP_P(getThis()), "name", sizeof("name"), (void **) &name) == FAILURE) {
              RETURN_FALSE;
       }
       if (Z_TYPE_PP(name) == IS_STRING
              && (backslash = zend_memrchr(Z_STRVAL_PP(name), '\\', Z_STRLEN_PP(name)))
              && backslash > Z_STRVAL_PP(name))
       {
              RETURN_STRINGL(backslash + 1, Z_STRLEN_PP(name) - (backslash - Z_STRVAL_PP(name) + 1), 1);
       }
       RETURN_ZVAL(*name, 1, 0);
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_object  ,
export   
)

Definition at line 4325 of file php_reflection.c.

Here is the call graph for this function:

ZEND_METHOD ( reflection_object  ,
__construct   
)

Definition at line 4333 of file php_reflection.c.

Here is the call graph for this function:

ZEND_METHOD ( reflection_property  ,
export   
)

Definition at line 4341 of file php_reflection.c.

Here is the call graph for this function:

ZEND_METHOD ( reflection_property  ,
__construct   
)

Definition at line 4349 of file php_reflection.c.

{
       zval *propname, *classname;
       char *name_str, *class_name, *prop_name;
       int name_len, dynam_prop = 0;
       zval *object;
       reflection_object *intern;
       zend_class_entry **pce;
       zend_class_entry *ce;
       zend_property_info *property_info = NULL;
       property_reference *reference;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &classname, &name_str, &name_len) == FAILURE) {
              return;
       }

       object = getThis();
       intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
       if (intern == NULL) {
              return;
       }
       
       /* Find the class entry */
       switch (Z_TYPE_P(classname)) {
              case IS_STRING:
                     if (zend_lookup_class(Z_STRVAL_P(classname), Z_STRLEN_P(classname), &pce TSRMLS_CC) == FAILURE) {
                            zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
                                          "Class %s does not exist", Z_STRVAL_P(classname)); 
                            return;
                     }
                     ce = *pce;
                     break;

              case IS_OBJECT:
                     ce = Z_OBJCE_P(classname);
                     break;
                     
              default:
                     _DO_THROW("The parameter class is expected to be either a string or an object");
                     /* returns out of this function */
       }

       if (zend_hash_find(&ce->properties_info, name_str, name_len + 1, (void **) &property_info) == FAILURE || (property_info->flags & ZEND_ACC_SHADOW)) {
              /* Check for dynamic properties */
              if (property_info == NULL && Z_TYPE_P(classname) == IS_OBJECT && Z_OBJ_HT_P(classname)->get_properties) {
                     if (zend_hash_exists(Z_OBJ_HT_P(classname)->get_properties(classname TSRMLS_CC), name_str, name_len+1)) {
                            dynam_prop = 1;
                     }
              }
              if (dynam_prop == 0) {
                     zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Property %s::$%s does not exist", ce->name, name_str);
                     return;
              }
       }
       
       if (dynam_prop == 0 && (property_info->flags & ZEND_ACC_PRIVATE) == 0) {
              /* we have to search the class hierarchy for this (implicit) public or protected property */
              zend_class_entry *tmp_ce = ce;
              zend_property_info *tmp_info;
              
              while (tmp_ce && zend_hash_find(&tmp_ce->properties_info, name_str, name_len + 1, (void **) &tmp_info) != SUCCESS) {
                     ce = tmp_ce;
                     property_info = tmp_info;
                     tmp_ce = tmp_ce->parent;
              }
       }

       MAKE_STD_ZVAL(classname);   
       MAKE_STD_ZVAL(propname);
       
       if (dynam_prop == 0) {
              zend_unmangle_property_name(property_info->name, property_info->name_length, &class_name, &prop_name);
              ZVAL_STRINGL(classname, property_info->ce->name, property_info->ce->name_length, 1);
              ZVAL_STRING(propname, prop_name, 1);
       } else {
              ZVAL_STRINGL(classname, ce->name, ce->name_length, 1);  
              ZVAL_STRINGL(propname, name_str, name_len, 1);
       }
       zend_hash_update(Z_OBJPROP_P(object), "class", sizeof("class"), (void **) &classname, sizeof(zval *), NULL);
       zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &propname, sizeof(zval *), NULL);

       reference = (property_reference*) emalloc(sizeof(property_reference));
       if (dynam_prop) {
              reference->prop.flags = ZEND_ACC_IMPLICIT_PUBLIC;
              reference->prop.name = Z_STRVAL_P(propname);
              reference->prop.name_length = Z_STRLEN_P(propname);
              reference->prop.h = zend_get_hash_value(name_str, name_len+1);
              reference->prop.doc_comment = NULL;
              reference->prop.ce = ce;
       } else {
              reference->prop = *property_info;
       }
       reference->ce = ce;
       intern->ptr = reference;
       intern->ref_type = REF_TYPE_PROPERTY;
       intern->ce = ce;
       intern->ignore_visibility = 0;
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_property  ,
__toString   
)

Definition at line 4451 of file php_reflection.c.

{
       reflection_object *intern;
       property_reference *ref;
       string str;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(ref);
       string_init(&str);
       _property_string(&str, &ref->prop, NULL, "" TSRMLS_CC);
       RETURN_STRINGL(str.string, str.len - 1, 0);
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_property  ,
getName   
)

Definition at line 4469 of file php_reflection.c.

{
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       _default_get_entry(getThis(), "name", sizeof("name"), return_value TSRMLS_CC);
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_property  ,
isPublic   
)

Definition at line 4492 of file php_reflection.c.

Here is the call graph for this function:

ZEND_METHOD ( reflection_property  ,
isPrivate   
)

Definition at line 4500 of file php_reflection.c.

Here is the call graph for this function:

ZEND_METHOD ( reflection_property  ,
isProtected   
)

Definition at line 4508 of file php_reflection.c.

Here is the call graph for this function:

ZEND_METHOD ( reflection_property  ,
isStatic   
)

Definition at line 4516 of file php_reflection.c.

Here is the call graph for this function:

ZEND_METHOD ( reflection_property  ,
isDefault   
)

Definition at line 4524 of file php_reflection.c.

Here is the call graph for this function:

ZEND_METHOD ( reflection_property  ,
getModifiers   
)

Definition at line 4532 of file php_reflection.c.

ZEND_METHOD ( reflection_property  ,
getValue   
)

Definition at line 4548 of file php_reflection.c.

{
       reflection_object *intern;
       property_reference *ref;
       zval *object, name;
       zval **member = NULL, *member_p = NULL;

       METHOD_NOTSTATIC(reflection_property_ptr);
       GET_REFLECTION_OBJECT_PTR(ref);

       if (!(ref->prop.flags & (ZEND_ACC_PUBLIC | ZEND_ACC_IMPLICIT_PUBLIC)) && intern->ignore_visibility == 0) {
              _default_get_entry(getThis(), "name", sizeof("name"), &name TSRMLS_CC);
              zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                     "Cannot access non-public member %s::%s", intern->ce->name, Z_STRVAL(name));
              zval_dtor(&name);
              return;
       }

       if ((ref->prop.flags & ZEND_ACC_STATIC)) {
              zend_update_class_constants(intern->ce TSRMLS_CC);
              if (zend_hash_quick_find(CE_STATIC_MEMBERS(intern->ce), ref->prop.name, ref->prop.name_length + 1, ref->prop.h, (void **) &member) == FAILURE) {
                     php_error_docref(NULL TSRMLS_CC, E_ERROR, "Internal error: Could not find the property %s::%s", intern->ce->name, ref->prop.name);
                     /* Bails out */
              }
              MAKE_COPY_ZVAL(member, return_value);
       } else {
              char *class_name, *prop_name;
              
              if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &object) == FAILURE) {
                     return;
              }
              zend_unmangle_property_name(ref->prop.name, ref->prop.name_length, &class_name, &prop_name);
              member_p = zend_read_property(ref->ce, object, prop_name, strlen(prop_name), 1 TSRMLS_CC);
              MAKE_COPY_ZVAL(&member_p, return_value);
              if (member_p != EG(uninitialized_zval_ptr)) {
                     zval_add_ref(&member_p);
                     zval_ptr_dtor(&member_p);
              }
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_property  ,
setValue   
)

Definition at line 4592 of file php_reflection.c.

{
       reflection_object *intern;
       property_reference *ref;
       zval **variable_ptr;
       zval *object, name;
       zval *value;
       int setter_done = 0;
       zval *tmp;
       HashTable *prop_table;

       METHOD_NOTSTATIC(reflection_property_ptr);
       GET_REFLECTION_OBJECT_PTR(ref);

       if (!(ref->prop.flags & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) {
              _default_get_entry(getThis(), "name", sizeof("name"), &name TSRMLS_CC);
              zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
                     "Cannot access non-public member %s::%s", intern->ce->name, Z_STRVAL(name));
              zval_dtor(&name);
              return;
       }

       if ((ref->prop.flags & ZEND_ACC_STATIC)) {
              if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "z", &value) == FAILURE) {
                     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &tmp, &value) == FAILURE) {
                            return;
                     }
              }
              zend_update_class_constants(intern->ce TSRMLS_CC);
              prop_table = CE_STATIC_MEMBERS(intern->ce);

              if (zend_hash_quick_find(prop_table, ref->prop.name, ref->prop.name_length + 1, ref->prop.h, (void **) &variable_ptr) == FAILURE) {
                     php_error_docref(NULL TSRMLS_CC, E_ERROR, "Internal error: Could not find the property %s::%s", intern->ce->name, ref->prop.name);
                     /* Bails out */
              }
              if (*variable_ptr == value) {
                     setter_done = 1;
              } else {
                     if (PZVAL_IS_REF(*variable_ptr)) {
                            zval_dtor(*variable_ptr);
                            (*variable_ptr)->type = value->type;
                            (*variable_ptr)->value = value->value;
                            if (Z_REFCOUNT_P(value) > 0) {
                                   zval_copy_ctor(*variable_ptr);
                            }
                            setter_done = 1;
                     }
              }
              if (!setter_done) {
                     zval **foo;

                     Z_ADDREF_P(value);
                     if (PZVAL_IS_REF(value)) {
                            SEPARATE_ZVAL(&value);
                     }
                     zend_hash_quick_update(prop_table, ref->prop.name, ref->prop.name_length+1, ref->prop.h, &value, sizeof(zval *), (void **) &foo);
              }
       } else {
              char *class_name, *prop_name;

              if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "oz", &object, &value) == FAILURE) {
                     return;
              }
              zend_unmangle_property_name(ref->prop.name, ref->prop.name_length, &class_name, &prop_name);
              zend_update_property(ref->ce, object, prop_name, strlen(prop_name), value TSRMLS_CC);
       }
}

Here is the call graph for this function:

ZEND_METHOD ( reflection_property  ,
getDeclaringClass   
)

Definition at line 4663 of file php_reflection.c.

{
       reflection_object *intern;
       property_reference *ref;
       zend_class_entry *tmp_ce, *ce;
       zend_property_info *tmp_info;
       char *prop_name, *class_name;
       int prop_name_len;

       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }
       GET_REFLECTION_OBJECT_PTR(ref);

       if (zend_unmangle_property_name(ref->prop.name, ref->prop.name_length, &class_name, &prop_name) != SUCCESS) {