php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
php_spl.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: Marcus Boerger <helly@php.net> |
14 +----------------------------------------------------------------------+
15 */
16
17#ifdef HAVE_CONFIG_H
18#include <config.h>
19#endif
20
21#include "php.h"
22#include "php_main.h"
23#include "ext/standard/info.h"
24#include "php_spl.h"
25#include "php_spl_arginfo.h"
26#include "spl_functions.h"
27#include "spl_array.h"
28#include "spl_directory.h"
29#include "spl_iterators.h"
30#include "spl_exceptions.h"
31#include "spl_observer.h"
32#include "spl_dllist.h"
33#include "spl_fixedarray.h"
34#include "spl_heap.h"
35#include "zend_exceptions.h"
36#include "zend_interfaces.h"
37#include "main/snprintf.h"
38
41
42#define SPL_DEFAULT_FILE_EXTENSIONS ".inc,.php"
43
44static zend_class_entry * spl_find_ce_by_name(zend_string *name, bool autoload)
45{
47
48 if (!autoload) {
49 zend_string *lc_name = zend_string_tolower(name);
50
51 ce = zend_hash_find_ptr(EG(class_table), lc_name);
52 zend_string_release(lc_name);
53 } else {
55 }
56 if (ce == NULL) {
57 php_error_docref(NULL, E_WARNING, "Class %s does not exist%s", ZSTR_VAL(name), autoload ? " and could not be loaded" : "");
58 return NULL;
59 }
60
61 return ce;
62}
63
64/* {{{ Return an array containing the names of all parent classes */
66{
67 zval *obj;
68 zend_class_entry *parent_class, *ce;
69 bool autoload = 1;
70
71 /* We do not use Z_PARAM_OBJ_OR_STR here to be able to exclude int, float, and bool which are bogus class names */
72 if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &obj, &autoload) == FAILURE) {
74 }
75
76 if (Z_TYPE_P(obj) != IS_OBJECT && Z_TYPE_P(obj) != IS_STRING) {
77 zend_argument_type_error(1, "must be of type object|string, %s given", zend_zval_value_name(obj));
79 }
80
81 if (Z_TYPE_P(obj) == IS_STRING) {
82 if (NULL == (ce = spl_find_ce_by_name(Z_STR_P(obj), autoload))) {
84 }
85 } else {
86 ce = Z_OBJCE_P(obj);
87 }
88
90 parent_class = ce->parent;
91 while (parent_class) {
92 spl_add_class_name(return_value, parent_class, 0, 0);
93 parent_class = parent_class->parent;
94 }
95}
96/* }}} */
97
98/* {{{ Return all classes and interfaces implemented by SPL */
100{
101 zval *obj;
102 bool autoload = 1;
104
105 /* We do not use Z_PARAM_OBJ_OR_STR here to be able to exclude int, float, and bool which are bogus class names */
106 if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &obj, &autoload) == FAILURE) {
108 }
109 if (Z_TYPE_P(obj) != IS_OBJECT && Z_TYPE_P(obj) != IS_STRING) {
110 zend_argument_type_error(1, "must be of type object|string, %s given", zend_zval_value_name(obj));
112 }
113
114 if (Z_TYPE_P(obj) == IS_STRING) {
115 if (NULL == (ce = spl_find_ce_by_name(Z_STR_P(obj), autoload))) {
117 }
118 } else {
119 ce = Z_OBJCE_P(obj);
120 }
121
124}
125/* }}} */
126
127/* {{{ Return all traits used by a class. */
129{
130 zval *obj;
131 bool autoload = 1;
133
134 /* We do not use Z_PARAM_OBJ_OR_STR here to be able to exclude int, float, and bool which are bogus class names */
135 if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &obj, &autoload) == FAILURE) {
137 }
138 if (Z_TYPE_P(obj) != IS_OBJECT && Z_TYPE_P(obj) != IS_STRING) {
139 zend_argument_type_error(1, "must be of type object|string, %s given", zend_zval_value_name(obj));
141 }
142
143 if (Z_TYPE_P(obj) == IS_STRING) {
144 if (NULL == (ce = spl_find_ce_by_name(Z_STR_P(obj), autoload))) {
146 }
147 } else {
148 ce = Z_OBJCE_P(obj);
149 }
150
153}
154/* }}} */
155
156#define SPL_ADD_CLASS(class_name, z_list, sub, allow, ce_flags) \
157 spl_add_classes(spl_ce_ ## class_name, z_list, sub, allow, ce_flags)
158
159#define SPL_LIST_CLASSES(z_list, sub, allow, ce_flags) \
160 SPL_ADD_CLASS(AppendIterator, z_list, sub, allow, ce_flags); \
161 SPL_ADD_CLASS(ArrayIterator, z_list, sub, allow, ce_flags); \
162 SPL_ADD_CLASS(ArrayObject, z_list, sub, allow, ce_flags); \
163 SPL_ADD_CLASS(BadFunctionCallException, z_list, sub, allow, ce_flags); \
164 SPL_ADD_CLASS(BadMethodCallException, z_list, sub, allow, ce_flags); \
165 SPL_ADD_CLASS(CachingIterator, z_list, sub, allow, ce_flags); \
166 SPL_ADD_CLASS(CallbackFilterIterator, z_list, sub, allow, ce_flags); \
167 SPL_ADD_CLASS(DirectoryIterator, z_list, sub, allow, ce_flags); \
168 SPL_ADD_CLASS(DomainException, z_list, sub, allow, ce_flags); \
169 SPL_ADD_CLASS(EmptyIterator, z_list, sub, allow, ce_flags); \
170 SPL_ADD_CLASS(FilesystemIterator, z_list, sub, allow, ce_flags); \
171 SPL_ADD_CLASS(FilterIterator, z_list, sub, allow, ce_flags); \
172 SPL_ADD_CLASS(GlobIterator, z_list, sub, allow, ce_flags); \
173 SPL_ADD_CLASS(InfiniteIterator, z_list, sub, allow, ce_flags); \
174 SPL_ADD_CLASS(InvalidArgumentException, z_list, sub, allow, ce_flags); \
175 SPL_ADD_CLASS(IteratorIterator, z_list, sub, allow, ce_flags); \
176 SPL_ADD_CLASS(LengthException, z_list, sub, allow, ce_flags); \
177 SPL_ADD_CLASS(LimitIterator, z_list, sub, allow, ce_flags); \
178 SPL_ADD_CLASS(LogicException, z_list, sub, allow, ce_flags); \
179 SPL_ADD_CLASS(MultipleIterator, z_list, sub, allow, ce_flags); \
180 SPL_ADD_CLASS(NoRewindIterator, z_list, sub, allow, ce_flags); \
181 SPL_ADD_CLASS(OuterIterator, z_list, sub, allow, ce_flags); \
182 SPL_ADD_CLASS(OutOfBoundsException, z_list, sub, allow, ce_flags); \
183 SPL_ADD_CLASS(OutOfRangeException, z_list, sub, allow, ce_flags); \
184 SPL_ADD_CLASS(OverflowException, z_list, sub, allow, ce_flags); \
185 SPL_ADD_CLASS(ParentIterator, z_list, sub, allow, ce_flags); \
186 SPL_ADD_CLASS(RangeException, z_list, sub, allow, ce_flags); \
187 SPL_ADD_CLASS(RecursiveArrayIterator, z_list, sub, allow, ce_flags); \
188 SPL_ADD_CLASS(RecursiveCachingIterator, z_list, sub, allow, ce_flags); \
189 SPL_ADD_CLASS(RecursiveCallbackFilterIterator, z_list, sub, allow, ce_flags); \
190 SPL_ADD_CLASS(RecursiveDirectoryIterator, z_list, sub, allow, ce_flags); \
191 SPL_ADD_CLASS(RecursiveFilterIterator, z_list, sub, allow, ce_flags); \
192 SPL_ADD_CLASS(RecursiveIterator, z_list, sub, allow, ce_flags); \
193 SPL_ADD_CLASS(RecursiveIteratorIterator, z_list, sub, allow, ce_flags); \
194 SPL_ADD_CLASS(RecursiveRegexIterator, z_list, sub, allow, ce_flags); \
195 SPL_ADD_CLASS(RecursiveTreeIterator, z_list, sub, allow, ce_flags); \
196 SPL_ADD_CLASS(RegexIterator, z_list, sub, allow, ce_flags); \
197 SPL_ADD_CLASS(RuntimeException, z_list, sub, allow, ce_flags); \
198 SPL_ADD_CLASS(SeekableIterator, z_list, sub, allow, ce_flags); \
199 SPL_ADD_CLASS(SplDoublyLinkedList, z_list, sub, allow, ce_flags); \
200 SPL_ADD_CLASS(SplFileInfo, z_list, sub, allow, ce_flags); \
201 SPL_ADD_CLASS(SplFileObject, z_list, sub, allow, ce_flags); \
202 SPL_ADD_CLASS(SplFixedArray, z_list, sub, allow, ce_flags); \
203 SPL_ADD_CLASS(SplHeap, z_list, sub, allow, ce_flags); \
204 SPL_ADD_CLASS(SplMinHeap, z_list, sub, allow, ce_flags); \
205 SPL_ADD_CLASS(SplMaxHeap, z_list, sub, allow, ce_flags); \
206 SPL_ADD_CLASS(SplObjectStorage, z_list, sub, allow, ce_flags); \
207 SPL_ADD_CLASS(SplObserver, z_list, sub, allow, ce_flags); \
208 SPL_ADD_CLASS(SplPriorityQueue, z_list, sub, allow, ce_flags); \
209 SPL_ADD_CLASS(SplQueue, z_list, sub, allow, ce_flags); \
210 SPL_ADD_CLASS(SplStack, z_list, sub, allow, ce_flags); \
211 SPL_ADD_CLASS(SplSubject, z_list, sub, allow, ce_flags); \
212 SPL_ADD_CLASS(SplTempFileObject, z_list, sub, allow, ce_flags); \
213 SPL_ADD_CLASS(UnderflowException, z_list, sub, allow, ce_flags); \
214 SPL_ADD_CLASS(UnexpectedValueException, z_list, sub, allow, ce_flags); \
215
216/* {{{ Return an array containing the names of all clsses and interfaces defined in SPL */
227/* }}} */
228
229static int spl_autoload(zend_string *class_name, zend_string *lc_name, const char *ext, int ext_len) /* {{{ */
230{
231 zend_string *class_file;
232 zval dummy;
233 zend_file_handle file_handle;
235 zval result;
236 int ret;
237
238 class_file = zend_strpprintf(0, "%s%.*s", ZSTR_VAL(lc_name), ext_len, ext);
239
240#if DEFAULT_SLASH != '\\'
241 {
242 char *ptr = ZSTR_VAL(class_file);
243 char *end = ptr + ZSTR_LEN(class_file);
244
245 while ((ptr = memchr(ptr, '\\', (end - ptr))) != NULL) {
247 }
248 }
249#endif
250
251 zend_stream_init_filename_ex(&file_handle, class_file);
253
254 if (ret == SUCCESS) {
255 zend_string *opened_path;
256 if (!file_handle.opened_path) {
257 file_handle.opened_path = zend_string_copy(class_file);
258 }
259 opened_path = zend_string_copy(file_handle.opened_path);
260 ZVAL_NULL(&dummy);
261 if (zend_hash_add(&EG(included_files), opened_path, &dummy)) {
263 } else {
265 }
266 zend_string_release_ex(opened_path, 0);
267 if (new_op_array) {
268 uint32_t orig_jit_trace_num = EG(jit_trace_num);
269
272 EG(jit_trace_num) = orig_jit_trace_num;
273
276 if (!EG(exception)) {
278 }
279
280 zend_destroy_file_handle(&file_handle);
281 zend_string_release(class_file);
282 return zend_hash_exists(EG(class_table), lc_name);
283 }
284 }
285 zend_destroy_file_handle(&file_handle);
286 zend_string_release(class_file);
287 return 0;
288} /* }}} */
289
290/* {{{ Default autoloader implementation */
291PHP_FUNCTION(spl_autoload)
292{
293 int pos_len, pos1_len;
294 char *pos, *pos1;
295 zend_string *class_name, *lc_name, *file_exts = NULL;
296
297 if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|S!", &class_name, &file_exts) == FAILURE) {
299 }
300
301 if (!file_exts) {
302 file_exts = spl_autoload_extensions;
303 }
304
305 if (file_exts == NULL) { /* autoload_extensions is not initialized, set to defaults */
307 pos_len = sizeof(SPL_DEFAULT_FILE_EXTENSIONS) - 1;
308 } else {
309 pos = ZSTR_VAL(file_exts);
310 pos_len = (int)ZSTR_LEN(file_exts);
311 }
312
313 lc_name = zend_string_tolower(class_name);
314 while (pos && *pos && !EG(exception)) {
315 pos1 = strchr(pos, ',');
316 if (pos1) {
317 pos1_len = (int)(pos1 - pos);
318 } else {
319 pos1_len = pos_len;
320 }
321 if (spl_autoload(class_name, lc_name, pos, pos1_len)) {
322 break; /* loaded */
323 }
324 pos = pos1 ? pos1 + 1 : NULL;
325 pos_len = pos1? pos_len - pos1_len - 1 : 0;
326 }
327 zend_string_release(lc_name);
328} /* }}} */
329
330/* {{{ Register and return default file extensions for spl_autoload */
332{
333 zend_string *file_exts = NULL;
334
335 if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S!", &file_exts) == FAILURE) {
337 }
338
339 if (file_exts) {
342 }
343 spl_autoload_extensions = zend_string_copy(file_exts);
344 }
345
348 } else {
349 zend_string_addref(spl_autoload_extensions);
351 }
352} /* }}} */
353
360
361static void autoload_func_info_destroy(autoload_func_info *alfi) {
362 if (alfi->obj) {
363 zend_object_release(alfi->obj);
364 }
365 if (alfi->func_ptr &&
369 }
370 if (alfi->closure) {
371 zend_object_release(alfi->closure);
372 }
373 efree(alfi);
374}
375
376static void autoload_func_info_zval_dtor(zval *element)
377{
378 autoload_func_info_destroy(Z_PTR_P(element));
379}
380
381static autoload_func_info *autoload_func_info_from_fci(
384 alfi->ce = fcc->calling_scope;
385 alfi->func_ptr = fcc->function_handler;
386 alfi->obj = fcc->object;
387 if (alfi->obj) {
388 GC_ADDREF(alfi->obj);
389 }
390 if (Z_TYPE(fci->function_name) == IS_OBJECT) {
391 alfi->closure = Z_OBJ(fci->function_name);
392 GC_ADDREF(alfi->closure);
393 } else {
394 alfi->closure = NULL;
395 }
396 return alfi;
397}
398
399static bool autoload_func_info_equals(
400 const autoload_func_info *alfi1, const autoload_func_info *alfi2) {
401 if (UNEXPECTED(
404 )) {
405 return alfi1->obj == alfi2->obj
406 && alfi1->ce == alfi2->ce
407 && alfi1->closure == alfi2->closure
408 && zend_string_equals(alfi1->func_ptr->common.function_name, alfi2->func_ptr->common.function_name)
409 ;
410 }
411 return alfi1->func_ptr == alfi2->func_ptr
412 && alfi1->obj == alfi2->obj
413 && alfi1->ce == alfi2->ce
414 && alfi1->closure == alfi2->closure;
415}
416
417static zend_class_entry *spl_perform_autoload(zend_string *class_name, zend_string *lc_name) {
419 return NULL;
420 }
421
422 /* We don't use ZEND_HASH_MAP_FOREACH here,
423 * because autoloaders may be added/removed during autoloading. */
426 while (1) {
427 autoload_func_info *alfi =
428 zend_hash_get_current_data_ptr_ex(spl_autoload_functions, &pos);
429 if (!alfi) {
430 break;
431 }
432
433 zend_function *func = alfi->func_ptr;
434 if (UNEXPECTED(func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)) {
435 func = emalloc(sizeof(zend_op_array));
436 memcpy(func, alfi->func_ptr, sizeof(zend_op_array));
437 zend_string_addref(func->op_array.function_name);
438 }
439
440 zval param;
441 ZVAL_STR(&param, class_name);
442 zend_call_known_function(func, alfi->obj, alfi->ce, NULL, 1, &param, NULL);
443 if (EG(exception)) {
444 break;
445 }
446
447 if (ZSTR_HAS_CE_CACHE(class_name) && ZSTR_GET_CE_CACHE(class_name)) {
448 return (zend_class_entry*)ZSTR_GET_CE_CACHE(class_name);
449 } else {
450 zend_class_entry *ce = zend_hash_find_ptr(EG(class_table), lc_name);
451 if (ce) {
452 return ce;
453 }
454 }
455
457 }
458 return NULL;
459}
460
461/* {{{ Try all registered autoload function to load the requested class */
463{
464 zend_string *class_name;
465
466 if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &class_name) == FAILURE) {
468 }
469
470 zend_string *lc_name = zend_string_tolower(class_name);
471 spl_perform_autoload(class_name, lc_name);
472 zend_string_release(lc_name);
473} /* }}} */
474
475#define HT_MOVE_TAIL_TO_HEAD(ht) \
476 ZEND_ASSERT(!HT_IS_PACKED(ht)); \
477 do { \
478 Bucket tmp = (ht)->arData[(ht)->nNumUsed-1]; \
479 memmove((ht)->arData + 1, (ht)->arData, \
480 sizeof(Bucket) * ((ht)->nNumUsed - 1)); \
481 (ht)->arData[0] = tmp; \
482 zend_hash_rehash(ht); \
483 } while (0)
484
485static Bucket *spl_find_registered_function(autoload_func_info *find_alfi) {
487 return NULL;
488 }
489
490 autoload_func_info *alfi;
492 if (autoload_func_info_equals(alfi, find_alfi)) {
493 return _p;
494 }
496 return NULL;
497}
498
499/* {{{ Register given function as autoloader */
501{
502 bool do_throw = 1;
503 bool prepend = 0;
504 zend_fcall_info fci = {0};
506 autoload_func_info *alfi;
507
510 Z_PARAM_FUNC_OR_NULL(fci, fcc)
511 Z_PARAM_BOOL(do_throw)
512 Z_PARAM_BOOL(prepend)
514
515 if (!do_throw) {
516 php_error_docref(NULL, E_NOTICE, "Argument #2 ($do_throw) has been ignored, "
517 "spl_autoload_register() will always throw");
518 }
519
522 zend_hash_init(spl_autoload_functions, 1, NULL, autoload_func_info_zval_dtor, 0);
523 /* Initialize as non-packed hash table for prepend functionality. */
525 }
526
527 /* If first arg is not null */
528 if (ZEND_FCI_INITIALIZED(fci)) {
529 if (!fcc.function_handler) {
530 /* Call trampoline has been cleared by zpp. Refetch it, because we want to deal
531 * with it outselves. It is important that it is not refetched on every call,
532 * because calls may occur from different scopes. */
534 }
535
537 fcc.function_handler->internal_function.handler == zif_spl_autoload_call) {
538 zend_argument_value_error(1, "must not be the spl_autoload_call() function");
540 }
541
542 alfi = autoload_func_info_from_fci(&fci, &fcc);
543 if (UNEXPECTED(alfi->func_ptr == &EG(trampoline))) {
545
546 memcpy(copy, alfi->func_ptr, sizeof(zend_op_array));
548 alfi->func_ptr = copy;
549 }
550 } else {
551 alfi = emalloc(sizeof(autoload_func_info));
552 alfi->func_ptr = zend_hash_str_find_ptr(
553 CG(function_table), "spl_autoload", sizeof("spl_autoload") - 1);
554 alfi->obj = NULL;
555 alfi->ce = NULL;
556 alfi->closure = NULL;
557 }
558
559 if (spl_find_registered_function(alfi)) {
560 autoload_func_info_destroy(alfi);
562 }
563
564 zend_hash_next_index_insert_ptr(spl_autoload_functions, alfi);
565 if (prepend && spl_autoload_functions->nNumOfElements > 1) {
566 /* Move the newly created element to the head of the hashtable */
568 }
569
571} /* }}} */
572
573/* {{{ Unregister given function as autoloader */
575{
576 zend_fcall_info fci;
578
580 Z_PARAM_FUNC(fci, fcc)
582
584 fcc.function_handler->common.function_name, "spl_autoload_call")) {
586 /* Don't destroy the hash table, as we might be iterating over it right now. */
588 }
590 }
591
592 if (!fcc.function_handler) {
593 /* Call trampoline has been cleared by zpp. Refetch it, because we want to deal
594 * with it outselves. It is important that it is not refetched on every call,
595 * because calls may occur from different scopes. */
597 }
598
599 autoload_func_info *alfi = autoload_func_info_from_fci(&fci, &fcc);
600 Bucket *p = spl_find_registered_function(alfi);
601 autoload_func_info_destroy(alfi);
602 if (p) {
605 }
606
608} /* }}} */
609
610/* {{{ Return all registered autoloader functions */
612{
613 autoload_func_info *alfi;
614
617 }
618
622 if (alfi->closure) {
623 GC_ADDREF(alfi->closure);
625 } else if (alfi->func_ptr->common.scope) {
626 zval tmp;
627
628 array_init(&tmp);
629 if (alfi->obj) {
630 GC_ADDREF(alfi->obj);
631 add_next_index_object(&tmp, alfi->obj);
632 } else {
633 add_next_index_str(&tmp, zend_string_copy(alfi->ce->name));
634 }
635 add_next_index_str(&tmp, zend_string_copy(alfi->func_ptr->common.function_name));
636 add_next_index_zval(return_value, &tmp);
637 } else {
639 }
641 }
642} /* }}} */
643
644/* {{{ Return hash id for given object */
655/* }}} */
656
657/* {{{ Returns the integer object handle for the given object */
668/* }}} */
669
671{
672 return strpprintf(32, "%016zx0000000000000000", (intptr_t)obj->handle);
673}
674/* }}} */
675
676static void spl_build_class_list_string(zval *entry, char **list) /* {{{ */
677{
678 char *res;
679
680 spprintf(&res, 0, "%s, %s", *list, Z_STRVAL_P(entry));
681 efree(*list);
682 *list = res;
683} /* }}} */
684
685/* {{{ PHP_MINFO(spl) */
687{
688 zval list, *zv;
689 char *strg;
690
692 php_info_print_table_row(2, "SPL support", "enabled");
693
694 array_init(&list);
696 strg = estrdup("");
698 spl_build_class_list_string(zv, &strg);
701 php_info_print_table_row(2, "Interfaces", strg + 2);
702 efree(strg);
703
704 array_init(&list);
706 strg = estrdup("");
708 spl_build_class_list_string(zv, &strg);
711 php_info_print_table_row(2, "Classes", strg + 2);
712 efree(strg);
713
715}
716/* }}} */
717
718/* {{{ PHP_MINIT_FUNCTION(spl) */
720{
721 zend_autoload = spl_perform_autoload;
722
723 PHP_MINIT(spl_exceptions)(INIT_FUNC_ARGS_PASSTHRU);
724 PHP_MINIT(spl_iterators)(INIT_FUNC_ARGS_PASSTHRU);
726 PHP_MINIT(spl_directory)(INIT_FUNC_ARGS_PASSTHRU);
730 PHP_MINIT(spl_observer)(INIT_FUNC_ARGS_PASSTHRU);
731
732 return SUCCESS;
733}
734/* }}} */
735
736PHP_RINIT_FUNCTION(spl) /* {{{ */
737{
740 return SUCCESS;
741} /* }}} */
742
743PHP_RSHUTDOWN_FUNCTION(spl) /* {{{ */
744{
748 }
753 }
754 return SUCCESS;
755} /* }}} */
756
757static const zend_module_dep spl_deps[] = {
758 ZEND_MOD_REQUIRED("json")
760};
761
764 spl_deps,
765 "SPL",
766 ext_functions,
767 PHP_MINIT(spl),
768 NULL,
769 PHP_RINIT(spl),
770 PHP_RSHUTDOWN(spl),
771 PHP_MINFO(spl),
774};
file_private const char ext[]
bool exception
Definition assert.c:30
copy(string $from, string $to, $context=null)
strchr(string $haystack, string $needle, bool $before_needle=false)
zval * zv
Definition ffi.c:3975
zend_string * res
Definition ffi.c:4692
void * ptr
Definition ffi.c:3814
memcpy(ptr1, ptr2, size)
#define NULL
Definition gdcache.h:45
#define SUCCESS
Definition hash_sha3.c:261
PHPAPI zend_result php_stream_open_for_zend_ex(zend_file_handle *handle, int mode)
Definition main.c:1620
PHPAPI ZEND_COLD void php_error_docref(const char *docref, int type, const char *format,...)
Definition main.c:1173
php_info_print_table_start()
Definition info.c:1064
php_info_print_table_row(2, "PDO Driver for Firebird", "enabled")
php_info_print_table_end()
Definition info.c:1074
#define PHP_FUNCTION
Definition php.h:364
#define PHP_MINFO
Definition php.h:396
#define PHP_MINIT_FUNCTION
Definition php.h:400
#define PHP_RINIT
Definition php.h:394
#define PHP_MINFO_FUNCTION
Definition php.h:404
#define PHP_RSHUTDOWN
Definition php.h:395
#define PHP_RINIT_FUNCTION
Definition php.h:402
#define PHP_RSHUTDOWN_FUNCTION
Definition php.h:403
#define PHP_MINIT
Definition php.h:392
#define PHPAPI
Definition php.h:71
unsigned const char * end
Definition php_ffi.h:51
unsigned const char * pos
Definition php_ffi.h:52
#define SPL_DEFAULT_FILE_EXTENSIONS
Definition php_spl.c:42
ZEND_TLS zend_string * spl_autoload_extensions
Definition php_spl.c:39
PHPAPI zend_string * php_spl_object_hash(zend_object *obj)
Definition php_spl.c:670
zend_module_entry spl_module_entry
Definition php_spl.c:762
#define SPL_LIST_CLASSES(z_list, sub, allow, ce_flags)
Definition php_spl.c:159
#define HT_MOVE_TAIL_TO_HEAD(ht)
Definition php_spl.c:475
ZEND_TLS HashTable * spl_autoload_functions
Definition php_spl.c:40
#define PHP_SPL_VERSION
Definition php_spl.h:22
spl_autoload_register(?callable $callback=null, bool $throw=true, bool $prepend=false)
spl_object_id(object $object)
class_uses($object_or_class, bool $autoload=true)
spl_autoload_call(string $class)
class_parents($object_or_class, bool $autoload=true)
spl_classes()
spl_object_hash(object $object)
class_implements($object_or_class, bool $autoload=true)
spl_autoload_unregister(callable $callback)
#define STREAM_OPEN_FOR_INCLUDE
#define USE_PATH
p
Definition session.c:1105
struct _spl_fixedarray spl_fixedarray
void spl_add_class_name(zval *list, zend_class_entry *pce, int allow, int ce_flags)
void spl_add_interfaces(zval *list, zend_class_entry *pce, int allow, int ce_flags)
void spl_add_traits(zval *list, zend_class_entry *pce, int allow, int ce_flags)
#define strpprintf
Definition spprintf.h:30
#define spprintf
Definition spprintf.h:29
zend_string * name
Definition zend.h:149
zend_class_entry * parent
Definition zend.h:152
zend_class_entry * calling_scope
Definition zend_API.h:61
zend_function * function_handler
Definition zend_API.h:60
zend_object * object
Definition zend_API.h:63
zend_string * opened_path
Definition zend_stream.h:59
uint32_t handle
Definition zend_types.h:558
zend_function * func_ptr
Definition php_spl.c:355
zend_class_entry * ce
Definition php_spl.c:358
zend_object * obj
Definition php_spl.c:356
zend_object * closure
Definition php_spl.c:357
zend_class_entry * scope
zend_string * function_name
struct _zend_function::@236135173067030250234125302313220025134003177336 common
uint32_t fn_flags
zend_internal_function internal_function
ZEND_API zend_string * zend_strpprintf(size_t max_len, const char *format,...)
Definition zend.c:353
ZEND_API const char * zend_zval_value_name(const zval *arg)
Definition zend_API.c:148
ZEND_API zend_result add_next_index_object(zval *arg, zend_object *obj)
Definition zend_API.c:2213
ZEND_API zend_result zend_parse_parameters(uint32_t num_args, const char *type_spec,...)
Definition zend_API.c:1300
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
ZEND_API zend_result add_next_index_str(zval *arg, zend_string *str)
Definition zend_API.c:2177
#define Z_PARAM_FUNC(dest_fci, dest_fcc)
Definition zend_API.h:1824
#define ZEND_NUM_ARGS()
Definition zend_API.h:530
struct _zend_fcall_info_cache zend_fcall_info_cache
#define RETURN_STRINGL(s, l)
Definition zend_API.h:1044
#define ZEND_PARSE_PARAMETERS_END()
Definition zend_API.h:1641
#define RETURN_FALSE
Definition zend_API.h:1058
#define IS_CALLABLE_SUPPRESS_DEPRECATIONS
Definition zend_API.h:412
#define Z_PARAM_OPTIONAL
Definition zend_API.h:1667
#define zend_parse_parameters_none()
Definition zend_API.h:353
#define ZEND_FCI_INITIALIZED(fci)
Definition zend_API.h:340
#define ZEND_PARSE_PARAMETERS_START(min_num_args, max_num_args)
Definition zend_API.h:1620
#define RETURN_LONG(l)
Definition zend_API.h:1037
#define RETURN_NEW_STR(s)
Definition zend_API.h:1041
struct _zend_fcall_info zend_fcall_info
#define RETURN_THROWS()
Definition zend_API.h:1060
#define Z_PARAM_OBJ(dest)
Definition zend_API.h:1955
#define RETURN_STR(s)
Definition zend_API.h:1039
#define Z_PARAM_BOOL(dest)
Definition zend_API.h:1726
ZEND_API void zend_call_known_function(zend_function *fn, zend_object *object, zend_class_entry *called_scope, zval *retval_ptr, uint32_t param_count, zval *params, HashTable *named_params)
#define Z_PARAM_FUNC_OR_NULL(dest_fci, dest_fcc)
Definition zend_API.h:1830
#define RETURN_TRUE
Definition zend_API.h:1059
#define array_init(arg)
Definition zend_API.h:537
#define efree(ptr)
Definition zend_alloc.h:155
#define estrdup(s)
Definition zend_alloc.h:164
#define FREE_HASHTABLE(ht)
Definition zend_alloc.h:234
#define ALLOC_HASHTABLE(ht)
Definition zend_alloc.h:231
#define emalloc(size)
Definition zend_alloc.h:151
struct _zval_struct zval
zend_string_release_ex(func->internal_function.function_name, 0)
execute_data func
ZEND_API zend_op_array *(* zend_compile_file)(zend_file_handle *file_handle, int type)
ZEND_API void destroy_op_array(zend_op_array *op_array)
#define ZEND_INTERNAL_FUNCTION
#define ZEND_ACC_INTERFACE
#define ZEND_ACC_CALL_VIA_TRAMPOLINE
#define ZEND_REQUIRE
struct _zend_op_array zend_op_array
#define ZEND_ACC_TRAIT
ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle)
#define E_NOTICE
Definition zend_errors.h:26
#define E_WARNING
Definition zend_errors.h:24
ZEND_API zend_class_entry * zend_lookup_class(zend_string *name)
ZEND_API void zend_execute(zend_op_array *op_array, zval *return_value)
ZEND_API zend_class_entry *(* zend_autoload)(zend_string *name, zend_string *lc_name)
union _zend_function zend_function
#define CG(v)
#define EG(v)
ZEND_API void ZEND_FASTCALL zend_hash_destroy(HashTable *ht)
Definition zend_hash.c:1727
ZEND_API zend_result ZEND_FASTCALL zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos)
Definition zend_hash.c:2773
ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos)
Definition zend_hash.c:2733
ZEND_API void ZEND_FASTCALL zend_hash_clean(HashTable *ht)
Definition zend_hash.c:1869
ZEND_API void ZEND_FASTCALL zend_hash_del_bucket(HashTable *ht, Bucket *p)
Definition zend_hash.c:1526
ZEND_API void ZEND_FASTCALL zend_array_destroy(HashTable *ht)
Definition zend_hash.c:1808
ZEND_API void ZEND_FASTCALL zend_hash_real_init_mixed(HashTable *ht)
Definition zend_hash.c:338
ZEND_API zval *ZEND_FASTCALL zend_hash_add(HashTable *ht, zend_string *key, zval *pData)
Definition zend_hash.c:992
#define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent)
Definition zend_hash.h:108
#define ZEND_HASH_MAP_FOREACH_VAL(ht, _val)
Definition zend_hash.h:1310
#define ZEND_HASH_MAP_FOREACH_PTR(ht, _ptr)
Definition zend_hash.h:1326
#define ZEND_HASH_FOREACH_END()
Definition zend_hash.h:1086
struct _zend_file_handle zend_file_handle
int32_t zend_long
Definition zend_long.h:42
struct _zend_string zend_string
#define INIT_FUNC_ARGS_PASSTHRU
#define ZEND_MOD_END
struct _zend_module_dep zend_module_dep
struct _zend_module_entry zend_module_entry
#define STANDARD_MODULE_PROPERTIES
#define ZEND_MOD_REQUIRED(name)
#define STANDARD_MODULE_HEADER_EX
#define zend_free_trampoline(func)
#define UNEXPECTED(condition)
struct _zend_class_entry zend_class_entry
struct _zend_object zend_object
ZEND_API void zend_stream_init_filename_ex(zend_file_handle *handle, zend_string *filename)
Definition zend_stream.c:76
#define ZSTR_VAL(zstr)
Definition zend_string.h:68
#define zend_string_equals_literal(str, literal)
#define ZSTR_LEN(zstr)
Definition zend_string.h:69
#define Z_TYPE_P(zval_p)
Definition zend_types.h:660
#define ZVAL_STR(z, s)
#define ZVAL_UNDEF(z)
#define Z_STRVAL_P(zval_p)
Definition zend_types.h:975
#define Z_ARRVAL_P(zval_p)
Definition zend_types.h:987
#define ZVAL_NULL(z)
#define IS_STRING
Definition zend_types.h:606
struct _zend_array HashTable
Definition zend_types.h:386
#define Z_STR_P(zval_p)
Definition zend_types.h:972
#define Z_PTR_P(zval_p)
#define ZSTR_HAS_CE_CACHE(s)
Definition zend_types.h:841
#define GC_ADDREF(p)
Definition zend_types.h:709
#define Z_OBJCE_P(zval_p)
@ FAILURE
Definition zend_types.h:61
#define IS_OBJECT
Definition zend_types.h:608
#define ZSTR_GET_CE_CACHE(s)
Definition zend_types.h:842
uint32_t HashPosition
Definition zend_types.h:548
#define Z_ARR(zval)
Definition zend_types.h:983
struct _Bucket Bucket
#define ZEND_TLS
Definition zend_types.h:84
#define Z_TYPE(zval)
Definition zend_types.h:659
#define Z_OBJ(zval)
Definition zend_types.h:989
ZEND_API void zval_ptr_dtor(zval *zval_ptr)
#define DEFAULT_SLASH
new_op_array
zval * return_value
zend_string * name
bool result
zval * ret