Coverage Report

Created: 2026-06-02 06:36

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/php-src/Zend/zend_object_handlers.h
Line
Count
Source
1
/*
2
   +----------------------------------------------------------------------+
3
   | Zend Engine                                                          |
4
   +----------------------------------------------------------------------+
5
   | Copyright © Zend Technologies Ltd., a subsidiary company of          |
6
   |     Perforce Software, Inc., and Contributors.                       |
7
   +----------------------------------------------------------------------+
8
   | This source file is subject to the Modified BSD License that is      |
9
   | bundled with this package in the file LICENSE, and is available      |
10
   | through the World Wide Web at <https://www.php.net/license/>.        |
11
   |                                                                      |
12
   | SPDX-License-Identifier: BSD-3-Clause                                |
13
   +----------------------------------------------------------------------+
14
   | Authors: Andi Gutmans <andi@php.net>                                 |
15
   |          Zeev Suraski <zeev@php.net>                                 |
16
   +----------------------------------------------------------------------+
17
*/
18
19
#ifndef ZEND_OBJECT_HANDLERS_H
20
#define ZEND_OBJECT_HANDLERS_H
21
22
#include <stdint.h>
23
24
#include "zend_hash.h"
25
#include "zend_types.h"
26
#include "zend_property_hooks.h"
27
#include "zend_lazy_objects.h"
28
29
struct _zend_property_info;
30
31
#define ZEND_WRONG_PROPERTY_INFO \
32
295
  ((struct _zend_property_info*)((intptr_t)-1))
33
34
5.39k
#define ZEND_DYNAMIC_PROPERTY_OFFSET               ((uintptr_t)(intptr_t)(-1))
35
36
/* The first 4 bits in the property offset are used within the cache slot for
37
 * storing information about the property. This value may be bumped to
38
 * offsetof(zend_object, properties_table) in the future. */
39
0
#define ZEND_FIRST_PROPERTY_OFFSET (1 << 4)
40
0
#define IS_VALID_PROPERTY_OFFSET(offset)           ((intptr_t)(offset) >= ZEND_FIRST_PROPERTY_OFFSET)
41
#define IS_WRONG_PROPERTY_OFFSET(offset)           ((intptr_t)(offset) == 0)
42
#define IS_HOOKED_PROPERTY_OFFSET(offset) \
43
73
  ((intptr_t)(offset) > 0 && (intptr_t)(offset) < 16)
44
#define IS_DYNAMIC_PROPERTY_OFFSET(offset)         ((intptr_t)(offset) < 0)
45
46
0
#define ZEND_PROPERTY_HOOK_SIMPLE_READ_BIT 2u
47
0
#define ZEND_PROPERTY_HOOK_SIMPLE_WRITE_BIT 4u
48
#define ZEND_PROPERTY_HOOK_SIMPLE_GET_BIT 8u
49
#define ZEND_IS_PROPERTY_HOOK_SIMPLE_READ(offset) \
50
0
  (((offset) & ZEND_PROPERTY_HOOK_SIMPLE_READ_BIT) != 0)
51
#define ZEND_IS_PROPERTY_HOOK_SIMPLE_WRITE(offset) \
52
0
  (((offset) & ZEND_PROPERTY_HOOK_SIMPLE_WRITE_BIT) != 0)
53
#define ZEND_IS_PROPERTY_HOOK_SIMPLE_GET(offset) \
54
  (((offset) & ZEND_PROPERTY_HOOK_SIMPLE_GET_BIT) != 0)
55
#define ZEND_SET_PROPERTY_HOOK_SIMPLE_READ(cache_slot) \
56
11
  do { \
57
11
    void **__cache_slot = (cache_slot); \
58
11
    if (__cache_slot) { \
59
9
      CACHE_PTR_EX(__cache_slot + 1, (void*)((uintptr_t)CACHED_PTR_EX(__cache_slot + 1) | ZEND_PROPERTY_HOOK_SIMPLE_READ_BIT)); \
60
9
    } \
61
11
  } while (0)
62
#define ZEND_SET_PROPERTY_HOOK_SIMPLE_WRITE(cache_slot) \
63
5
  do { \
64
5
    void **__cache_slot = (cache_slot); \
65
5
    if (__cache_slot) { \
66
5
      CACHE_PTR_EX(__cache_slot + 1, (void*)((uintptr_t)CACHED_PTR_EX(__cache_slot + 1) | ZEND_PROPERTY_HOOK_SIMPLE_WRITE_BIT)); \
67
5
    } \
68
5
  } while (0)
69
#define ZEND_SET_PROPERTY_HOOK_SIMPLE_GET(cache_slot) \
70
0
  do { \
71
0
    void **__cache_slot = (cache_slot); \
72
0
    if (__cache_slot) { \
73
0
      CACHE_PTR_EX(__cache_slot + 1, (void*)((uintptr_t)CACHED_PTR_EX(__cache_slot + 1) | ZEND_PROPERTY_HOOK_SIMPLE_GET_BIT)); \
74
0
    } \
75
0
  } while (0)
