php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
xpath_callbacks.c
Go to the documentation of this file.
1/*
2 +----------------------------------------------------------------------+
3 | Copyright (c) The PHP Group |
4 +----------------------------------------------------------------------+
5 | This source file is subject to version 3.01 of the PHP license, |
6 | that is bundled with this package in the file LICENSE, and is |
7 | available through the world-wide-web at the following url: |
8 | https://www.php.net/license/3_01.txt |
9 | If you did not receive a copy of the PHP license and are unable to |
10 | obtain it through the world-wide-web, please send a note to |
11 | license@php.net so we can mail you a copy immediately. |
12 +----------------------------------------------------------------------+
13 | Authors: Christian Stocker <chregu@php.net> |
14 | Rob Richards <rrichards@php.net> |
15 | Niels Dossche <nielsdos@php.net> |
16 +----------------------------------------------------------------------+
17 */
18
19#ifdef HAVE_CONFIG_H
20#include <config.h>
21#endif
22
23#include "php.h"
24#if defined(HAVE_LIBXML) && defined(HAVE_DOM)
25
26#include "php_dom.h"
27#include "internal_helpers.h"
28#include <libxml/parserInternals.h>
29
30static void xpath_callbacks_entry_dtor(zval *zv)
31{
33 zend_fcc_dtor(fcc);
34 efree(fcc);
35}
36
37PHP_DOM_EXPORT void php_dom_xpath_callback_ns_ctor(php_dom_xpath_callback_ns *ns)
38{
39 zend_hash_init(&ns->functions, 0, NULL, xpath_callbacks_entry_dtor, false);
41}
42
43PHP_DOM_EXPORT void php_dom_xpath_callback_ns_dtor(php_dom_xpath_callback_ns *ns)
44{
46}
47
49{
50 registry->php_ns = NULL;
51 registry->namespaces = NULL;
52 registry->node_list = NULL;
53}
54
56{
57 if (registry->node_list) {
58 zend_hash_destroy(registry->node_list);
59 FREE_HASHTABLE(registry->node_list);
60 registry->node_list = NULL;
61 }
62}
63
64PHP_DOM_EXPORT void php_dom_xpath_callbacks_clean_argument_stack(xmlXPathParserContextPtr ctxt, uint32_t num_args)
65{
66 for (uint32_t i = 0; i < num_args; i++) {
67 xmlXPathObjectPtr obj = valuePop(ctxt);
68 xmlXPathFreeObject(obj);
69 }
70
71 /* Don't push a sentinel value here. If this is called from an error situation, then by *not* pushing a sentinel
72 * the execution will halt. If this is called from a regular situation, then it is the caller's responsibility
73 * to ensure the stack remains balanced. */
74}
75
77{
78 if (registry->php_ns) {
79 php_dom_xpath_callback_ns_dtor(registry->php_ns);
80 efree(registry->php_ns);
81 }
82 if (registry->namespaces) {
84 ZEND_HASH_MAP_FOREACH_PTR(registry->namespaces, ns) {
85 php_dom_xpath_callback_ns_dtor(ns);
86 efree(ns);
88
89 zend_hash_destroy(registry->namespaces);
90 FREE_HASHTABLE(registry->namespaces);
91 }
93}
94
95static void php_dom_xpath_callback_ns_get_gc(php_dom_xpath_callback_ns *ns, zend_get_gc_buffer *gc_buffer)
96{
99 zend_get_gc_buffer_add_fcc(gc_buffer, entry);
101}
102
104{
105 if (registry->php_ns) {
106 php_dom_xpath_callback_ns_get_gc(registry->php_ns, gc_buffer);
107 }
108 if (registry->namespaces) {
110 ZEND_HASH_MAP_FOREACH_PTR(registry->namespaces, ns) {
111 php_dom_xpath_callback_ns_get_gc(ns, gc_buffer);
113 }
114}
115
117{
118 if (registry->php_ns || registry->namespaces) {
121 zend_get_gc_buffer_use(gc_buffer, table, n);
122
123 if (object->properties == NULL && object->ce->default_properties_count == 0) {
124 return NULL;
125 } else {
126 return zend_std_get_properties(object);
127 }
128 } else {
129 return zend_std_get_gc(object, table, n);
130 }
131}
132
133static bool php_dom_xpath_is_callback_name_valid(const zend_string *name, php_dom_xpath_callback_name_validation name_validation)
134{
135 if (ZSTR_LEN(name) == 0) {
136 return false;
137 }
138
140 if (zend_str_has_nul_byte(name)) {
141 return false;
142 }
143 }
144
145 if (name_validation == PHP_DOM_XPATH_CALLBACK_NAME_VALIDATE_NCNAME) {
146 if (xmlValidateNCName(BAD_CAST ZSTR_VAL(name), /* pass 0 to disallow spaces */ 0) != 0) {
147 return false;
148 }
149 }
150
151 return true;
152}
153
154static bool php_dom_xpath_is_callback_name_valid_and_throw(const zend_string *name, php_dom_xpath_callback_name_validation name_validation, bool is_array)
155{
156 if (!php_dom_xpath_is_callback_name_valid(name, name_validation)) {
157 if (is_array) {
158 zend_argument_value_error(1, "must be an array containing valid callback names");
159 } else {
160 zend_argument_value_error(2, "must be a valid callback name");
161 }
162 return false;
163 }
164 return true;
165}
166
168{
169 if (registry->namespaces) {
170 zend_string *namespace;
172 ZEND_HASH_MAP_FOREACH_STR_KEY_PTR(registry->namespaces, namespace, ns) {
175 register_func(ctxt, namespace, name);
178 }
179}
180
181static zend_result php_dom_xpath_callback_ns_update_method_handler(
183 xmlXPathContextPtr ctxt,
184 const zend_string *namespace,
186 const HashTable *callable_ht,
189)
190{
191 zval *entry, registered_value;
192
193 if (callable_ht) {
195 ZEND_HASH_FOREACH_STR_KEY_VAL(callable_ht, key, entry) {
196 zend_fcall_info_cache* fcc = emalloc(sizeof(*fcc));
197 char *error;
198 if (!zend_is_callable_ex(entry, NULL, 0, NULL, fcc, &error)) {
199 zend_argument_type_error(1, "must be an array with valid callbacks as values, %s", error);
200 efree(fcc);
201 efree(error);
202 return FAILURE;
203 }
204
205 zend_fcc_addref(fcc);
206 ZVAL_PTR(&registered_value, fcc);
207
208 if (!key) {
209 zend_string *str = zval_try_get_string(entry);
210 if (str && php_dom_xpath_is_callback_name_valid_and_throw(str, name_validation, true)) {
211 zend_hash_update(&ns->functions, str, &registered_value);
212 if (register_func) {
213 register_func(ctxt, namespace, str);
214 }
215 zend_string_release_ex(str, false);
216 } else {
217 zend_fcc_dtor(fcc);
218 efree(fcc);
219 return FAILURE;
220 }
221 } else {
222 if (!php_dom_xpath_is_callback_name_valid_and_throw(key, name_validation, true)) {
223 zend_fcc_dtor(fcc);
224 efree(fcc);
225 return FAILURE;
226 }
227 zend_hash_update(&ns->functions, key, &registered_value);
228 if (register_func) {
229 register_func(ctxt, namespace, key);
230 }
231 }
234 } else if (name) {
235 if (!php_dom_xpath_is_callback_name_valid(name, name_validation)) {
236 zend_argument_value_error(1, "must be a valid callback name");
237 return FAILURE;
238 }
239 zend_fcall_info_cache* fcc = emalloc(sizeof(*fcc));
240 char *error;
241 zval tmp;
242 ZVAL_STR(&tmp, name);
243 if (!zend_is_callable_ex(&tmp, NULL, 0, NULL, fcc, &error)) {
244 zend_argument_type_error(1, "must be a callable, %s", error);
245 efree(fcc);
246 efree(error);
247 return FAILURE;
248 }
249 zend_fcc_addref(fcc);
250 ZVAL_PTR(&registered_value, fcc);
251 zend_hash_update(&ns->functions, name, &registered_value);
252 if (register_func) {
253 register_func(ctxt, namespace, name);
254 }
256 } else {
258 }
259
260 return SUCCESS;
261}
262
263static php_dom_xpath_callback_ns *php_dom_xpath_callbacks_ensure_ns(php_dom_xpath_callbacks *registry, zend_string *ns)
264{
265 if (ns == NULL) {
266 if (!registry->php_ns) {
267 registry->php_ns = emalloc(sizeof(*registry->php_ns));
268 php_dom_xpath_callback_ns_ctor(registry->php_ns);
269 }
270 return registry->php_ns;
271 } else {
272 if (!registry->namespaces) {
273 /* In most cases probably only a single namespace is registered. */
274 registry->namespaces = zend_new_array(1);
275 }
276 php_dom_xpath_callback_ns *namespace = zend_hash_find_ptr(registry->namespaces, ns);
277 if (namespace == NULL) {
278 namespace = emalloc(sizeof(*namespace));
279 php_dom_xpath_callback_ns_ctor(namespace);
280 zend_hash_add_new_ptr(registry->namespaces, ns, namespace);
281 }
282 return namespace;
283 }
284}
285
287{
288 php_dom_xpath_callback_ns *namespace = php_dom_xpath_callbacks_ensure_ns(registry, ns);
289 return php_dom_xpath_callback_ns_update_method_handler(namespace, ctxt, ns, name, callable_ht, name_validation, register_func);
290}
291
293{
294 if (!php_dom_xpath_is_callback_name_valid_and_throw(name, name_validation, false)) {
295 return FAILURE;
296 }
297
298 php_dom_xpath_callback_ns *namespace = php_dom_xpath_callbacks_ensure_ns(registry, ns);
299 zend_fcall_info_cache* allocated_fcc = emalloc(sizeof(*allocated_fcc));
300 zend_fcc_dup(allocated_fcc, fcc);
301
302 zval registered_value;
303 ZVAL_PTR(&registered_value, allocated_fcc);
304
305 zend_hash_update(&namespace->functions, name, &registered_value);
306 if (register_func) {
307 register_func(ctxt, ns, name);
308 }
309
310 namespace->mode = PHP_DOM_REG_FUNC_MODE_SET;
311
312 return SUCCESS;
313}
314
315static zval *php_dom_xpath_callback_fetch_args(xmlXPathParserContextPtr ctxt, uint32_t param_count, php_dom_xpath_nodeset_evaluation_mode evaluation_mode, dom_object *intern, php_dom_xpath_callbacks_proxy_factory proxy_factory)
316{
317 if (param_count == 0) {
318 return NULL;
319 }
320
321 zval *params = safe_emalloc(param_count, sizeof(zval), 0);
322
323 /* Reverse order to pop values off ctxt stack */
324 for (zval *param = params + param_count - 1; param >= params; param--) {
325 xmlXPathObjectPtr obj = valuePop(ctxt);
326 ZEND_ASSERT(obj != NULL);
327 switch (obj->type) {
328 case XPATH_STRING:
329 ZVAL_STRING(param, (char *)obj->stringval);
330 break;
331 case XPATH_BOOLEAN:
332 ZVAL_BOOL(param, obj->boolval);
333 break;
334 case XPATH_NUMBER:
335 ZVAL_DOUBLE(param, obj->floatval);
336 break;
337 case XPATH_NODESET:
338 if (evaluation_mode == PHP_DOM_XPATH_EVALUATE_NODESET_TO_STRING) {
339 char *str = (char *)xmlXPathCastToString(obj);
340 ZVAL_STRING(param, str);
341 xmlFree(str);
342 } else if (evaluation_mode == PHP_DOM_XPATH_EVALUATE_NODESET_TO_NODESET) {
343 if (obj->nodesetval && obj->nodesetval->nodeNr > 0) {
344 array_init_size(param, obj->nodesetval->nodeNr);
346 for (int j = 0; j < obj->nodesetval->nodeNr; j++) {
347 xmlNodePtr node = obj->nodesetval->nodeTab[j];
348 zval child;
349 if (UNEXPECTED(node->type == XML_NAMESPACE_DECL)) {
350 xmlNodePtr nsparent = node->_private;
351 xmlNsPtr original = (xmlNsPtr) node;
352
353 /* Make sure parent dom object exists, so we can take an extra reference. */
354 zval parent_zval; /* don't destroy me, my lifetime is transfered to the fake namespace decl */
355 php_dom_create_object(nsparent, &parent_zval, intern);
356 dom_object *parent_intern = Z_DOMOBJ_P(&parent_zval);
357
358 php_dom_create_fake_namespace_decl(nsparent, original, &child, parent_intern);
359 } else {
360 proxy_factory(node, &child, intern, ctxt);
361 }
363 }
364 } else {
365 ZVAL_EMPTY_ARRAY(param);
366 }
367 }
368 break;
369 default: {
370 char *str = (char *)xmlXPathCastToString(obj);
371 ZVAL_STRING(param, str);
372 xmlFree(str);
373 break;
374 }
375 }
376 xmlXPathFreeObject(obj);
377 }
378
379 return params;
380}
381
382static void php_dom_xpath_callback_cleanup_args(zval *params, uint32_t param_count)
383{
384 if (params) {
385 for (uint32_t i = 0; i < param_count; i++) {
386 zval_ptr_dtor(&params[i]);
387 }
388 efree(params);
389 }
390}
391
392static zend_result php_dom_xpath_callback_dispatch(php_dom_xpath_callbacks *xpath_callbacks, php_dom_xpath_callback_ns *ns, xmlXPathParserContextPtr ctxt, zval *params, uint32_t param_count, const char *function_name, size_t function_name_length)
393{
394 zval callback_retval;
395
396 if (UNEXPECTED(ns == NULL)) {
397 zend_throw_error(NULL, "No callbacks were registered");
398 return FAILURE;
399 }
400
401 if (ns->mode == PHP_DOM_REG_FUNC_MODE_ALL) {
402 zend_fcall_info fci;
403 fci.size = sizeof(fci);
404 fci.object = NULL;
405 fci.retval = &callback_retval;
406 fci.param_count = param_count;
407 fci.params = params;
408 fci.named_params = NULL;
409 ZVAL_STRINGL(&fci.function_name, function_name, function_name_length);
410
413 if (UNEXPECTED(EG(exception))) {
414 return FAILURE;
415 }
416 } else {
418
419 zval *fcc_wrapper = zend_hash_str_find(&ns->functions, function_name, function_name_length);
420 if (fcc_wrapper) {
421 zend_call_known_fcc(Z_PTR_P(fcc_wrapper), &callback_retval, param_count, params, NULL);
422 } else {
423 zend_throw_error(NULL, "No callback handler \"%s\" registered", function_name);
424 return FAILURE;
425 }
426 }
427
428 if (Z_TYPE(callback_retval) != IS_UNDEF) {
429 if (Z_TYPE(callback_retval) == IS_OBJECT
430 && (instanceof_function(Z_OBJCE(callback_retval), dom_get_node_ce(php_dom_follow_spec_node((const xmlNode *) ctxt->context->doc))))) {
431 xmlNode *nodep;
432 dom_object *obj;
433 if (xpath_callbacks->node_list == NULL) {
434 xpath_callbacks->node_list = zend_new_array(0);
435 }
436 Z_ADDREF_P(&callback_retval);
437 zend_hash_next_index_insert_new(xpath_callbacks->node_list, &callback_retval);
438 obj = Z_DOMOBJ_P(&callback_retval);
439 nodep = dom_object_get_node(obj);
440 valuePush(ctxt, xmlXPathNewNodeSet(nodep));
441 } else if (Z_TYPE(callback_retval) == IS_FALSE || Z_TYPE(callback_retval) == IS_TRUE) {
442 valuePush(ctxt, xmlXPathNewBoolean(Z_TYPE(callback_retval) == IS_TRUE));
443 } else if (Z_TYPE(callback_retval) == IS_OBJECT) {
444 zend_type_error("Only objects that are instances of DOM nodes can be converted to an XPath expression");
445 zval_ptr_dtor(&callback_retval);
446 return FAILURE;
447 } else {
448 zend_string *str = zval_get_string(&callback_retval);
449 valuePush(ctxt, xmlXPathNewString(BAD_CAST ZSTR_VAL(str)));
451 }
452 zval_ptr_dtor(&callback_retval);
453 }
454
455 return SUCCESS;
456}
457
459{
461
462 if (UNEXPECTED(num_args == 0)) {
463 zend_throw_error(NULL, "Function name must be passed as the first argument");
464 goto cleanup_no_obj;
465 }
466
467 uint32_t param_count = num_args - 1;
468 zval *params = php_dom_xpath_callback_fetch_args(ctxt, param_count, evaluation_mode, intern, proxy_factory);
469
470 /* Last element of the stack is the function name */
471 xmlXPathObjectPtr obj = valuePop(ctxt);
472 if (UNEXPECTED(obj->stringval == NULL)) {
473 zend_type_error("Handler name must be a string");
474 goto cleanup;
475 }
476
477 const char *function_name = (const char *) obj->stringval;
478 size_t function_name_length = strlen(function_name);
479
480 result = php_dom_xpath_callback_dispatch(xpath_callbacks, xpath_callbacks->php_ns, ctxt, params, param_count, function_name, function_name_length);
481
482cleanup:
483 xmlXPathFreeObject(obj);
484 php_dom_xpath_callback_cleanup_args(params, param_count);
485cleanup_no_obj:
486 if (UNEXPECTED(result != SUCCESS)) {
487 /* Push sentinel value */
488 valuePush(ctxt, xmlXPathNewString((const xmlChar *) ""));
489 }
490
491 return result;
492}
493
495{
496 uint32_t param_count = num_args;
497 zval *params = php_dom_xpath_callback_fetch_args(ctxt, param_count, evaluation_mode, intern, proxy_factory);
498
499 const char *namespace = (const char *) ctxt->context->functionURI;
500 /* Impossible because it wouldn't have been registered inside the context. */
501 ZEND_ASSERT(xpath_callbacks->namespaces != NULL);
502
503 php_dom_xpath_callback_ns *ns = zend_hash_str_find_ptr(xpath_callbacks->namespaces, namespace, strlen(namespace));
504 /* Impossible because it wouldn't have been registered inside the context. */
505 ZEND_ASSERT(ns != NULL);
506
507 const char *function_name = (const char *) ctxt->context->function;
508 size_t function_name_length = strlen(function_name);
509
510 zend_result result = php_dom_xpath_callback_dispatch(xpath_callbacks, ns, ctxt, params, param_count, function_name, function_name_length);
511
512 php_dom_xpath_callback_cleanup_args(params, param_count);
513 if (UNEXPECTED(result != SUCCESS)) {
514 /* Push sentinel value */
515 valuePush(ctxt, xmlXPathNewString((const xmlChar *) ""));
516 }
517
518 return result;
519}
520
521#endif
bool exception
Definition assert.c:30
sizeof(Countable|array $value, int $mode=COUNT_NORMAL)
is_array(mixed $value)
error($message)
Definition ext_skel.php:22
zval * zv
Definition ffi.c:3975
zend_long n
Definition ffi.c:4979
#define NULL
Definition gdcache.h:45
#define SUCCESS
Definition hash_sha3.c:261
again j
#define registry(L)
Definition minilua.c:416
xmlNodePtr php_dom_create_fake_namespace_decl(xmlNodePtr nodep, xmlNsPtr original, zval *return_value, dom_object *parent_intern)
unsigned char key[REFLECTION_KEY_LEN]
HashTable * named_params
Definition zend_API.h:56
uint32_t param_count
Definition zend_API.h:51
zend_object * object
Definition zend_API.h:50
php_dom_register_functions_mode mode
php_dom_xpath_callback_ns * php_ns
#define PHP_DOM_EXPORT
Definition xml_common.h:51
PHP_DOM_EXPORT xmlNodePtr dom_object_get_node(dom_object *obj)
struct _dom_object dom_object
#define Z_DOMOBJ_P(zv)
Definition xml_common.h:36
PHP_DOM_EXPORT bool php_dom_create_object(xmlNodePtr obj, zval *return_value, dom_object *domobj)
PHP_DOM_EXPORT void php_dom_xpath_callbacks_clean_argument_stack(xmlXPathParserContextPtr ctxt, uint32_t num_args)
PHP_DOM_EXPORT zend_result php_dom_xpath_callbacks_update_method_handler(php_dom_xpath_callbacks *registry, xmlXPathContextPtr ctxt, zend_string *ns, zend_string *name, const HashTable *callable_ht, php_dom_xpath_callback_name_validation name_validation, php_dom_xpath_callbacks_register_func_ctx register_func)
@ PHP_DOM_REG_FUNC_MODE_SET
@ PHP_DOM_REG_FUNC_MODE_ALL
@ PHP_DOM_REG_FUNC_MODE_NONE
PHP_DOM_EXPORT zend_result php_dom_xpath_callbacks_call_custom_ns(php_dom_xpath_callbacks *xpath_callbacks, xmlXPathParserContextPtr ctxt, int num_args, php_dom_xpath_nodeset_evaluation_mode evaluation_mode, dom_object *intern, php_dom_xpath_callbacks_proxy_factory proxy_factory)
PHP_DOM_EXPORT void php_dom_xpath_callbacks_dtor(php_dom_xpath_callbacks *registry)
PHP_DOM_EXPORT zend_result php_dom_xpath_callbacks_call_php_ns(php_dom_xpath_callbacks *xpath_callbacks, xmlXPathParserContextPtr ctxt, int num_args, php_dom_xpath_nodeset_evaluation_mode evaluation_mode, dom_object *intern, php_dom_xpath_callbacks_proxy_factory proxy_factory)
void(* php_dom_xpath_callbacks_register_func_ctx)(void *ctxt, const zend_string *ns, const zend_string *name)
void(* php_dom_xpath_callbacks_proxy_factory)(xmlNodePtr node, zval *proxy, dom_object *intern, xmlXPathParserContextPtr ctxt)
PHP_DOM_EXPORT void php_dom_xpath_callbacks_ctor(php_dom_xpath_callbacks *registry)
PHP_DOM_EXPORT void php_dom_xpath_callbacks_clean_node_list(php_dom_xpath_callbacks *registry)
php_dom_xpath_callback_name_validation
@ PHP_DOM_XPATH_CALLBACK_NAME_VALIDATE_NCNAME
@ PHP_DOM_XPATH_CALLBACK_NAME_VALIDATE_NULLS
php_dom_xpath_nodeset_evaluation_mode
@ PHP_DOM_XPATH_EVALUATE_NODESET_TO_STRING
@ PHP_DOM_XPATH_EVALUATE_NODESET_TO_NODESET
PHP_DOM_EXPORT HashTable * php_dom_xpath_callbacks_get_gc_for_whole_object(php_dom_xpath_callbacks *registry, zend_object *object, zval **table, int *n)
PHP_DOM_EXPORT zend_result php_dom_xpath_callbacks_update_single_method_handler(php_dom_xpath_callbacks *registry, xmlXPathContextPtr ctxt, zend_string *ns, zend_string *name, const zend_fcall_info_cache *fcc, php_dom_xpath_callback_name_validation name_validation, php_dom_xpath_callbacks_register_func_ctx register_func)
PHP_DOM_EXPORT void php_dom_xpath_callbacks_get_gc(php_dom_xpath_callbacks *registry, zend_get_gc_buffer *gc_buffer)
PHP_DOM_EXPORT void php_dom_xpath_callbacks_delayed_lib_registration(const php_dom_xpath_callbacks *registry, void *ctxt, php_dom_xpath_callbacks_register_func_ctx register_func)
ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format,...)
Definition zend.c:1772
ZEND_API ZEND_COLD void zend_type_error(const char *format,...)
Definition zend.c:1824
ZEND_API bool zend_is_callable_ex(zval *callable, zend_object *object, uint32_t check_flags, zend_string **callable_name, zend_fcall_info_cache *fcc, char **error)
Definition zend_API.c:4271
ZEND_API ZEND_COLD void zend_argument_value_error(uint32_t arg_num, const char *format,...)
Definition zend_API.c:433
ZEND_API ZEND_COLD void zend_argument_type_error(uint32_t arg_num, const char *format,...)
Definition zend_API.c:423
struct _zend_fcall_info_cache zend_fcall_info_cache
#define ZVAL_STRING(z, s)
Definition zend_API.h:956
#define array_init_size(arg, size)
Definition zend_API.h:538
struct _zend_fcall_info zend_fcall_info
#define ZVAL_STRINGL(z, s, l)
Definition zend_API.h:952
ZEND_API zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache)
#define efree(ptr)
Definition zend_alloc.h:155
#define FREE_HASHTABLE(ht)
Definition zend_alloc.h:234
#define safe_emalloc(nmemb, size, offset)
Definition zend_alloc.h:154
#define emalloc(size)
Definition zend_alloc.h:151
struct _zval_struct zval
strlen(string $string)
uint32_t num_args
zend_string_release_ex(func->internal_function.function_name, 0)
ZEND_API zend_get_gc_buffer * zend_get_gc_buffer_create(void)
Definition zend_gc.c:2130
#define EG(v)
ZEND_API void ZEND_FASTCALL zend_hash_destroy(HashTable *ht)
Definition zend_hash.c:1727
ZEND_API void ZEND_FASTCALL zend_hash_real_init_packed(HashTable *ht)
Definition zend_hash.c:330
ZEND_API zval *ZEND_FASTCALL zend_hash_str_find(const HashTable *ht, const char *str, size_t len)
Definition zend_hash.c:2689
ZEND_API zval *ZEND_FASTCALL zend_hash_next_index_insert_new(HashTable *ht, zval *pData)
Definition zend_hash.c:1229
ZEND_API zval *ZEND_FASTCALL zend_hash_update(HashTable *ht, zend_string *key, zval *pData)
Definition zend_hash.c:997
#define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent)
Definition zend_hash.h:108
#define ZEND_HASH_MAP_FOREACH_PTR(ht, _ptr)
Definition zend_hash.h:1326
#define zend_new_array(size)
Definition zend_hash.h:338
#define ZEND_HASH_FOREACH_STR_KEY_VAL(ht, _key, _val)
Definition zend_hash.h:1166
#define ZEND_HASH_MAP_FOREACH_STR_KEY(ht, _key)
Definition zend_hash.h:1346
#define ZEND_HASH_MAP_FOREACH_STR_KEY_PTR(ht, _key, _ptr)
Definition zend_hash.h:1433
#define ZEND_HASH_FOREACH_END()
Definition zend_hash.h:1086
#define ZVAL_EMPTY_ARRAY(z)
Definition zend_hash.h:87
struct _zend_string zend_string
ZEND_API HashTable * zend_std_get_properties(zend_object *zobj)
ZEND_API HashTable * zend_std_get_gc(zend_object *zobj, zval **table, int *n)
#define ZEND_ASSERT(c)
#define UNEXPECTED(condition)
struct _zend_object zend_object
#define ZSTR_VAL(zstr)
Definition zend_string.h:68
#define ZSTR_LEN(zstr)
Definition zend_string.h:69
#define IS_TRUE
Definition zend_types.h:603
#define ZVAL_STR(z, s)
#define IS_FALSE
Definition zend_types.h:602
#define IS_UNDEF
Definition zend_types.h:600
#define Z_ARRVAL_P(zval_p)
Definition zend_types.h:987
struct _zend_array HashTable
Definition zend_types.h:386
#define Z_PTR_P(zval_p)
#define Z_STR(zval)
Definition zend_types.h:971
#define Z_ADDREF_P(pz)
@ FAILURE
Definition zend_types.h:61
#define IS_OBJECT
Definition zend_types.h:608
#define ZVAL_PTR(z, p)
#define ZVAL_DOUBLE(z, d)
ZEND_RESULT_CODE zend_result
Definition zend_types.h:64
#define Z_TYPE(zval)
Definition zend_types.h:659
#define ZVAL_BOOL(z, b)
#define Z_OBJCE(zval)
ZEND_API void zval_ptr_dtor(zval *zval_ptr)
zend_string * name
bool result
object