1 /*
2 +----------------------------------------------------------------------+
3 | PHP Version 7 |
4 +----------------------------------------------------------------------+
5 | Copyright (c) The PHP Group |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
15 | Authors: Marcus Boerger <helly@php.net> |
16 +----------------------------------------------------------------------+
17 */
18
19 #ifdef HAVE_CONFIG_H
20 #include "config.h"
21 #endif
22
23 #include "php.h"
24 #include "php_ini.h"
25 #include "php_main.h"
26 #include "ext/standard/info.h"
27 #include "php_spl.h"
28 #include "spl_functions.h"
29 #include "spl_engine.h"
30 #include "spl_array.h"
31 #include "spl_directory.h"
32 #include "spl_iterators.h"
33 #include "spl_exceptions.h"
34 #include "spl_observer.h"
35 #include "spl_dllist.h"
36 #include "spl_fixedarray.h"
37 #include "spl_heap.h"
38 #include "zend_exceptions.h"
39 #include "zend_interfaces.h"
40 #include "ext/standard/php_mt_rand.h"
41 #include "main/snprintf.h"
42
43 #ifdef COMPILE_DL_SPL
44 ZEND_GET_MODULE(spl)
45 #endif
46
47 ZEND_DECLARE_MODULE_GLOBALS(spl)
48
49 #define SPL_DEFAULT_FILE_EXTENSIONS ".inc,.php"
50
51 static zend_function *spl_autoload_fn = NULL;
52 static zend_function *spl_autoload_call_fn = NULL;
53
54 /* {{{ PHP_GINIT_FUNCTION
55 */
PHP_GINIT_FUNCTION(spl)56 static PHP_GINIT_FUNCTION(spl)
57 {
58 spl_globals->autoload_extensions = NULL;
59 spl_globals->autoload_functions = NULL;
60 spl_globals->autoload_running = 0;
61 }
62 /* }}} */
63
spl_find_ce_by_name(zend_string * name,zend_bool autoload)64 static zend_class_entry * spl_find_ce_by_name(zend_string *name, zend_bool autoload)
65 {
66 zend_class_entry *ce;
67
68 if (!autoload) {
69 zend_string *lc_name = zend_string_tolower(name);
70
71 ce = zend_hash_find_ptr(EG(class_table), lc_name);
72 zend_string_release(lc_name);
73 } else {
74 ce = zend_lookup_class(name);
75 }
76 if (ce == NULL) {
77 php_error_docref(NULL, E_WARNING, "Class %s does not exist%s", ZSTR_VAL(name), autoload ? " and could not be loaded" : "");
78 return NULL;
79 }
80
81 return ce;
82 }
83
84 /* {{{ proto array class_parents(object instance [, bool autoload = true])
85 Return an array containing the names of all parent classes */
PHP_FUNCTION(class_parents)86 PHP_FUNCTION(class_parents)
87 {
88 zval *obj;
89 zend_class_entry *parent_class, *ce;
90 zend_bool autoload = 1;
91
92 if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &obj, &autoload) == FAILURE) {
93 RETURN_FALSE;
94 }
95
96 if (Z_TYPE_P(obj) != IS_OBJECT && Z_TYPE_P(obj) != IS_STRING) {
97 php_error_docref(NULL, E_WARNING, "object or string expected");
98 RETURN_FALSE;
99 }
100
101 if (Z_TYPE_P(obj) == IS_STRING) {
102 if (NULL == (ce = spl_find_ce_by_name(Z_STR_P(obj), autoload))) {
103 RETURN_FALSE;
104 }
105 } else {
106 ce = Z_OBJCE_P(obj);
107 }
108
109 array_init(return_value);
110 parent_class = ce->parent;
111 while (parent_class) {
112 spl_add_class_name(return_value, parent_class, 0, 0);
113 parent_class = parent_class->parent;
114 }
115 }
116 /* }}} */
117
118 /* {{{ proto array class_implements(mixed what [, bool autoload ])
119 Return all classes and interfaces implemented by SPL */
PHP_FUNCTION(class_implements)120 PHP_FUNCTION(class_implements)
121 {
122 zval *obj;
123 zend_bool autoload = 1;
124 zend_class_entry *ce;
125
126 if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &obj, &autoload) == FAILURE) {
127 RETURN_FALSE;
128 }
129 if (Z_TYPE_P(obj) != IS_OBJECT && Z_TYPE_P(obj) != IS_STRING) {
130 php_error_docref(NULL, E_WARNING, "object or string expected");
131 RETURN_FALSE;
132 }
133
134 if (Z_TYPE_P(obj) == IS_STRING) {
135 if (NULL == (ce = spl_find_ce_by_name(Z_STR_P(obj), autoload))) {
136 RETURN_FALSE;
137 }
138 } else {
139 ce = Z_OBJCE_P(obj);
140 }
141
142 array_init(return_value);
143 spl_add_interfaces(return_value, ce, 1, ZEND_ACC_INTERFACE);
144 }
145 /* }}} */
146
147 /* {{{ proto array class_uses(mixed what [, bool autoload ])
148 Return all traits used by a class. */
PHP_FUNCTION(class_uses)149 PHP_FUNCTION(class_uses)
150 {
151 zval *obj;
152 zend_bool autoload = 1;
153 zend_class_entry *ce;
154
155 if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &obj, &autoload) == FAILURE) {
156 RETURN_FALSE;
157 }
158 if (Z_TYPE_P(obj) != IS_OBJECT && Z_TYPE_P(obj) != IS_STRING) {
159 php_error_docref(NULL, E_WARNING, "object or string expected");
160 RETURN_FALSE;
161 }
162
163 if (Z_TYPE_P(obj) == IS_STRING) {
164 if (NULL == (ce = spl_find_ce_by_name(Z_STR_P(obj), autoload))) {
165 RETURN_FALSE;
166 }
167 } else {
168 ce = Z_OBJCE_P(obj);
169 }
170
171 array_init(return_value);
172 spl_add_traits(return_value, ce, 1, ZEND_ACC_TRAIT);
173 }
174 /* }}} */
175
176 #define SPL_ADD_CLASS(class_name, z_list, sub, allow, ce_flags) \
177 spl_add_classes(spl_ce_ ## class_name, z_list, sub, allow, ce_flags)
178
179 #define SPL_LIST_CLASSES(z_list, sub, allow, ce_flags) \
180 SPL_ADD_CLASS(AppendIterator, z_list, sub, allow, ce_flags); \
181 SPL_ADD_CLASS(ArrayIterator, z_list, sub, allow, ce_flags); \
182 SPL_ADD_CLASS(ArrayObject, z_list, sub, allow, ce_flags); \
183 SPL_ADD_CLASS(BadFunctionCallException, z_list, sub, allow, ce_flags); \
184 SPL_ADD_CLASS(BadMethodCallException, z_list, sub, allow, ce_flags); \
185 SPL_ADD_CLASS(CachingIterator, z_list, sub, allow, ce_flags); \
186 SPL_ADD_CLASS(CallbackFilterIterator, z_list, sub, allow, ce_flags); \
187 SPL_ADD_CLASS(DirectoryIterator, z_list, sub, allow, ce_flags); \
188 SPL_ADD_CLASS(DomainException, z_list, sub, allow, ce_flags); \
189 SPL_ADD_CLASS(EmptyIterator, z_list, sub, allow, ce_flags); \
190 SPL_ADD_CLASS(FilesystemIterator, z_list, sub, allow, ce_flags); \
191 SPL_ADD_CLASS(FilterIterator, z_list, sub, allow, ce_flags); \
192 SPL_ADD_CLASS(GlobIterator, z_list, sub, allow, ce_flags); \
193 SPL_ADD_CLASS(InfiniteIterator, z_list, sub, allow, ce_flags); \
194 SPL_ADD_CLASS(InvalidArgumentException, z_list, sub, allow, ce_flags); \
195 SPL_ADD_CLASS(IteratorIterator, z_list, sub, allow, ce_flags); \
196 SPL_ADD_CLASS(LengthException, z_list, sub, allow, ce_flags); \
197 SPL_ADD_CLASS(LimitIterator, z_list, sub, allow, ce_flags); \
198 SPL_ADD_CLASS(LogicException, z_list, sub, allow, ce_flags); \
199 SPL_ADD_CLASS(MultipleIterator, z_list, sub, allow, ce_flags); \
200 SPL_ADD_CLASS(NoRewindIterator, z_list, sub, allow, ce_flags); \
201 SPL_ADD_CLASS(OuterIterator, z_list, sub, allow, ce_flags); \
202 SPL_ADD_CLASS(OutOfBoundsException, z_list, sub, allow, ce_flags); \
203 SPL_ADD_CLASS(OutOfRangeException, z_list, sub, allow, ce_flags); \
204 SPL_ADD_CLASS(OverflowException, z_list, sub, allow, ce_flags); \
205 SPL_ADD_CLASS(ParentIterator, z_list, sub, allow, ce_flags); \
206 SPL_ADD_CLASS(RangeException, z_list, sub, allow, ce_flags); \
207 SPL_ADD_CLASS(RecursiveArrayIterator, z_list, sub, allow, ce_flags); \
208 SPL_ADD_CLASS(RecursiveCachingIterator, z_list, sub, allow, ce_flags); \
209 SPL_ADD_CLASS(RecursiveCallbackFilterIterator, z_list, sub, allow, ce_flags); \
210 SPL_ADD_CLASS(RecursiveDirectoryIterator, z_list, sub, allow, ce_flags); \
211 SPL_ADD_CLASS(RecursiveFilterIterator, z_list, sub, allow, ce_flags); \
212 SPL_ADD_CLASS(RecursiveIterator, z_list, sub, allow, ce_flags); \
213 SPL_ADD_CLASS(RecursiveIteratorIterator, z_list, sub, allow, ce_flags); \
214 SPL_ADD_CLASS(RecursiveRegexIterator, z_list, sub, allow, ce_flags); \
215 SPL_ADD_CLASS(RecursiveTreeIterator, z_list, sub, allow, ce_flags); \
216 SPL_ADD_CLASS(RegexIterator, z_list, sub, allow, ce_flags); \
217 SPL_ADD_CLASS(RuntimeException, z_list, sub, allow, ce_flags); \
218 SPL_ADD_CLASS(SeekableIterator, z_list, sub, allow, ce_flags); \
219 SPL_ADD_CLASS(SplDoublyLinkedList, z_list, sub, allow, ce_flags); \
220 SPL_ADD_CLASS(SplFileInfo, z_list, sub, allow, ce_flags); \
221 SPL_ADD_CLASS(SplFileObject, z_list, sub, allow, ce_flags); \
222 SPL_ADD_CLASS(SplFixedArray, z_list, sub, allow, ce_flags); \
223 SPL_ADD_CLASS(SplHeap, z_list, sub, allow, ce_flags); \
224 SPL_ADD_CLASS(SplMinHeap, z_list, sub, allow, ce_flags); \
225 SPL_ADD_CLASS(SplMaxHeap, z_list, sub, allow, ce_flags); \
226 SPL_ADD_CLASS(SplObjectStorage, z_list, sub, allow, ce_flags); \
227 SPL_ADD_CLASS(SplObserver, z_list, sub, allow, ce_flags); \
228 SPL_ADD_CLASS(SplPriorityQueue, z_list, sub, allow, ce_flags); \
229 SPL_ADD_CLASS(SplQueue, z_list, sub, allow, ce_flags); \
230 SPL_ADD_CLASS(SplStack, z_list, sub, allow, ce_flags); \
231 SPL_ADD_CLASS(SplSubject, z_list, sub, allow, ce_flags); \
232 SPL_ADD_CLASS(SplTempFileObject, z_list, sub, allow, ce_flags); \
233 SPL_ADD_CLASS(UnderflowException, z_list, sub, allow, ce_flags); \
234 SPL_ADD_CLASS(UnexpectedValueException, z_list, sub, allow, ce_flags); \
235
236 /* {{{ proto array spl_classes()
237 Return an array containing the names of all clsses and interfaces defined in SPL */
PHP_FUNCTION(spl_classes)238 PHP_FUNCTION(spl_classes)
239 {
240 if (zend_parse_parameters_none() == FAILURE) {
241 return;
242 }
243
244 array_init(return_value);
245
246 SPL_LIST_CLASSES(return_value, 0, 0, 0)
247 }
248 /* }}} */
249
spl_autoload(zend_string * class_name,zend_string * lc_name,const char * ext,int ext_len)250 static int spl_autoload(zend_string *class_name, zend_string *lc_name, const char *ext, int ext_len) /* {{{ */
251 {
252 char *class_file;
253 int class_file_len;
254 zval dummy;
255 zend_file_handle file_handle;
256 zend_op_array *new_op_array;
257 zval result;
258 int ret;
259
260 class_file_len = (int)spprintf(&class_file, 0, "%s%.*s", ZSTR_VAL(lc_name), ext_len, ext);
261
262 #if DEFAULT_SLASH != '\\'
263 {
264 char *ptr = class_file;
265 char *end = ptr + class_file_len;
266
267 while ((ptr = memchr(ptr, '\\', (end - ptr))) != NULL) {
268 *ptr = DEFAULT_SLASH;
269 }
270 }
271 #endif
272
273 ret = php_stream_open_for_zend_ex(class_file, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE);
274
275 if (ret == SUCCESS) {
276 zend_string *opened_path;
277 if (!file_handle.opened_path) {
278 file_handle.opened_path = zend_string_init(class_file, class_file_len, 0);
279 }
280 opened_path = zend_string_copy(file_handle.opened_path);
281 ZVAL_NULL(&dummy);
282 if (zend_hash_add(&EG(included_files), opened_path, &dummy)) {
283 new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE);
284 zend_destroy_file_handle(&file_handle);
285 } else {
286 new_op_array = NULL;
287 zend_file_handle_dtor(&file_handle);
288 }
289 zend_string_release_ex(opened_path, 0);
290 if (new_op_array) {
291 ZVAL_UNDEF(&result);
292 zend_execute(new_op_array, &result);
293
294 destroy_op_array(new_op_array);
295 efree(new_op_array);
296 if (!EG(exception)) {
297 zval_ptr_dtor(&result);
298 }
299
300 efree(class_file);
301 return zend_hash_exists(EG(class_table), lc_name);
302 }
303 }
304 efree(class_file);
305 return 0;
306 } /* }}} */
307
308 /* {{{ proto void spl_autoload(string class_name [, string file_extensions])
309 Default implementation for __autoload() */
PHP_FUNCTION(spl_autoload)310 PHP_FUNCTION(spl_autoload)
311 {
312 int pos_len, pos1_len;
313 char *pos, *pos1;
314 zend_string *class_name, *lc_name, *file_exts = SPL_G(autoload_extensions);
315
316 if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|S", &class_name, &file_exts) == FAILURE) {
317 RETURN_FALSE;
318 }
319
320 if (file_exts == NULL) { /* autoload_extensions is not initialized, set to defaults */
321 pos = SPL_DEFAULT_FILE_EXTENSIONS;
322 pos_len = sizeof(SPL_DEFAULT_FILE_EXTENSIONS) - 1;
323 } else {
324 pos = ZSTR_VAL(file_exts);
325 pos_len = (int)ZSTR_LEN(file_exts);
326 }
327
328 lc_name = zend_string_tolower(class_name);
329 while (pos && *pos && !EG(exception)) {
330 pos1 = strchr(pos, ',');
331 if (pos1) {
332 pos1_len = (int)(pos1 - pos);
333 } else {
334 pos1_len = pos_len;
335 }
336 if (spl_autoload(class_name, lc_name, pos, pos1_len)) {
337 break; /* loaded */
338 }
339 pos = pos1 ? pos1 + 1 : NULL;
340 pos_len = pos1? pos_len - pos1_len - 1 : 0;
341 }
342 zend_string_release(lc_name);
343 } /* }}} */
344
345 /* {{{ proto string spl_autoload_extensions([string file_extensions])
346 Register and return default file extensions for spl_autoload */
PHP_FUNCTION(spl_autoload_extensions)347 PHP_FUNCTION(spl_autoload_extensions)
348 {
349 zend_string *file_exts = NULL;
350
351 if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S", &file_exts) == FAILURE) {
352 return;
353 }
354 if (file_exts) {
355 if (SPL_G(autoload_extensions)) {
356 zend_string_release_ex(SPL_G(autoload_extensions), 0);
357 }
358 SPL_G(autoload_extensions) = zend_string_copy(file_exts);
359 }
360
361 if (SPL_G(autoload_extensions) == NULL) {
362 RETURN_STRINGL(SPL_DEFAULT_FILE_EXTENSIONS, sizeof(SPL_DEFAULT_FILE_EXTENSIONS) - 1);
363 } else {
364 zend_string_addref(SPL_G(autoload_extensions));
365 RETURN_STR(SPL_G(autoload_extensions));
366 }
367 } /* }}} */
368
369 typedef struct {
370 zend_function *func_ptr;
371 zval obj;
372 zval closure;
373 zend_class_entry *ce;
374 } autoload_func_info;
375
autoload_func_info_dtor(zval * element)376 static void autoload_func_info_dtor(zval *element)
377 {
378 autoload_func_info *alfi = (autoload_func_info*)Z_PTR_P(element);
379 if (!Z_ISUNDEF(alfi->obj)) {
380 zval_ptr_dtor(&alfi->obj);
381 }
382 if (alfi->func_ptr &&
383 UNEXPECTED(alfi->func_ptr->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)) {
384 zend_string_release_ex(alfi->func_ptr->common.function_name, 0);
385 zend_free_trampoline(alfi->func_ptr);
386 }
387 if (!Z_ISUNDEF(alfi->closure)) {
388 zval_ptr_dtor(&alfi->closure);
389 }
390 efree(alfi);
391 }
392
393 /* {{{ proto void spl_autoload_call(string class_name)
394 Try all registered autoload function to load the requested class */
PHP_FUNCTION(spl_autoload_call)395 PHP_FUNCTION(spl_autoload_call)
396 {
397 zval *class_name, retval;
398 zend_string *lc_name, *func_name;
399 autoload_func_info *alfi;
400
401 if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &class_name) == FAILURE || Z_TYPE_P(class_name) != IS_STRING) {
402 return;
403 }
404
405 if (SPL_G(autoload_functions)) {
406 HashPosition pos;
407 zend_ulong num_idx;
408 zend_function *func;
409 zend_fcall_info fci;
410 zend_fcall_info_cache fcic;
411 zend_class_entry *called_scope = zend_get_called_scope(execute_data);
412 int l_autoload_running = SPL_G(autoload_running);
413
414 SPL_G(autoload_running) = 1;
415 lc_name = zend_string_tolower(Z_STR_P(class_name));
416
417 fci.size = sizeof(fci);
418 fci.retval = &retval;
419 fci.param_count = 1;
420 fci.params = class_name;
421 fci.no_separation = 1;
422
423 ZVAL_UNDEF(&fci.function_name); /* Unused */
424
425 zend_hash_internal_pointer_reset_ex(SPL_G(autoload_functions), &pos);
426 while (zend_hash_get_current_key_ex(SPL_G(autoload_functions), &func_name, &num_idx, &pos) == HASH_KEY_IS_STRING) {
427 alfi = zend_hash_get_current_data_ptr_ex(SPL_G(autoload_functions), &pos);
428 func = alfi->func_ptr;
429 if (UNEXPECTED(func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)) {
430 func = emalloc(sizeof(zend_op_array));
431 memcpy(func, alfi->func_ptr, sizeof(zend_op_array));
432 zend_string_addref(func->op_array.function_name);
433 }
434 ZVAL_UNDEF(&retval);
435 fcic.function_handler = func;
436 if (Z_ISUNDEF(alfi->obj)) {
437 fci.object = NULL;
438 fcic.object = NULL;
439 if (alfi->ce &&
440 (!called_scope ||
441 !instanceof_function(called_scope, alfi->ce))) {
442 fcic.called_scope = alfi->ce;
443 } else {
444 fcic.called_scope = called_scope;
445 }
446 } else {
447 fci.object = Z_OBJ(alfi->obj);
448 fcic.object = Z_OBJ(alfi->obj);
449 fcic.called_scope = Z_OBJCE(alfi->obj);
450 }
451
452 zend_call_function(&fci, &fcic);
453 zval_ptr_dtor(&retval);
454
455 if (EG(exception)) {
456 break;
457 }
458
459 if (pos + 1 == SPL_G(autoload_functions)->nNumUsed ||
460 zend_hash_exists(EG(class_table), lc_name)) {
461 break;
462 }
463 zend_hash_move_forward_ex(SPL_G(autoload_functions), &pos);
464 }
465 zend_string_release_ex(lc_name, 0);
466 SPL_G(autoload_running) = l_autoload_running;
467 } else {
468 /* do not use or overwrite &EG(autoload_func) here */
469 zend_fcall_info fcall_info;
470 zend_fcall_info_cache fcall_cache;
471
472 ZVAL_UNDEF(&retval);
473
474 fcall_info.size = sizeof(fcall_info);
475 ZVAL_UNDEF(&fcall_info.function_name);
476 fcall_info.retval = &retval;
477 fcall_info.param_count = 1;
478 fcall_info.params = class_name;
479 fcall_info.object = NULL;
480 fcall_info.no_separation = 1;
481
482 fcall_cache.function_handler = spl_autoload_fn;
483 fcall_cache.called_scope = NULL;
484 fcall_cache.object = NULL;
485
486 zend_call_function(&fcall_info, &fcall_cache);
487 zval_ptr_dtor(&retval);
488 }
489 } /* }}} */
490
491 #define HT_MOVE_TAIL_TO_HEAD(ht) \
492 do { \
493 Bucket tmp = (ht)->arData[(ht)->nNumUsed-1]; \
494 memmove((ht)->arData + 1, (ht)->arData, \
495 sizeof(Bucket) * ((ht)->nNumUsed - 1)); \
496 (ht)->arData[0] = tmp; \
497 zend_hash_rehash(ht); \
498 } while (0)
499
500 /* {{{ proto bool spl_autoload_register([mixed autoload_function [, bool throw [, bool prepend]]])
501 Register given function as __autoload() implementation */
PHP_FUNCTION(spl_autoload_register)502 PHP_FUNCTION(spl_autoload_register)
503 {
504 zend_string *func_name;
505 char *error = NULL;
506 zend_string *lc_name;
507 zval *zcallable = NULL;
508 zend_bool do_throw = 1;
509 zend_bool prepend = 0;
510 zend_function *spl_func_ptr;
511 autoload_func_info alfi;
512 zend_object *obj_ptr;
513 zend_fcall_info_cache fcc;
514
515 if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "|zbb", &zcallable, &do_throw, &prepend) == FAILURE) {
516 return;
517 }
518
519 if (ZEND_NUM_ARGS()) {
520 if (!zend_is_callable_ex(zcallable, NULL, IS_CALLABLE_STRICT, &func_name, &fcc, &error)) {
521 alfi.ce = fcc.calling_scope;
522 alfi.func_ptr = fcc.function_handler;
523 obj_ptr = fcc.object;
524 if (Z_TYPE_P(zcallable) == IS_ARRAY) {
525 if (!obj_ptr && alfi.func_ptr && !(alfi.func_ptr->common.fn_flags & ZEND_ACC_STATIC)) {
526 if (do_throw) {
527 zend_throw_exception_ex(spl_ce_LogicException, 0, "Passed array specifies a non static method but no object (%s)", error);
528 }
529 if (error) {
530 efree(error);
531 }
532 zend_string_release_ex(func_name, 0);
533 RETURN_FALSE;
534 } else if (do_throw) {
535 zend_throw_exception_ex(spl_ce_LogicException, 0, "Passed array does not specify %s %smethod (%s)", alfi.func_ptr ? "a callable" : "an existing", !obj_ptr ? "static " : "", error);
536 }
537 if (error) {
538 efree(error);
539 }
540 zend_string_release_ex(func_name, 0);
541 RETURN_FALSE;
542 } else if (Z_TYPE_P(zcallable) == IS_STRING) {
543 if (do_throw) {
544 zend_throw_exception_ex(spl_ce_LogicException, 0, "Function '%s' not %s (%s)", ZSTR_VAL(func_name), alfi.func_ptr ? "callable" : "found", error);
545 }
546 if (error) {
547 efree(error);
548 }
549 zend_string_release_ex(func_name, 0);
550 RETURN_FALSE;
551 } else {
552 if (do_throw) {
553 zend_throw_exception_ex(spl_ce_LogicException, 0, "Illegal value passed (%s)", error);
554 }
555 if (error) {
556 efree(error);
557 }
558 zend_string_release_ex(func_name, 0);
559 RETURN_FALSE;
560 }
561 } else if (fcc.function_handler->type == ZEND_INTERNAL_FUNCTION &&
562 fcc.function_handler->internal_function.handler == zif_spl_autoload_call) {
563 if (do_throw) {
564 zend_throw_exception_ex(spl_ce_LogicException, 0, "Function spl_autoload_call() cannot be registered");
565 }
566 if (error) {
567 efree(error);
568 }
569 zend_string_release_ex(func_name, 0);
570 RETURN_FALSE;
571 }
572 alfi.ce = fcc.calling_scope;
573 alfi.func_ptr = fcc.function_handler;
574 obj_ptr = fcc.object;
575 if (error) {
576 efree(error);
577 }
578
579 if (Z_TYPE_P(zcallable) == IS_OBJECT) {
580 ZVAL_COPY(&alfi.closure, zcallable);
581
582 lc_name = zend_string_alloc(ZSTR_LEN(func_name) + sizeof(uint32_t), 0);
583 zend_str_tolower_copy(ZSTR_VAL(lc_name), ZSTR_VAL(func_name), ZSTR_LEN(func_name));
584 memcpy(ZSTR_VAL(lc_name) + ZSTR_LEN(func_name), &Z_OBJ_HANDLE_P(zcallable), sizeof(uint32_t));
585 ZSTR_VAL(lc_name)[ZSTR_LEN(lc_name)] = '\0';
586 } else {
587 ZVAL_UNDEF(&alfi.closure);
588 /* Skip leading \ */
589 if (ZSTR_VAL(func_name)[0] == '\\') {
590 lc_name = zend_string_alloc(ZSTR_LEN(func_name) - 1, 0);
591 zend_str_tolower_copy(ZSTR_VAL(lc_name), ZSTR_VAL(func_name) + 1, ZSTR_LEN(func_name) - 1);
592 } else {
593 lc_name = zend_string_tolower(func_name);
594 }
595 }
596 zend_string_release_ex(func_name, 0);
597
598 if (SPL_G(autoload_functions) && zend_hash_exists(SPL_G(autoload_functions), lc_name)) {
599 if (!Z_ISUNDEF(alfi.closure)) {
600 Z_DELREF_P(&alfi.closure);
601 }
602 goto skip;
603 }
604
605 if (obj_ptr && !(alfi.func_ptr->common.fn_flags & ZEND_ACC_STATIC)) {
606 /* add object id to the hash to ensure uniqueness, for more reference look at bug #40091 */
607 lc_name = zend_string_extend(lc_name, ZSTR_LEN(lc_name) + sizeof(uint32_t), 0);
608 memcpy(ZSTR_VAL(lc_name) + ZSTR_LEN(lc_name) - sizeof(uint32_t), &obj_ptr->handle, sizeof(uint32_t));
609 ZSTR_VAL(lc_name)[ZSTR_LEN(lc_name)] = '\0';
610 ZVAL_OBJ(&alfi.obj, obj_ptr);
611 Z_ADDREF(alfi.obj);
612 } else {
613 ZVAL_UNDEF(&alfi.obj);
614 }
615
616 if (!SPL_G(autoload_functions)) {
617 ALLOC_HASHTABLE(SPL_G(autoload_functions));
618 zend_hash_init(SPL_G(autoload_functions), 1, NULL, autoload_func_info_dtor, 0);
619 }
620
621 spl_func_ptr = spl_autoload_fn;
622
623 if (EG(autoload_func) == spl_func_ptr) { /* registered already, so we insert that first */
624 autoload_func_info spl_alfi;
625
626 spl_alfi.func_ptr = spl_func_ptr;
627 ZVAL_UNDEF(&spl_alfi.obj);
628 ZVAL_UNDEF(&spl_alfi.closure);
629 spl_alfi.ce = NULL;
630 zend_hash_add_mem(SPL_G(autoload_functions), spl_autoload_fn->common.function_name,
631 &spl_alfi, sizeof(autoload_func_info));
632 if (prepend && SPL_G(autoload_functions)->nNumOfElements > 1) {
633 /* Move the newly created element to the head of the hashtable */
634 HT_MOVE_TAIL_TO_HEAD(SPL_G(autoload_functions));
635 }
636 }
637
638 if (UNEXPECTED(alfi.func_ptr == &EG(trampoline))) {
639 zend_function *copy = emalloc(sizeof(zend_op_array));
640
641 memcpy(copy, alfi.func_ptr, sizeof(zend_op_array));
642 alfi.func_ptr->common.function_name = NULL;
643 alfi.func_ptr = copy;
644 }
645 if (zend_hash_add_mem(SPL_G(autoload_functions), lc_name, &alfi, sizeof(autoload_func_info)) == NULL) {
646 if (obj_ptr && !(alfi.func_ptr->common.fn_flags & ZEND_ACC_STATIC)) {
647 Z_DELREF(alfi.obj);
648 }
649 if (!Z_ISUNDEF(alfi.closure)) {
650 Z_DELREF(alfi.closure);
651 }
652 if (UNEXPECTED(alfi.func_ptr->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)) {
653 zend_string_release_ex(alfi.func_ptr->common.function_name, 0);
654 zend_free_trampoline(alfi.func_ptr);
655 }
656 }
657 if (prepend && SPL_G(autoload_functions)->nNumOfElements > 1) {
658 /* Move the newly created element to the head of the hashtable */
659 HT_MOVE_TAIL_TO_HEAD(SPL_G(autoload_functions));
660 }
661 skip:
662 zend_string_release_ex(lc_name, 0);
663 }
664
665 if (SPL_G(autoload_functions)) {
666 EG(autoload_func) = spl_autoload_call_fn;
667 } else {
668 EG(autoload_func) = spl_autoload_fn;
669 }
670
671 RETURN_TRUE;
672 } /* }}} */
673
674 /* {{{ proto bool spl_autoload_unregister(mixed autoload_function)
675 Unregister given function as __autoload() implementation */
PHP_FUNCTION(spl_autoload_unregister)676 PHP_FUNCTION(spl_autoload_unregister)
677 {
678 zend_string *func_name = NULL;
679 char *error = NULL;
680 zend_string *lc_name;
681 zval *zcallable;
682 int success = FAILURE;
683 zend_function *spl_func_ptr;
684 zend_object *obj_ptr;
685 zend_fcall_info_cache fcc;
686
687 if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zcallable) == FAILURE) {
688 return;
689 }
690
691 if (!zend_is_callable_ex(zcallable, NULL, IS_CALLABLE_CHECK_SYNTAX_ONLY, &func_name, &fcc, &error)) {
692 zend_throw_exception_ex(spl_ce_LogicException, 0, "Unable to unregister invalid function (%s)", error);
693 if (error) {
694 efree(error);
695 }
696 if (func_name) {
697 zend_string_release_ex(func_name, 0);
698 }
699 RETURN_FALSE;
700 }
701 obj_ptr = fcc.object;
702 if (error) {
703 efree(error);
704 }
705
706 if (Z_TYPE_P(zcallable) == IS_OBJECT) {
707 lc_name = zend_string_alloc(ZSTR_LEN(func_name) + sizeof(uint32_t), 0);
708 zend_str_tolower_copy(ZSTR_VAL(lc_name), ZSTR_VAL(func_name), ZSTR_LEN(func_name));
709 memcpy(ZSTR_VAL(lc_name) + ZSTR_LEN(func_name), &Z_OBJ_HANDLE_P(zcallable), sizeof(uint32_t));
710 ZSTR_VAL(lc_name)[ZSTR_LEN(lc_name)] = '\0';
711 } else {
712 /* Skip leading \ */
713 if (ZSTR_VAL(func_name)[0] == '\\') {
714 lc_name = zend_string_alloc(ZSTR_LEN(func_name) - 1, 0);
715 zend_str_tolower_copy(ZSTR_VAL(lc_name), ZSTR_VAL(func_name) + 1, ZSTR_LEN(func_name) - 1);
716 } else {
717 lc_name = zend_string_tolower(func_name);
718 }
719 }
720 zend_string_release_ex(func_name, 0);
721
722 if (SPL_G(autoload_functions)) {
723 if (zend_string_equals(lc_name, spl_autoload_call_fn->common.function_name)) {
724 /* remove all */
725 if (!SPL_G(autoload_running)) {
726 zend_hash_destroy(SPL_G(autoload_functions));
727 FREE_HASHTABLE(SPL_G(autoload_functions));
728 SPL_G(autoload_functions) = NULL;
729 EG(autoload_func) = NULL;
730 } else {
731 zend_hash_clean(SPL_G(autoload_functions));
732 }
733 success = SUCCESS;
734 } else {
735 /* remove specific */
736 success = zend_hash_del(SPL_G(autoload_functions), lc_name);
737 if (success != SUCCESS && obj_ptr) {
738 lc_name = zend_string_extend(lc_name, ZSTR_LEN(lc_name) + sizeof(uint32_t), 0);
739 memcpy(ZSTR_VAL(lc_name) + ZSTR_LEN(lc_name) - sizeof(uint32_t), &obj_ptr->handle, sizeof(uint32_t));
740 ZSTR_VAL(lc_name)[ZSTR_LEN(lc_name)] = '\0';
741 success = zend_hash_del(SPL_G(autoload_functions), lc_name);
742 }
743 }
744 } else if (zend_string_equals(lc_name, spl_autoload_fn->common.function_name)) {
745 /* register single spl_autoload() */
746 spl_func_ptr = spl_autoload_fn;
747
748 if (EG(autoload_func) == spl_func_ptr) {
749 success = SUCCESS;
750 EG(autoload_func) = NULL;
751 }
752 }
753
754 zend_string_release_ex(lc_name, 0);
755 RETURN_BOOL(success == SUCCESS);
756 } /* }}} */
757
758 /* {{{ proto false|array spl_autoload_functions()
759 Return all registered __autoload() functionns */
PHP_FUNCTION(spl_autoload_functions)760 PHP_FUNCTION(spl_autoload_functions)
761 {
762 zend_function *fptr;
763 autoload_func_info *alfi;
764
765 if (zend_parse_parameters_none() == FAILURE) {
766 return;
767 }
768
769 if (!EG(autoload_func)) {
770 if ((fptr = zend_hash_find_ptr(EG(function_table), ZSTR_KNOWN(ZEND_STR_MAGIC_AUTOLOAD)))) {
771 zval tmp;
772
773 array_init(return_value);
774 ZVAL_STR_COPY(&tmp, ZSTR_KNOWN(ZEND_STR_MAGIC_AUTOLOAD));
775 zend_hash_next_index_insert_new(Z_ARR_P(return_value), &tmp);
776 return;
777 }
778 RETURN_FALSE;
779 }
780
781 fptr = spl_autoload_call_fn;
782
783 if (EG(autoload_func) == fptr) {
784 zend_string *key;
785 array_init(return_value);
786 ZEND_HASH_FOREACH_STR_KEY_PTR(SPL_G(autoload_functions), key, alfi) {
787 if (!Z_ISUNDEF(alfi->closure)) {
788 Z_ADDREF(alfi->closure);
789 add_next_index_zval(return_value, &alfi->closure);
790 } else if (alfi->func_ptr->common.scope) {
791 zval tmp;
792
793 array_init(&tmp);
794 if (!Z_ISUNDEF(alfi->obj)) {
795 Z_ADDREF(alfi->obj);
796 add_next_index_zval(&tmp, &alfi->obj);
797 } else {
798 add_next_index_str(&tmp, zend_string_copy(alfi->ce->name));
799 }
800 add_next_index_str(&tmp, zend_string_copy(alfi->func_ptr->common.function_name));
801 add_next_index_zval(return_value, &tmp);
802 } else {
803 if (strncmp(ZSTR_VAL(alfi->func_ptr->common.function_name), "__lambda_func", sizeof("__lambda_func") - 1)) {
804 add_next_index_str(return_value, zend_string_copy(alfi->func_ptr->common.function_name));
805 } else {
806 add_next_index_str(return_value, zend_string_copy(key));
807 }
808 }
809 } ZEND_HASH_FOREACH_END();
810 return;
811 }
812
813 array_init(return_value);
814 add_next_index_str(return_value, zend_string_copy(EG(autoload_func)->common.function_name));
815 } /* }}} */
816
817 /* {{{ proto string spl_object_hash(object obj)
818 Return hash id for given object */
PHP_FUNCTION(spl_object_hash)819 PHP_FUNCTION(spl_object_hash)
820 {
821 zval *obj;
822
823 if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &obj) == FAILURE) {
824 return;
825 }
826
827 RETURN_NEW_STR(php_spl_object_hash(obj));
828 }
829 /* }}} */
830
831 /* {{{ proto int spl_object_id(object obj)
832 Returns the integer object handle for the given object */
PHP_FUNCTION(spl_object_id)833 PHP_FUNCTION(spl_object_id)
834 {
835 zval *obj;
836
837 ZEND_PARSE_PARAMETERS_START(1, 1)
838 Z_PARAM_OBJECT(obj)
839 ZEND_PARSE_PARAMETERS_END();
840
841 RETURN_LONG((zend_long)Z_OBJ_HANDLE_P(obj));
842 }
843 /* }}} */
844
php_spl_object_hash(zval * obj)845 PHPAPI zend_string *php_spl_object_hash(zval *obj) /* {{{*/
846 {
847 intptr_t hash_handle, hash_handlers;
848
849 if (!SPL_G(hash_mask_init)) {
850 SPL_G(hash_mask_handle) = (intptr_t)(php_mt_rand() >> 1);
851 SPL_G(hash_mask_handlers) = (intptr_t)(php_mt_rand() >> 1);
852 SPL_G(hash_mask_init) = 1;
853 }
854
855 hash_handle = SPL_G(hash_mask_handle)^(intptr_t)Z_OBJ_HANDLE_P(obj);
856 hash_handlers = SPL_G(hash_mask_handlers);
857
858 return strpprintf(32, "%016zx%016zx", hash_handle, hash_handlers);
859 }
860 /* }}} */
861
spl_build_class_list_string(zval * entry,char ** list)862 static void spl_build_class_list_string(zval *entry, char **list) /* {{{ */
863 {
864 char *res;
865
866 spprintf(&res, 0, "%s, %s", *list, Z_STRVAL_P(entry));
867 efree(*list);
868 *list = res;
869 } /* }}} */
870
871 /* {{{ PHP_MINFO(spl)
872 */
PHP_MINFO_FUNCTION(spl)873 PHP_MINFO_FUNCTION(spl)
874 {
875 zval list, *zv;
876 char *strg;
877
878 php_info_print_table_start();
879 php_info_print_table_header(2, "SPL support", "enabled");
880
881 array_init(&list);
882 SPL_LIST_CLASSES(&list, 0, 1, ZEND_ACC_INTERFACE)
883 strg = estrdup("");
884 ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&list), zv) {
885 spl_build_class_list_string(zv, &strg);
886 } ZEND_HASH_FOREACH_END();
887 zend_array_destroy(Z_ARR(list));
888 php_info_print_table_row(2, "Interfaces", strg + 2);
889 efree(strg);
890
891 array_init(&list);
892 SPL_LIST_CLASSES(&list, 0, -1, ZEND_ACC_INTERFACE)
893 strg = estrdup("");
894 ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&list), zv) {
895 spl_build_class_list_string(zv, &strg);
896 } ZEND_HASH_FOREACH_END();
897 zend_array_destroy(Z_ARR(list));
898 php_info_print_table_row(2, "Classes", strg + 2);
899 efree(strg);
900
901 php_info_print_table_end();
902 }
903 /* }}} */
904
905 /* {{{ arginfo */
906 ZEND_BEGIN_ARG_INFO_EX(arginfo_iterator_to_array, 0, 0, 1)
907 ZEND_ARG_OBJ_INFO(0, iterator, Traversable, 0)
908 ZEND_ARG_INFO(0, use_keys)
909 ZEND_END_ARG_INFO();
910
911 ZEND_BEGIN_ARG_INFO(arginfo_iterator, 0)
912 ZEND_ARG_OBJ_INFO(0, iterator, Traversable, 0)
913 ZEND_END_ARG_INFO();
914
915 ZEND_BEGIN_ARG_INFO_EX(arginfo_iterator_apply, 0, 0, 2)
916 ZEND_ARG_OBJ_INFO(0, iterator, Traversable, 0)
917 ZEND_ARG_INFO(0, function)
918 ZEND_ARG_ARRAY_INFO(0, args, 1)
919 ZEND_END_ARG_INFO();
920
921 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_parents, 0, 0, 1)
922 ZEND_ARG_INFO(0, instance)
923 ZEND_ARG_INFO(0, autoload)
924 ZEND_END_ARG_INFO()
925
926 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_implements, 0, 0, 1)
927 ZEND_ARG_INFO(0, what)
928 ZEND_ARG_INFO(0, autoload)
929 ZEND_END_ARG_INFO()
930
931 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_uses, 0, 0, 1)
932 ZEND_ARG_INFO(0, what)
933 ZEND_ARG_INFO(0, autoload)
934 ZEND_END_ARG_INFO()
935
936
937 ZEND_BEGIN_ARG_INFO(arginfo_spl_classes, 0)
938 ZEND_END_ARG_INFO()
939
940 ZEND_BEGIN_ARG_INFO(arginfo_spl_autoload_functions, 0)
941 ZEND_END_ARG_INFO()
942
943 ZEND_BEGIN_ARG_INFO_EX(arginfo_spl_autoload, 0, 0, 1)
944 ZEND_ARG_INFO(0, class_name)
945 ZEND_ARG_INFO(0, file_extensions)
946 ZEND_END_ARG_INFO()
947
948 ZEND_BEGIN_ARG_INFO_EX(arginfo_spl_autoload_extensions, 0, 0, 0)
949 ZEND_ARG_INFO(0, file_extensions)
950 ZEND_END_ARG_INFO()
951
952 ZEND_BEGIN_ARG_INFO_EX(arginfo_spl_autoload_call, 0, 0, 1)
953 ZEND_ARG_INFO(0, class_name)
954 ZEND_END_ARG_INFO()
955
956 ZEND_BEGIN_ARG_INFO_EX(arginfo_spl_autoload_register, 0, 0, 0)
957 ZEND_ARG_INFO(0, autoload_function)
958 ZEND_ARG_INFO(0, throw)
959 ZEND_ARG_INFO(0, prepend)
960 ZEND_END_ARG_INFO()
961
962 ZEND_BEGIN_ARG_INFO_EX(arginfo_spl_autoload_unregister, 0, 0, 1)
963 ZEND_ARG_INFO(0, autoload_function)
964 ZEND_END_ARG_INFO()
965
966 ZEND_BEGIN_ARG_INFO_EX(arginfo_spl_object_hash, 0, 0, 1)
967 ZEND_ARG_INFO(0, obj)
968 ZEND_END_ARG_INFO()
969
970 ZEND_BEGIN_ARG_INFO_EX(arginfo_spl_object_id, 0, 0, 1)
971 ZEND_ARG_INFO(0, obj)
972 ZEND_END_ARG_INFO()
973 /* }}} */
974
975 /* {{{ spl_functions
976 */
977 static const zend_function_entry spl_functions[] = {
978 PHP_FE(spl_classes, arginfo_spl_classes)
979 PHP_FE(spl_autoload, arginfo_spl_autoload)
980 PHP_FE(spl_autoload_extensions, arginfo_spl_autoload_extensions)
981 PHP_FE(spl_autoload_register, arginfo_spl_autoload_register)
982 PHP_FE(spl_autoload_unregister, arginfo_spl_autoload_unregister)
983 PHP_FE(spl_autoload_functions, arginfo_spl_autoload_functions)
984 PHP_FE(spl_autoload_call, arginfo_spl_autoload_call)
985 PHP_FE(class_parents, arginfo_class_parents)
986 PHP_FE(class_implements, arginfo_class_implements)
987 PHP_FE(class_uses, arginfo_class_uses)
988 PHP_FE(spl_object_hash, arginfo_spl_object_hash)
989 PHP_FE(spl_object_id, arginfo_spl_object_id)
990 PHP_FE(iterator_to_array, arginfo_iterator_to_array)
991 PHP_FE(iterator_count, arginfo_iterator)
992 PHP_FE(iterator_apply, arginfo_iterator_apply)
993 PHP_FE_END
994 };
995 /* }}} */
996
997 /* {{{ PHP_MINIT_FUNCTION(spl)
998 */
PHP_MINIT_FUNCTION(spl)999 PHP_MINIT_FUNCTION(spl)
1000 {
1001 PHP_MINIT(spl_exceptions)(INIT_FUNC_ARGS_PASSTHRU);
1002 PHP_MINIT(spl_iterators)(INIT_FUNC_ARGS_PASSTHRU);
1003 PHP_MINIT(spl_array)(INIT_FUNC_ARGS_PASSTHRU);
1004 PHP_MINIT(spl_directory)(INIT_FUNC_ARGS_PASSTHRU);
1005 PHP_MINIT(spl_dllist)(INIT_FUNC_ARGS_PASSTHRU);
1006 PHP_MINIT(spl_heap)(INIT_FUNC_ARGS_PASSTHRU);
1007 PHP_MINIT(spl_fixedarray)(INIT_FUNC_ARGS_PASSTHRU);
1008 PHP_MINIT(spl_observer)(INIT_FUNC_ARGS_PASSTHRU);
1009
1010 spl_autoload_fn = zend_hash_str_find_ptr(CG(function_table), "spl_autoload", sizeof("spl_autoload") - 1);
1011 spl_autoload_call_fn = zend_hash_str_find_ptr(CG(function_table), "spl_autoload_call", sizeof("spl_autoload_call") - 1);
1012 ZEND_ASSERT(spl_autoload_fn != NULL && spl_autoload_call_fn != NULL);
1013
1014 return SUCCESS;
1015 }
1016 /* }}} */
1017
PHP_RINIT_FUNCTION(spl)1018 PHP_RINIT_FUNCTION(spl) /* {{{ */
1019 {
1020 SPL_G(autoload_extensions) = NULL;
1021 SPL_G(autoload_functions) = NULL;
1022 SPL_G(hash_mask_init) = 0;
1023 return SUCCESS;
1024 } /* }}} */
1025
PHP_RSHUTDOWN_FUNCTION(spl)1026 PHP_RSHUTDOWN_FUNCTION(spl) /* {{{ */
1027 {
1028 if (SPL_G(autoload_extensions)) {
1029 zend_string_release_ex(SPL_G(autoload_extensions), 0);
1030 SPL_G(autoload_extensions) = NULL;
1031 }
1032 if (SPL_G(autoload_functions)) {
1033 zend_hash_destroy(SPL_G(autoload_functions));
1034 FREE_HASHTABLE(SPL_G(autoload_functions));
1035 SPL_G(autoload_functions) = NULL;
1036 }
1037 if (SPL_G(hash_mask_init)) {
1038 SPL_G(hash_mask_init) = 0;
1039 }
1040 return SUCCESS;
1041 } /* }}} */
1042
1043 /* {{{ spl_module_entry
1044 */
1045 zend_module_entry spl_module_entry = {
1046 STANDARD_MODULE_HEADER,
1047 "SPL",
1048 spl_functions,
1049 PHP_MINIT(spl),
1050 NULL,
1051 PHP_RINIT(spl),
1052 PHP_RSHUTDOWN(spl),
1053 PHP_MINFO(spl),
1054 PHP_SPL_VERSION,
1055 PHP_MODULE_GLOBALS(spl),
1056 PHP_GINIT(spl),
1057 NULL,
1058 NULL,
1059 STANDARD_MODULE_PROPERTIES_EX
1060 };
1061 /* }}} */
1062