76
77
122
#define IS_UNKNOWN_DYNAMIC_PROPERTY_OFFSET(offset) (offset == ZEND_DYNAMIC_PROPERTY_OFFSET)
78
98
#define ZEND_DECODE_DYN_PROP_OFFSET(offset)        ((uintptr_t)(-(intptr_t)(offset) - 2))
79
#define ZEND_ENCODE_DYN_PROP_OFFSET(offset)        ((uintptr_t)(-((intptr_t)(offset) + 2)))
80
81
82
/* Used to fetch property from the object, read-only */
83
typedef zval *(*zend_object_read_property_t)(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv);
84
85
/* Used to fetch dimension from the object, read-only */
86
typedef zval *(*zend_object_read_dimension_t)(zend_object *object, zval *offset, int type, zval *rv);
87
88
89
/* Used to set property of the object
90
   You must return the final value of the assigned property.
91
*/
92
typedef zval *(*zend_object_write_property_t)(zend_object *object, zend_string *member, zval *value, void **cache_slot);
93
94
/* Used to set dimension of the object */
95
typedef void (*zend_object_write_dimension_t)(zend_object *object, zval *offset, zval *value);
96
97
98
/* Used to create pointer to the property of the object, for future direct r/w access.
99
 * May return one of:
100
 *  * A zval pointer, without incrementing the reference count.
101
 *  * &EG(error_zval), if an exception has been thrown.
102
 *  * NULL, if acquiring a direct pointer is not possible.
103
 *    In this case, the VM will fall back to using read_property and write_property.
104
 */
105
typedef zval *(*zend_object_get_property_ptr_ptr_t)(zend_object *object, zend_string *member, int type, void **cache_slot);
106
107
/* Used to check if a property of the object exists */
108
/* param has_set_exists:
109
 * 0 (has) whether property exists and is not NULL
110
 * 1 (set) whether property exists and is true
111
 * 2 (exists) whether property exists
112
 */
113
typedef int (*zend_object_has_property_t)(zend_object *object, zend_string *member, int has_set_exists, void **cache_slot);
114
115
/* Used to check if a dimension of the object exists */
116
typedef int (*zend_object_has_dimension_t)(zend_object *object, zval *member, int check_empty);
117
118
/* Used to remove a property of the object */
119
typedef void (*zend_object_unset_property_t)(zend_object *object, zend_string *member, void **cache_slot);
120
121
/* Used to remove a dimension of the object */
122
typedef void (*zend_object_unset_dimension_t)(zend_object *object, zval *offset);
123
124
/* Used to get hash of the properties of the object, as hash of zval's */
125
typedef HashTable *(*zend_object_get_properties_t)(zend_object *object);
126
127
typedef HashTable *(*zend_object_get_debug_info_t)(zend_object *object, int *is_temp);
128
129
typedef enum _zend_prop_purpose {
130
  /* Used for debugging. Supersedes get_debug_info handler. */
131
  ZEND_PROP_PURPOSE_DEBUG,
132
  /* Used for (array) casts. */
133
  ZEND_PROP_PURPOSE_ARRAY_CAST,
134
  /* Used for serialization using the "O" scheme.
135
   * Unserialization will use __wakeup(). */
136
  ZEND_PROP_PURPOSE_SERIALIZE,
137
  /* Used for var_export().
138
   * The data will be passed to __set_state() when evaluated. */
139
  ZEND_PROP_PURPOSE_VAR_EXPORT,
140
  /* Used for json_encode(). */
141
  ZEND_PROP_PURPOSE_JSON,
142
  /* Used for get_object_vars(). */
143
  ZEND_PROP_PURPOSE_GET_OBJECT_VARS,
144
  /* Dummy member to ensure that "default" is specified. */
145
  _ZEND_PROP_PURPOSE_NON_EXHAUSTIVE_ENUM
146
} zend_prop_purpose;
147
148
/* The return value must be released using zend_release_properties(). */
149
typedef zend_array *(*zend_object_get_properties_for_t)(zend_object *object, zend_prop_purpose purpose);
150
151
/* Used to call methods */
152
/* args on stack! */
153
/* Andi - EX(fbc) (function being called) needs to be initialized already in the INIT fcall opcode so that the parameters can be parsed the right way. We need to add another callback for this.
154
 */
155
typedef zend_function *(*zend_object_get_method_t)(zend_object **object, zend_string *method, const zval *key);
156
typedef zend_function *(*zend_object_get_constructor_t)(zend_object *object);
157
158
/* free_obj should release any resources the object holds, without freeing the
159
 * object structure itself. The object does not need to be in a valid state after
160
 * free_obj finishes running.
161
 *
162
 * free_obj will always be invoked, even if the object leaks or a fatal error
163
 * occurs. However, during shutdown it may be called once the executor is no
164
 * longer active, in which case execution of user code may be skipped.
165
 */
166
typedef void (*zend_object_free_obj_t)(zend_object *object);
167
168
/* dtor_obj is called before free_obj. The object must remain in a valid state
169
 * after dtor_obj finishes running. Unlike free_obj, it is run prior to
170
 * deactivation of the executor during shutdown, which allows user code to run.
171
 *
172
 * This handler is not guaranteed to be called (e.g. on fatal error), and as
173
 * such should not be used to release resources or deallocate memory. Furthermore,
174
 * releasing resources in this handler can break detection of memory leaks, as
175
 * cycles may be broken early.
176
 *
177
 * dtor_obj should be used *only* to call user destruction hooks, such as __destruct.
178
 */
179
typedef void (*zend_object_dtor_obj_t)(zend_object *object);
180
181
typedef zend_object* (*zend_object_clone_obj_t)(zend_object *object);
182
typedef zend_object* (*zend_object_clone_obj_with_t)(zend_object *object, const zend_class_entry *scope, const HashTable *properties);
183
184
/* Get class name for display in var_dump and other debugging functions.
185
 * Must be defined and must return a non-NULL value. */
186
typedef zend_string *(*zend_object_get_class_name_t)(const zend_object *object);
187
188
typedef int (*zend_object_compare_t)(zval *object1, zval *object2);
189
190
/* Cast an object to some other type.
191
 * readobj and retval must point to distinct zvals.
192
 */
193
typedef zend_result (*zend_object_cast_t)(zend_object *readobj, zval *retval, int type);
194
195
/* updates *count to hold the number of elements present and returns SUCCESS.
196
 * Returns FAILURE if the object does not have any sense of overloaded dimensions */
197
typedef zend_result (*zend_object_count_elements_t)(zend_object *object, zend_long *count);
198
199
typedef zend_result (*zend_object_get_closure_t)(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, bool check_only);
200
201
typedef HashTable *(*zend_object_get_gc_t)(zend_object *object, zval **table, int *n);
202
203
typedef zend_result (*zend_object_do_operation_t)(uint8_t opcode, zval *result, zval *op1, zval *op2);
204
205
struct _zend_object_handlers {
206
  /* offset of real object header (usually zero) */
207
  size_t                    offset;
208
  /* object handlers */
209
  zend_object_free_obj_t          free_obj;             /* required */
210
  zend_object_dtor_obj_t          dtor_obj;             /* required */
211
  zend_object_clone_obj_t         clone_obj;            /* optional */
212
  zend_object_clone_obj_with_t      clone_obj_with;       /* optional */
213
  zend_object_read_property_t       read_property;        /* required */
214
  zend_object_write_property_t      write_property;       /* required */
215
  zend_object_read_dimension_t      read_dimension;       /* required */
216
  zend_object_write_dimension_t     write_dimension;      /* required */
217
  zend_object_get_property_ptr_ptr_t    get_property_ptr_ptr; /* required */
218
  zend_object_has_property_t        has_property;         /* required */
219
  zend_object_unset_property_t      unset_property;       /* required */
220
  zend_object_has_dimension_t       has_dimension;        /* required */
221
  zend_object_unset_dimension_t     unset_dimension;      /* required */
222
  zend_object_get_properties_t      get_properties;       /* required */
223
  zend_object_get_method_t        get_method;           /* required */
224
  zend_object_get_constructor_t     get_constructor;      /* required */
225
  zend_object_get_class_name_t      get_class_name;       /* required */
226
  zend_object_cast_t            cast_object;          /* required */
227
  zend_object_count_elements_t      count_elements;       /* optional */
228
  zend_object_get_debug_info_t      get_debug_info;       /* optional */
229
  zend_object_get_closure_t       get_closure;          /* optional */
230
  zend_object_get_gc_t          get_gc;               /* required */
231
  zend_object_do_operation_t        do_operation;         /* optional */
232
  zend_object_compare_t         compare;              /* required */
233
  zend_object_get_properties_for_t    get_properties_for;   /* optional */
234
};
235
236
BEGIN_EXTERN_C()
237
extern const ZEND_API zend_object_handlers std_object_handlers;
238
239
#define zend_get_std_object_handlers() \
240
20
  (&std_object_handlers)
241
242
#define zend_get_function_root_class(fbc) \
243
0
  ((fbc)->common.prototype ? (fbc)->common.prototype->common.scope : (fbc)->common.scope)
244
245
0
#define ZEND_PROPERTY_ISSET     0x0          /* Property exists and is not NULL */
246
2
#define ZEND_PROPERTY_NOT_EMPTY ZEND_ISEMPTY /* Property is not empty */
247
2
#define ZEND_PROPERTY_EXISTS    0x2          /* Property exists */
248
249
ZEND_API void zend_class_init_statics(zend_class_entry *ce);
250
ZEND_API zend_function *zend_std_get_static_method(const zend_class_entry *ce, zend_string *function_name_strval, const zval *key);
251
ZEND_API zval *zend_std_get_static_property_with_info(zend_class_entry *ce, zend_string *property_name, int type, struct _zend_property_info **prop_info);
252
ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *property_name, int type);
253
ZEND_API ZEND_COLD bool zend_std_unset_static_property(const zend_class_entry *ce, const zend_string *property_name);
254
ZEND_API zend_function *zend_std_get_constructor(zend_object *object);
255
ZEND_API struct _zend_property_info *zend_get_property_info(const zend_class_entry *ce, zend_string *member, int silent);
256
ZEND_API HashTable *zend_std_get_properties(zend_object *object);
257
ZEND_API HashTable *zend_get_properties_no_lazy_init(zend_object *zobj);
258
ZEND_API HashTable *zend_std_get_gc(zend_object *object, zval **table, int *n);
259
ZEND_API HashTable *zend_std_get_debug_info(zend_object *object, int *is_temp);
260
ZEND_API zend_result zend_std_cast_object_tostring(zend_object *object, zval *writeobj, int type);
261
ZEND_API zval *zend_std_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot);
262
ZEND_API zval *zend_std_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv);
263
ZEND_API zval *zend_std_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot);
264
ZEND_API int zend_std_has_property(zend_object *object, zend_string *member, int has_set_exists, void **cache_slot);
265
ZEND_API void zend_std_unset_property(zend_object *object, zend_string *member, void **cache_slot);
266
ZEND_API zval *zend_std_read_dimension(zend_object *object, zval *offset, int type, zval *rv);
267
ZEND_API void zend_std_write_dimension(zend_object *object, zval *offset, zval *value);
268
ZEND_API int zend_std_has_dimension(zend_object *object, zval *offset, int check_empty);
269
ZEND_API void zend_std_unset_dimension(zend_object *object, zval *offset);
270
ZEND_API zend_function *zend_std_get_method(zend_object **obj_ptr, zend_string *method_name, const zval *key);
271
ZEND_API zend_string *zend_std_get_class_name(const zend_object *zobj);
272
ZEND_API int zend_std_compare_objects(zval *o1, zval *o2);
273
ZEND_API zend_result zend_std_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, bool check_only);
274
/* Use zend_std_get_properties_ex() */
275
ZEND_API HashTable *rebuild_object_properties_internal(zend_object *zobj);
276
ZEND_API ZEND_COLD zend_never_inline void zend_bad_method_call(const zend_function *fbc, const zend_string *method_name, const zend_class_entry *scope);
277
ZEND_API ZEND_COLD zend_never_inline void zend_abstract_method_call(const zend_function *fbc);
278
279
static zend_always_inline HashTable *zend_std_get_properties_ex(zend_object *object)
280
5.50k
{
281
5.50k
  if (UNEXPECTED(zend_lazy_object_must_init(object))) {
282
0
    return zend_lazy_object_get_properties(object);
283
0
  }
284
5.50k
  if (!object->properties) {
285
5.03k
    return rebuild_object_properties_internal(object);
286
5.03k
  }
287
472
  return object->properties;
288
5.50k
}
Unexecuted instantiation: php_date.c:zend_std_get_properties_ex
Unexecuted instantiation: astro.c:zend_std_get_properties_ex
Unexecuted instantiation: dow.c:zend_std_get_properties_ex
Unexecuted instantiation: parse_date.c:zend_std_get_properties_ex
Unexecuted instantiation: parse_tz.c:zend_std_get_properties_ex
Unexecuted instantiation: parse_posix.c:zend_std_get_properties_ex
Unexecuted instantiation: timelib.c:zend_std_get_properties_ex
Unexecuted instantiation: tm2unixtime.c:zend_std_get_properties_ex
Unexecuted instantiation: unixtime2tm.c:zend_std_get_properties_ex
Unexecuted instantiation: parse_iso_intervals.c:zend_std_get_properties_ex
Unexecuted instantiation: interval.c:zend_std_get_properties_ex
Unexecuted instantiation: php_pcre.c:zend_std_get_properties_ex
Unexecuted instantiation: exif.c:zend_std_get_properties_ex
Unexecuted instantiation: hash_adler32.c:zend_std_get_properties_ex
Unexecuted instantiation: hash_crc32.c:zend_std_get_properties_ex
Unexecuted instantiation: hash_fnv.c:zend_std_get_properties_ex
Unexecuted instantiation: hash_gost.c:zend_std_get_properties_ex
Unexecuted instantiation: hash_haval.c:zend_std_get_properties_ex
Unexecuted instantiation: hash_joaat.c:zend_std_get_properties_ex
Unexecuted instantiation: hash_md.c:zend_std_get_properties_ex
Unexecuted instantiation: hash_murmur.c:zend_std_get_properties_ex
Unexecuted instantiation: hash_ripemd.c:zend_std_get_properties_ex
Unexecuted instantiation: hash_sha_ni.c:zend_std_get_properties_ex
Unexecuted instantiation: hash_sha_sse2.c:zend_std_get_properties_ex
Unexecuted instantiation: hash_sha.c:zend_std_get_properties_ex
Unexecuted instantiation: hash_sha3.c:zend_std_get_properties_ex
Unexecuted instantiation: hash_snefru.c:zend_std_get_properties_ex
Unexecuted instantiation: hash_tiger.c:zend_std_get_properties_ex
Unexecuted instantiation: hash_whirlpool.c:zend_std_get_properties_ex
Unexecuted instantiation: hash_xxhash.c:zend_std_get_properties_ex
Unexecuted instantiation: hash.c:zend_std_get_properties_ex
Unexecuted instantiation: json_encoder.c:zend_std_get_properties_ex
Unexecuted instantiation: json_parser.tab.c:zend_std_get_properties_ex
Unexecuted instantiation: json_scanner.c:zend_std_get_properties_ex
Unexecuted instantiation: json.c:zend_std_get_properties_ex
Unexecuted instantiation: php_lexbor.c:zend_std_get_properties_ex
Unexecuted instantiation: shared_alloc_mmap.c:zend_std_get_properties_ex
Unexecuted instantiation: shared_alloc_posix.c:zend_std_get_properties_ex
Unexecuted instantiation: shared_alloc_shm.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_accelerator_api.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_accelerator_blacklist.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_accelerator_debug.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_accelerator_hash.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_accelerator_module.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_accelerator_util_funcs.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_file_cache.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_persist_calc.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_persist.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_shared_alloc.c:zend_std_get_properties_ex
Unexecuted instantiation: ZendAccelerator.c:zend_std_get_properties_ex
Unexecuted instantiation: ir_cfg.c:zend_std_get_properties_ex
Unexecuted instantiation: ir_check.c:zend_std_get_properties_ex
Unexecuted instantiation: ir_dump.c:zend_std_get_properties_ex
Unexecuted instantiation: ir_emit.c:zend_std_get_properties_ex
Unexecuted instantiation: ir_gcm.c:zend_std_get_properties_ex
Unexecuted instantiation: ir_gdb.c:zend_std_get_properties_ex
Unexecuted instantiation: ir_patch.c:zend_std_get_properties_ex
Unexecuted instantiation: ir_perf.c:zend_std_get_properties_ex
Unexecuted instantiation: ir_ra.c:zend_std_get_properties_ex
Unexecuted instantiation: ir_save.c:zend_std_get_properties_ex
Unexecuted instantiation: ir_sccp.c:zend_std_get_properties_ex
Unexecuted instantiation: ir_strtab.c:zend_std_get_properties_ex
Unexecuted instantiation: ir.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_jit_vm_helpers.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_jit.c:zend_std_get_properties_ex
Unexecuted instantiation: csprng.c:zend_std_get_properties_ex
Unexecuted instantiation: engine_mt19937.c:zend_std_get_properties_ex
Unexecuted instantiation: engine_pcgoneseq128xslrr64.c:zend_std_get_properties_ex
Unexecuted instantiation: engine_secure.c:zend_std_get_properties_ex
Unexecuted instantiation: engine_user.c:zend_std_get_properties_ex
Unexecuted instantiation: engine_xoshiro256starstar.c:zend_std_get_properties_ex
Unexecuted instantiation: gammasection.c:zend_std_get_properties_ex
Unexecuted instantiation: random.c:zend_std_get_properties_ex
Unexecuted instantiation: randomizer.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_utils.c:zend_std_get_properties_ex
Unexecuted instantiation: php_reflection.c:zend_std_get_properties_ex
Unexecuted instantiation: php_spl.c:zend_std_get_properties_ex
Unexecuted instantiation: spl_array.c:zend_std_get_properties_ex
Unexecuted instantiation: spl_directory.c:zend_std_get_properties_ex
Unexecuted instantiation: spl_dllist.c:zend_std_get_properties_ex
Unexecuted instantiation: spl_exceptions.c:zend_std_get_properties_ex
Unexecuted instantiation: spl_fixedarray.c:zend_std_get_properties_ex
Unexecuted instantiation: spl_functions.c:zend_std_get_properties_ex
Unexecuted instantiation: spl_heap.c:zend_std_get_properties_ex
Unexecuted instantiation: spl_iterators.c:zend_std_get_properties_ex
Unexecuted instantiation: spl_observer.c:zend_std_get_properties_ex
Unexecuted instantiation: array.c:zend_std_get_properties_ex
Unexecuted instantiation: assert.c:zend_std_get_properties_ex
Unexecuted instantiation: base64.c:zend_std_get_properties_ex
Unexecuted instantiation: basic_functions.c:zend_std_get_properties_ex
Unexecuted instantiation: browscap.c:zend_std_get_properties_ex
Unexecuted instantiation: crc32_x86.c:zend_std_get_properties_ex
Unexecuted instantiation: crc32.c:zend_std_get_properties_ex
Unexecuted instantiation: credits.c:zend_std_get_properties_ex
Unexecuted instantiation: crypt.c:zend_std_get_properties_ex
Unexecuted instantiation: css.c:zend_std_get_properties_ex
Unexecuted instantiation: datetime.c:zend_std_get_properties_ex
Unexecuted instantiation: dir.c:zend_std_get_properties_ex
Unexecuted instantiation: dl.c:zend_std_get_properties_ex
Unexecuted instantiation: dns.c:zend_std_get_properties_ex
Unexecuted instantiation: exec.c:zend_std_get_properties_ex
Unexecuted instantiation: file.c:zend_std_get_properties_ex
Unexecuted instantiation: filestat.c:zend_std_get_properties_ex
Unexecuted instantiation: filters.c:zend_std_get_properties_ex
Unexecuted instantiation: flock_compat.c:zend_std_get_properties_ex
Unexecuted instantiation: formatted_print.c:zend_std_get_properties_ex
Unexecuted instantiation: fsock.c:zend_std_get_properties_ex
Unexecuted instantiation: ftok.c:zend_std_get_properties_ex
Unexecuted instantiation: ftp_fopen_wrapper.c:zend_std_get_properties_ex
Unexecuted instantiation: head.c:zend_std_get_properties_ex
Unexecuted instantiation: hrtime.c:zend_std_get_properties_ex
Unexecuted instantiation: html.c:zend_std_get_properties_ex
Unexecuted instantiation: http_fopen_wrapper.c:zend_std_get_properties_ex
Unexecuted instantiation: http.c:zend_std_get_properties_ex
Unexecuted instantiation: image.c:zend_std_get_properties_ex
Unexecuted instantiation: incomplete_class.c:zend_std_get_properties_ex
Unexecuted instantiation: info.c:zend_std_get_properties_ex
Unexecuted instantiation: iptc.c:zend_std_get_properties_ex
Unexecuted instantiation: levenshtein.c:zend_std_get_properties_ex
Unexecuted instantiation: link.c:zend_std_get_properties_ex
Unexecuted instantiation: mail.c:zend_std_get_properties_ex
Unexecuted instantiation: math.c:zend_std_get_properties_ex
Unexecuted instantiation: md5.c:zend_std_get_properties_ex
Unexecuted instantiation: metaphone.c:zend_std_get_properties_ex
Unexecuted instantiation: microtime.c:zend_std_get_properties_ex
Unexecuted instantiation: net.c:zend_std_get_properties_ex
Unexecuted instantiation: pack.c:zend_std_get_properties_ex
Unexecuted instantiation: pageinfo.c:zend_std_get_properties_ex
Unexecuted instantiation: password.c:zend_std_get_properties_ex
Unexecuted instantiation: php_fopen_wrapper.c:zend_std_get_properties_ex
Unexecuted instantiation: proc_open.c:zend_std_get_properties_ex
Unexecuted instantiation: quot_print.c:zend_std_get_properties_ex
Unexecuted instantiation: scanf.c:zend_std_get_properties_ex
Unexecuted instantiation: sha1.c:zend_std_get_properties_ex
Unexecuted instantiation: soundex.c:zend_std_get_properties_ex
Unexecuted instantiation: streamsfuncs.c:zend_std_get_properties_ex
Unexecuted instantiation: string.c:zend_std_get_properties_ex
Unexecuted instantiation: strnatcmp.c:zend_std_get_properties_ex
Unexecuted instantiation: syslog.c:zend_std_get_properties_ex
Unexecuted instantiation: type.c:zend_std_get_properties_ex
Unexecuted instantiation: uniqid.c:zend_std_get_properties_ex
Unexecuted instantiation: url_scanner_ex.c:zend_std_get_properties_ex
Unexecuted instantiation: url.c:zend_std_get_properties_ex
Unexecuted instantiation: user_filters.c:zend_std_get_properties_ex
Unexecuted instantiation: uuencode.c:zend_std_get_properties_ex
Unexecuted instantiation: var_unserializer.c:zend_std_get_properties_ex
Unexecuted instantiation: var.c:zend_std_get_properties_ex
Unexecuted instantiation: versioning.c:zend_std_get_properties_ex
Unexecuted instantiation: crypt_sha256.c:zend_std_get_properties_ex
Unexecuted instantiation: crypt_sha512.c:zend_std_get_properties_ex
Unexecuted instantiation: php_crypt_r.c:zend_std_get_properties_ex
Unexecuted instantiation: php_uri.c:zend_std_get_properties_ex
Unexecuted instantiation: php_uri_common.c:zend_std_get_properties_ex
Unexecuted instantiation: uri_parser_rfc3986.c:zend_std_get_properties_ex
Unexecuted instantiation: uri_parser_whatwg.c:zend_std_get_properties_ex
Unexecuted instantiation: uri_parser_php_parse_url.c:zend_std_get_properties_ex
Unexecuted instantiation: explicit_bzero.c:zend_std_get_properties_ex
Unexecuted instantiation: fopen_wrappers.c:zend_std_get_properties_ex
Unexecuted instantiation: getopt.c:zend_std_get_properties_ex
Unexecuted instantiation: main.c:zend_std_get_properties_ex
Unexecuted instantiation: network.c:zend_std_get_properties_ex
Unexecuted instantiation: output.c:zend_std_get_properties_ex
Unexecuted instantiation: php_content_types.c:zend_std_get_properties_ex
Unexecuted instantiation: php_ini_builder.c:zend_std_get_properties_ex
Unexecuted instantiation: php_ini.c:zend_std_get_properties_ex
Unexecuted instantiation: php_glob.c:zend_std_get_properties_ex
Unexecuted instantiation: php_odbc_utils.c:zend_std_get_properties_ex
Unexecuted instantiation: php_open_temporary_file.c:zend_std_get_properties_ex
Unexecuted instantiation: php_scandir.c:zend_std_get_properties_ex
Unexecuted instantiation: php_syslog.c:zend_std_get_properties_ex
Unexecuted instantiation: php_ticks.c:zend_std_get_properties_ex
Unexecuted instantiation: php_variables.c:zend_std_get_properties_ex
Unexecuted instantiation: reentrancy.c:zend_std_get_properties_ex
Unexecuted instantiation: rfc1867.c:zend_std_get_properties_ex
Unexecuted instantiation: safe_bcmp.c:zend_std_get_properties_ex
Unexecuted instantiation: SAPI.c:zend_std_get_properties_ex
Unexecuted instantiation: snprintf.c:zend_std_get_properties_ex
Unexecuted instantiation: spprintf.c:zend_std_get_properties_ex
Unexecuted instantiation: strlcat.c:zend_std_get_properties_ex
Unexecuted instantiation: strlcpy.c:zend_std_get_properties_ex
Unexecuted instantiation: cast.c:zend_std_get_properties_ex
Unexecuted instantiation: filter.c:zend_std_get_properties_ex
Unexecuted instantiation: glob_wrapper.c:zend_std_get_properties_ex
Unexecuted instantiation: memory.c:zend_std_get_properties_ex
Unexecuted instantiation: mmap.c:zend_std_get_properties_ex
Unexecuted instantiation: plain_wrapper.c:zend_std_get_properties_ex
Unexecuted instantiation: stream_errors.c:zend_std_get_properties_ex
Unexecuted instantiation: streams.c:zend_std_get_properties_ex
Unexecuted instantiation: transports.c:zend_std_get_properties_ex
Unexecuted instantiation: userspace.c:zend_std_get_properties_ex
Unexecuted instantiation: xp_socket.c:zend_std_get_properties_ex
Unexecuted instantiation: block_pass.c:zend_std_get_properties_ex
Unexecuted instantiation: compact_literals.c:zend_std_get_properties_ex
Unexecuted instantiation: compact_vars.c:zend_std_get_properties_ex
Unexecuted instantiation: dce.c:zend_std_get_properties_ex
Unexecuted instantiation: dfa_pass.c:zend_std_get_properties_ex
Unexecuted instantiation: escape_analysis.c:zend_std_get_properties_ex
Unexecuted instantiation: nop_removal.c:zend_std_get_properties_ex
Unexecuted instantiation: optimize_func_calls.c:zend_std_get_properties_ex
Unexecuted instantiation: optimize_temp_vars_5.c:zend_std_get_properties_ex
Unexecuted instantiation: pass1.c:zend_std_get_properties_ex
Unexecuted instantiation: pass3.c:zend_std_get_properties_ex
Unexecuted instantiation: sccp.c:zend_std_get_properties_ex
Unexecuted instantiation: scdf.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_call_graph.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_cfg.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_dfg.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_dump.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_func_info.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_inference.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_optimizer.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_ssa.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_alloc.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_API.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_ast.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_attributes.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_autoload.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_builtin_functions.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_call_stack.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_closures.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_compile.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_constants.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_cpuinfo.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_default_classes.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_dtrace.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_enum.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_exceptions.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_execute_API.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_execute.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_extensions.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_fibers.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_float.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_gc.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_gdb.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_generators.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_hash.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_highlight.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_hrtime.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_inheritance.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_ini_parser.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_ini_scanner.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_ini.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_interfaces.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_iterators.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_language_parser.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_language_scanner.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_lazy_objects.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_list.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_llist.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_multibyte.c:zend_std_get_properties_ex
zend_object_handlers.c:zend_std_get_properties_ex
Line
Count
Source
280
5.50k
{
281
5.50k
  if (UNEXPECTED(zend_lazy_object_must_init(object))) {
282
0
    return zend_lazy_object_get_properties(object);
283
0
  }
284
5.50k
  if (!object->properties) {
285
5.03k
    return rebuild_object_properties_internal(object);
286
5.03k
  }
287
472
  return object->properties;
288
5.50k
}
Unexecuted instantiation: zend_objects_API.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_objects.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_observer.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_opcode.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_operators.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_property_hooks.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_ptr_stack.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_signal.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_smart_str.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_sort.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_stack.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_stream.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_string.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_strtod.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_system_id.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_variables.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_virtual_cwd.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_vm_opcodes.c:zend_std_get_properties_ex
Unexecuted instantiation: zend_weakrefs.c:zend_std_get_properties_ex
Unexecuted instantiation: zend.c:zend_std_get_properties_ex
Unexecuted instantiation: internal_functions_cli.c:zend_std_get_properties_ex
Unexecuted instantiation: fuzzer-execute.c:zend_std_get_properties_ex
Unexecuted instantiation: fuzzer-sapi.c:zend_std_get_properties_ex
289
290
/* Implements the fast path for array cast */
291
ZEND_API HashTable *zend_std_build_object_properties_array(zend_object *zobj);
292
293
6
#define ZEND_STD_BUILD_OBJECT_PROPERTIES_ARRAY_COMPATIBLE(object) (            \
294
6
    /* We can use zend_std_build_object_properties_array() for objects     \
295
6
     * without properties ht and with standard handlers */                 \
296
6
    Z_OBJ_P(object)->properties == NULL                                    \
297
6
    && Z_OBJ_HT_P(object)->get_properties_for == NULL                      \
298
6
    && Z_OBJ_HT_P(object)->get_properties == zend_std_get_properties       \
299
6
    /* For initialized proxies we need to forward to the real instance */  \
300
6
    && (                                                                   \
301
1
      !zend_object_is_lazy_proxy(Z_OBJ_P(object))                        \
302
1
      || !zend_lazy_object_initialized(Z_OBJ_P(object))                  \
303
1
    )                                                                      \
304
6
)
305
306
/* Handler for objects that cannot be meaningfully compared.
307
 * Only objects with the same identity will be considered equal. */
308
ZEND_API int zend_objects_not_comparable(zval *o1, zval *o2);
309
310
ZEND_API bool zend_check_protected(const zend_class_entry *ce, const zend_class_entry *scope);
311
312
ZEND_API zend_result zend_check_property_access(const zend_object *zobj, zend_string *prop_info_name, bool is_dynamic);
313
314
ZEND_API ZEND_ATTRIBUTE_NONNULL zend_function *zend_get_call_trampoline_func(const zend_function *fbc, zend_string *method_name);
315
316
ZEND_API uint32_t *zend_get_property_guard(zend_object *zobj, zend_string *member);
317
318
ZEND_API uint32_t *zend_get_recursion_guard(zend_object *zobj);
319
320
/* Default behavior for get_properties_for. For use as a fallback in custom
321
 * get_properties_for implementations. */
322
ZEND_API HashTable *zend_std_get_properties_for(zend_object *obj, zend_prop_purpose purpose);
323
324
/* Will call get_properties_for handler or use default behavior. For use by
325
 * consumers of the get_properties_for API. */
326
ZEND_API HashTable *zend_get_properties_for(zval *obj, zend_prop_purpose purpose);
327
328
typedef struct _zend_property_info zend_property_info;
329
330
ZEND_API zend_function *zend_get_property_hook_trampoline(
331
  const zend_property_info *prop_info,
332
  zend_property_hook_kind kind, zend_string *prop_name);
333
334
ZEND_API bool ZEND_FASTCALL zend_asymmetric_property_has_set_access(const zend_property_info *prop_info);
335
336
void zend_object_handlers_startup(void);
337
338
311
#define zend_release_properties(ht) do { \
339
311
  if (ht) { \
340
311
    zend_array_release(ht); \
341
311
  } \
342
311
} while (0)
343
344
1.39k
#define zend_free_trampoline(func) do { \
345
1.39k
    if ((func) == &EG(trampoline)) { \
346
38
      EG(trampoline).common.attributes = NULL; \
347
38
      EG(trampoline).common.function_name = NULL; \
348
1.35k
    } else { \
349
1.35k
      efree(func); \
350
1.35k
    } \
351
1.39k
  } while (0)
352
353
/* Fallback to default comparison implementation if the arguments aren't both objects
354
 * and have the same compare() handler. You'll likely want to use this unless you
355
 * explicitly wish to support comparisons between objects and non-objects. */
356
#define ZEND_COMPARE_OBJECTS_FALLBACK(op1, op2) \
357
1
  if (Z_TYPE_P(op1) != IS_OBJECT || \
358
1
      Z_TYPE_P(op2) != IS_OBJECT || \
359
1
      Z_OBJ_HT_P(op1)->compare != Z_OBJ_HT_P(op2)->compare) { \
360
1
    return zend_std_compare_objects(op1, op2); \
361
1
  }
362
363
END_EXTERN_C()
364
365
#endif