1/*
2   +----------------------------------------------------------------------+
3   | Zend Engine                                                          |
4   +----------------------------------------------------------------------+
5   | Copyright (c) 1998-2018 Zend Technologies Ltd. (http://www.zend.com) |
6   +----------------------------------------------------------------------+
7   | This source file is subject to version 2.00 of the Zend 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.zend.com/license/2_00.txt.                                |
11   | If you did not receive a copy of the Zend license and are unable to  |
12   | obtain it through the world-wide-web, please send a note to          |
13   | license@zend.com so we can mail you a copy immediately.              |
14   +----------------------------------------------------------------------+
15   | Authors: Marcus Boerger <helly@php.net>                              |
16   +----------------------------------------------------------------------+
17*/
18
19#include "zend.h"
20#include "zend_API.h"
21#include "zend_interfaces.h"
22#include "zend_exceptions.h"
23
24ZEND_API zend_class_entry *zend_ce_traversable;
25ZEND_API zend_class_entry *zend_ce_aggregate;
26ZEND_API zend_class_entry *zend_ce_iterator;
27ZEND_API zend_class_entry *zend_ce_arrayaccess;
28ZEND_API zend_class_entry *zend_ce_serializable;
29ZEND_API zend_class_entry *zend_ce_countable;
30
31/* {{{ zend_call_method
32 Only returns the returned zval if retval_ptr != NULL */
33ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, size_t function_name_len, zval *retval_ptr, int param_count, zval* arg1, zval* arg2)
34{
35	int result;
36	zend_fcall_info fci;
37	zval retval;
38	zval params[2];
39
40	if (param_count > 0) {
41		ZVAL_COPY_VALUE(&params[0], arg1);
42	}
43	if (param_count > 1) {
44		ZVAL_COPY_VALUE(&params[1], arg2);
45	}
46
47	fci.size = sizeof(fci);
48	fci.object = object ? Z_OBJ_P(object) : NULL;
49	fci.retval = retval_ptr ? retval_ptr : &retval;
50	fci.param_count = param_count;
51	fci.params = params;
52	fci.no_separation = 1;
53
54	if (!fn_proxy && !obj_ce) {
55		/* no interest in caching and no information already present that is
56		 * needed later inside zend_call_function. */
57		ZVAL_STRINGL(&fci.function_name, function_name, function_name_len);
58		result = zend_call_function(&fci, NULL);
59		zval_ptr_dtor(&fci.function_name);
60	} else {
61		zend_fcall_info_cache fcic;
62		ZVAL_UNDEF(&fci.function_name); /* Unused */
63
64		if (!obj_ce) {
65			obj_ce = object ? Z_OBJCE_P(object) : NULL;
66		}
67		if (!fn_proxy || !*fn_proxy) {
68			if (EXPECTED(obj_ce)) {
69				fcic.function_handler = zend_hash_str_find_ptr(
70					&obj_ce->function_table, function_name, function_name_len);
71				if (UNEXPECTED(fcic.function_handler == NULL)) {
72					/* error at c-level */
73					zend_error_noreturn(E_CORE_ERROR, "Couldn't find implementation for method %s::%s", ZSTR_VAL(obj_ce->name), function_name);
74				}
75			} else {
76				fcic.function_handler = zend_fetch_function_str(function_name, function_name_len);
77				if (UNEXPECTED(fcic.function_handler == NULL)) {
78					/* error at c-level */
79					zend_error_noreturn(E_CORE_ERROR, "Couldn't find implementation for function %s", function_name);
80				}
81			}
82			if (fn_proxy) {
83				*fn_proxy = fcic.function_handler;
84			}
85		} else {
86			fcic.function_handler = *fn_proxy;
87		}
88
89		if (object) {
90			fcic.called_scope = Z_OBJCE_P(object);
91		} else {
92			zend_class_entry *called_scope = zend_get_called_scope(EG(current_execute_data));
93
94			if (obj_ce &&
95			    (!called_scope ||
96			     !instanceof_function(called_scope, obj_ce))) {
97				fcic.called_scope = obj_ce;
98			} else {
99				fcic.called_scope = called_scope;
100			}
101		}
102		fcic.object = object ? Z_OBJ_P(object) : NULL;
103		result = zend_call_function(&fci, &fcic);
104	}
105	if (result == FAILURE) {
106		/* error at c-level */
107		if (!obj_ce) {
108			obj_ce = object ? Z_OBJCE_P(object) : NULL;
109		}
110		if (!EG(exception)) {
111			zend_error_noreturn(E_CORE_ERROR, "Couldn't execute method %s%s%s", obj_ce ? ZSTR_VAL(obj_ce->name) : "", obj_ce ? "::" : "", function_name);
112		}
113	}
114	if (!retval_ptr) {
115		zval_ptr_dtor(&retval);
116		return NULL;
117	}
118	return retval_ptr;
119}
120/* }}} */
121
122/* iterator interface, c-level functions used by engine */
123
124/* {{{ zend_user_it_new_iterator */
125ZEND_API void zend_user_it_new_iterator(zend_class_entry *ce, zval *object, zval *retval)
126{
127	zend_call_method_with_0_params(object, ce, &ce->iterator_funcs_ptr->zf_new_iterator, "getiterator", retval);
128}
129/* }}} */
130
131/* {{{ zend_user_it_invalidate_current */
132ZEND_API void zend_user_it_invalidate_current(zend_object_iterator *_iter)
133{
134	zend_user_iterator *iter = (zend_user_iterator*)_iter;
135
136	if (!Z_ISUNDEF(iter->value)) {
137		zval_ptr_dtor(&iter->value);
138		ZVAL_UNDEF(&iter->value);
139	}
140}
141/* }}} */
142
143/* {{{ zend_user_it_dtor */
144static void zend_user_it_dtor(zend_object_iterator *_iter)
145{
146	zend_user_iterator *iter = (zend_user_iterator*)_iter;
147	zval *object = &iter->it.data;
148
149	zend_user_it_invalidate_current(_iter);
150	zval_ptr_dtor(object);
151}
152/* }}} */
153
154/* {{{ zend_user_it_valid */
155ZEND_API int zend_user_it_valid(zend_object_iterator *_iter)
156{
157	if (_iter) {
158		zend_user_iterator *iter = (zend_user_iterator*)_iter;
159		zval *object = &iter->it.data;
160		zval more;
161		int result;
162
163		zend_call_method_with_0_params(object, iter->ce, &iter->ce->iterator_funcs_ptr->zf_valid, "valid", &more);
164		result = i_zend_is_true(&more);
165		zval_ptr_dtor(&more);
166		return result ? SUCCESS : FAILURE;
167	}
168	return FAILURE;
169}
170/* }}} */
171
172/* {{{ zend_user_it_get_current_data */
173ZEND_API zval *zend_user_it_get_current_data(zend_object_iterator *_iter)
174{
175	zend_user_iterator *iter = (zend_user_iterator*)_iter;
176	zval *object = &iter->it.data;
177
178	if (Z_ISUNDEF(iter->value)) {
179		zend_call_method_with_0_params(object, iter->ce, &iter->ce->iterator_funcs_ptr->zf_current, "current", &iter->value);
180	}
181	return &iter->value;
182}
183/* }}} */
184
185/* {{{ zend_user_it_get_current_key */
186ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, zval *key)
187{
188	zend_user_iterator *iter = (zend_user_iterator*)_iter;
189	zval *object = &iter->it.data;
190	zval retval;
191
192	zend_call_method_with_0_params(object, iter->ce, &iter->ce->iterator_funcs_ptr->zf_key, "key", &retval);
193
194	if (Z_TYPE(retval) != IS_UNDEF) {
195		ZVAL_ZVAL(key, &retval, 1, 1);
196	} else {
197		if (!EG(exception)) {
198			zend_error(E_WARNING, "Nothing returned from %s::key()", ZSTR_VAL(iter->ce->name));
199		}
200
201		ZVAL_LONG(key, 0);
202	}
203}
204/* }}} */
205
206/* {{{ zend_user_it_move_forward */
207ZEND_API void zend_user_it_move_forward(zend_object_iterator *_iter)
208{
209	zend_user_iterator *iter = (zend_user_iterator*)_iter;
210	zval *object = &iter->it.data;
211
212	zend_user_it_invalidate_current(_iter);
213	zend_call_method_with_0_params(object, iter->ce, &iter->ce->iterator_funcs_ptr->zf_next, "next", NULL);
214}
215/* }}} */
216
217/* {{{ zend_user_it_rewind */
218ZEND_API void zend_user_it_rewind(zend_object_iterator *_iter)
219{
220	zend_user_iterator *iter = (zend_user_iterator*)_iter;
221	zval *object = &iter->it.data;
222
223	zend_user_it_invalidate_current(_iter);
224	zend_call_method_with_0_params(object, iter->ce, &iter->ce->iterator_funcs_ptr->zf_rewind, "rewind", NULL);
225}
226/* }}} */
227
228static const zend_object_iterator_funcs zend_interface_iterator_funcs_iterator = {
229	zend_user_it_dtor,
230	zend_user_it_valid,
231	zend_user_it_get_current_data,
232	zend_user_it_get_current_key,
233	zend_user_it_move_forward,
234	zend_user_it_rewind,
235	zend_user_it_invalidate_current
236};
237
238/* {{{ zend_user_it_get_iterator */
239static zend_object_iterator *zend_user_it_get_iterator(zend_class_entry *ce, zval *object, int by_ref)
240{
241	zend_user_iterator *iterator;
242
243	if (by_ref) {
244		zend_throw_error(NULL, "An iterator cannot be used with foreach by reference");
245		return NULL;
246	}
247
248	iterator = emalloc(sizeof(zend_user_iterator));
249
250	zend_iterator_init((zend_object_iterator*)iterator);
251
252	ZVAL_COPY(&iterator->it.data, object);
253	iterator->it.funcs = &zend_interface_iterator_funcs_iterator;
254	iterator->ce = Z_OBJCE_P(object);
255	ZVAL_UNDEF(&iterator->value);
256	return (zend_object_iterator*)iterator;
257}
258/* }}} */
259
260/* {{{ zend_user_it_get_new_iterator */
261ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *ce, zval *object, int by_ref)
262{
263	zval iterator;
264	zend_object_iterator *new_iterator;
265	zend_class_entry *ce_it;
266
267	zend_user_it_new_iterator(ce, object, &iterator);
268	ce_it = (Z_TYPE(iterator) == IS_OBJECT) ? Z_OBJCE(iterator) : NULL;
269
270	if (!ce_it || !ce_it->get_iterator || (ce_it->get_iterator == zend_user_it_get_new_iterator && Z_OBJ(iterator) == Z_OBJ_P(object))) {
271		if (!EG(exception)) {
272			zend_throw_exception_ex(NULL, 0, "Objects returned by %s::getIterator() must be traversable or implement interface Iterator", ce ? ZSTR_VAL(ce->name) : ZSTR_VAL(Z_OBJCE_P(object)->name));
273		}
274		zval_ptr_dtor(&iterator);
275		return NULL;
276	}
277
278	new_iterator = ce_it->get_iterator(ce_it, &iterator, by_ref);
279	zval_ptr_dtor(&iterator);
280	return new_iterator;
281}
282/* }}} */
283
284/* {{{ zend_implement_traversable */
285static int zend_implement_traversable(zend_class_entry *interface, zend_class_entry *class_type)
286{
287	/* check that class_type is traversable at c-level or implements at least one of 'aggregate' and 'Iterator' */
288	uint32_t i;
289
290	if (class_type->get_iterator || (class_type->parent && class_type->parent->get_iterator)) {
291		return SUCCESS;
292	}
293	for (i = 0; i < class_type->num_interfaces; i++) {
294		if (class_type->interfaces[i] == zend_ce_aggregate || class_type->interfaces[i] == zend_ce_iterator) {
295			return SUCCESS;
296		}
297	}
298	zend_error_noreturn(E_CORE_ERROR, "Class %s must implement interface %s as part of either %s or %s",
299		ZSTR_VAL(class_type->name),
300		ZSTR_VAL(zend_ce_traversable->name),
301		ZSTR_VAL(zend_ce_iterator->name),
302		ZSTR_VAL(zend_ce_aggregate->name));
303	return FAILURE;
304}
305/* }}} */
306
307/* {{{ zend_implement_aggregate */
308static int zend_implement_aggregate(zend_class_entry *interface, zend_class_entry *class_type)
309{
310	uint32_t i;
311	int t = -1;
312
313	if (class_type->get_iterator) {
314		if (class_type->type == ZEND_INTERNAL_CLASS) {
315			/* inheritance ensures the class has necessary userland methods */
316			return SUCCESS;
317		} else if (class_type->get_iterator != zend_user_it_get_new_iterator) {
318			/* c-level get_iterator cannot be changed (exception being only Traversable is implmented) */
319			if (class_type->num_interfaces) {
320				for (i = 0; i < class_type->num_interfaces; i++) {
321					if (class_type->interfaces[i] == zend_ce_iterator) {
322						zend_error_noreturn(E_ERROR, "Class %s cannot implement both %s and %s at the same time",
323									ZSTR_VAL(class_type->name),
324									ZSTR_VAL(interface->name),
325									ZSTR_VAL(zend_ce_iterator->name));
326						return FAILURE;
327					}
328					if (class_type->interfaces[i] == zend_ce_traversable) {
329						t = i;
330					}
331				}
332			}
333			if (t == -1) {
334				return FAILURE;
335			}
336		}
337	}
338	class_type->get_iterator = zend_user_it_get_new_iterator;
339	if (class_type->iterator_funcs_ptr != NULL) {
340		class_type->iterator_funcs_ptr->zf_new_iterator = NULL;
341	} else if (class_type->type == ZEND_INTERNAL_CLASS) {
342		class_type->iterator_funcs_ptr = calloc(1, sizeof(zend_class_iterator_funcs));
343	} else {
344		class_type->iterator_funcs_ptr = zend_arena_alloc(&CG(arena), sizeof(zend_class_iterator_funcs));
345		memset(class_type->iterator_funcs_ptr, 0, sizeof(zend_class_iterator_funcs));
346	}
347	if (class_type->type == ZEND_INTERNAL_CLASS) {
348		class_type->iterator_funcs_ptr->zf_new_iterator = zend_hash_str_find_ptr(&class_type->function_table, "getiterator", sizeof("getiterator") - 1);
349	}
350	return SUCCESS;
351}
352/* }}} */
353
354/* {{{ zend_implement_iterator */
355static int zend_implement_iterator(zend_class_entry *interface, zend_class_entry *class_type)
356{
357	if (class_type->get_iterator && class_type->get_iterator != zend_user_it_get_iterator) {
358		if (class_type->type == ZEND_INTERNAL_CLASS) {
359			/* inheritance ensures the class has the necessary userland methods */
360			return SUCCESS;
361		} else {
362			/* c-level get_iterator cannot be changed */
363			if (class_type->get_iterator == zend_user_it_get_new_iterator) {
364				zend_error_noreturn(E_ERROR, "Class %s cannot implement both %s and %s at the same time",
365							ZSTR_VAL(class_type->name),
366							ZSTR_VAL(interface->name),
367							ZSTR_VAL(zend_ce_aggregate->name));
368			}
369			return FAILURE;
370		}
371	}
372	class_type->get_iterator = zend_user_it_get_iterator;
373	if (class_type->iterator_funcs_ptr != NULL) {
374		class_type->iterator_funcs_ptr->zf_valid = NULL;
375		class_type->iterator_funcs_ptr->zf_current = NULL;
376		class_type->iterator_funcs_ptr->zf_key = NULL;
377		class_type->iterator_funcs_ptr->zf_next = NULL;
378		class_type->iterator_funcs_ptr->zf_rewind = NULL;
379	} else if (class_type->type == ZEND_INTERNAL_CLASS) {
380		class_type->iterator_funcs_ptr = calloc(1, sizeof(zend_class_iterator_funcs));
381	} else {
382		class_type->iterator_funcs_ptr = zend_arena_alloc(&CG(arena), sizeof(zend_class_iterator_funcs));
383		memset(class_type->iterator_funcs_ptr, 0, sizeof(zend_class_iterator_funcs));
384	}
385	if (class_type->type == ZEND_INTERNAL_CLASS) {
386		class_type->iterator_funcs_ptr->zf_rewind = zend_hash_str_find_ptr(&class_type->function_table, "rewind", sizeof("rewind") - 1);
387		class_type->iterator_funcs_ptr->zf_valid = zend_hash_str_find_ptr(&class_type->function_table, "valid", sizeof("valid") - 1);
388		class_type->iterator_funcs_ptr->zf_key = zend_hash_str_find_ptr(&class_type->function_table, "key", sizeof("key") - 1);
389		class_type->iterator_funcs_ptr->zf_current = zend_hash_str_find_ptr(&class_type->function_table, "current", sizeof("current") - 1);
390		class_type->iterator_funcs_ptr->zf_next = zend_hash_str_find_ptr(&class_type->function_table, "next", sizeof("next") - 1);
391	}
392	return SUCCESS;
393}
394/* }}} */
395
396/* {{{ zend_implement_arrayaccess */
397static int zend_implement_arrayaccess(zend_class_entry *interface, zend_class_entry *class_type)
398{
399	return SUCCESS;
400}
401/* }}}*/
402
403/* {{{ zend_user_serialize */
404ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data)
405{
406	zend_class_entry * ce = Z_OBJCE_P(object);
407	zval retval;
408	int result;
409
410	zend_call_method_with_0_params(object, ce, &ce->serialize_func, "serialize", &retval);
411
412
413	if (Z_TYPE(retval) == IS_UNDEF || EG(exception)) {
414		result = FAILURE;
415	} else {
416		switch(Z_TYPE(retval)) {
417		case IS_NULL:
418			/* we could also make this '*buf_len = 0' but this allows to skip variables */
419			zval_ptr_dtor(&retval);
420			return FAILURE;
421		case IS_STRING:
422			*buffer = (unsigned char*)estrndup(Z_STRVAL(retval), Z_STRLEN(retval));
423			*buf_len = Z_STRLEN(retval);
424			result = SUCCESS;
425			break;
426		default: /* failure */
427			result = FAILURE;
428			break;
429		}
430		zval_ptr_dtor(&retval);
431	}
432
433	if (result == FAILURE && !EG(exception)) {
434		zend_throw_exception_ex(NULL, 0, "%s::serialize() must return a string or NULL", ZSTR_VAL(ce->name));
435	}
436	return result;
437}
438/* }}} */
439
440/* {{{ zend_user_unserialize */
441ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data)
442{
443	zval zdata;
444
445	if (UNEXPECTED(object_init_ex(object, ce) != SUCCESS)) {
446		return FAILURE;
447	}
448
449	ZVAL_STRINGL(&zdata, (char*)buf, buf_len);
450
451	zend_call_method_with_1_params(object, ce, &ce->unserialize_func, "unserialize", NULL, &zdata);
452
453	zval_ptr_dtor(&zdata);
454
455	if (EG(exception)) {
456		return FAILURE;
457	} else {
458		return SUCCESS;
459	}
460}
461/* }}} */
462
463ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data) /* {{{ */
464{
465	zend_class_entry *ce = Z_OBJCE_P(object);
466	zend_throw_exception_ex(NULL, 0, "Serialization of '%s' is not allowed", ZSTR_VAL(ce->name));
467	return FAILURE;
468}
469/* }}} */
470
471ZEND_API int zend_class_unserialize_deny(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data) /* {{{ */
472{
473	zend_throw_exception_ex(NULL, 0, "Unserialization of '%s' is not allowed", ZSTR_VAL(ce->name));
474	return FAILURE;
475}
476/* }}} */
477
478/* {{{ zend_implement_serializable */
479static int zend_implement_serializable(zend_class_entry *interface, zend_class_entry *class_type)
480{
481	if (class_type->parent
482		&& (class_type->parent->serialize || class_type->parent->unserialize)
483		&& !instanceof_function_ex(class_type->parent, zend_ce_serializable, 1)) {
484		return FAILURE;
485	}
486	if (!class_type->serialize) {
487		class_type->serialize = zend_user_serialize;
488	}
489	if (!class_type->unserialize) {
490		class_type->unserialize = zend_user_unserialize;
491	}
492	return SUCCESS;
493}
494/* }}}*/
495
496/* {{{ zend_implement_countable */
497static int zend_implement_countable(zend_class_entry *interface, zend_class_entry *class_type)
498{
499	return SUCCESS;
500}
501/* }}}*/
502
503/* {{{ function tables */
504static const zend_function_entry zend_funcs_aggregate[] = {
505	ZEND_ABSTRACT_ME(iterator, getIterator, NULL)
506	ZEND_FE_END
507};
508
509static const zend_function_entry zend_funcs_iterator[] = {
510	ZEND_ABSTRACT_ME(iterator, current,  NULL)
511	ZEND_ABSTRACT_ME(iterator, next,     NULL)
512	ZEND_ABSTRACT_ME(iterator, key,      NULL)
513	ZEND_ABSTRACT_ME(iterator, valid,    NULL)
514	ZEND_ABSTRACT_ME(iterator, rewind,   NULL)
515	ZEND_FE_END
516};
517
518static const zend_function_entry *zend_funcs_traversable = NULL;
519
520ZEND_BEGIN_ARG_INFO_EX(arginfo_arrayaccess_offset, 0, 0, 1)
521	ZEND_ARG_INFO(0, offset)
522ZEND_END_ARG_INFO()
523
524ZEND_BEGIN_ARG_INFO_EX(arginfo_arrayaccess_offset_get, 0, 0, 1) /* actually this should be return by ref but atm cannot be */
525	ZEND_ARG_INFO(0, offset)
526ZEND_END_ARG_INFO()
527
528ZEND_BEGIN_ARG_INFO_EX(arginfo_arrayaccess_offset_value, 0, 0, 2)
529	ZEND_ARG_INFO(0, offset)
530	ZEND_ARG_INFO(0, value)
531ZEND_END_ARG_INFO()
532
533static const zend_function_entry zend_funcs_arrayaccess[] = {
534	ZEND_ABSTRACT_ME(arrayaccess, offsetExists, arginfo_arrayaccess_offset)
535	ZEND_ABSTRACT_ME(arrayaccess, offsetGet,    arginfo_arrayaccess_offset_get)
536	ZEND_ABSTRACT_ME(arrayaccess, offsetSet,    arginfo_arrayaccess_offset_value)
537	ZEND_ABSTRACT_ME(arrayaccess, offsetUnset,  arginfo_arrayaccess_offset)
538	ZEND_FE_END
539};
540
541ZEND_BEGIN_ARG_INFO(arginfo_serializable_serialize, 0)
542	ZEND_ARG_INFO(0, serialized)
543ZEND_END_ARG_INFO()
544
545static const zend_function_entry zend_funcs_serializable[] = {
546	ZEND_ABSTRACT_ME(serializable, serialize,   NULL)
547	ZEND_FENTRY(unserialize, NULL, arginfo_serializable_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT|ZEND_ACC_CTOR)
548	ZEND_FE_END
549};
550
551ZEND_BEGIN_ARG_INFO(arginfo_countable_count, 0)
552ZEND_END_ARG_INFO()
553
554static const zend_function_entry zend_funcs_countable[] = {
555	ZEND_ABSTRACT_ME(Countable, count, arginfo_countable_count)
556	ZEND_FE_END
557};
558/* }}} */
559
560/* {{{ zend_register_interfaces */
561ZEND_API void zend_register_interfaces(void)
562{
563	REGISTER_MAGIC_INTERFACE(traversable, Traversable);
564
565	REGISTER_MAGIC_INTERFACE(aggregate, IteratorAggregate);
566	REGISTER_MAGIC_IMPLEMENT(aggregate, traversable);
567
568	REGISTER_MAGIC_INTERFACE(iterator, Iterator);
569	REGISTER_MAGIC_IMPLEMENT(iterator, traversable);
570
571	REGISTER_MAGIC_INTERFACE(arrayaccess, ArrayAccess);
572
573	REGISTER_MAGIC_INTERFACE(serializable, Serializable);
574
575	REGISTER_MAGIC_INTERFACE(countable, Countable);
576}
577/* }}} */
578
579/*
580 * Local variables:
581 * tab-width: 4
582 * c-basic-offset: 4
583 * indent-tabs-mode: t
584 * End:
585 * vim600: sw=4 ts=4 fdm=marker
586 * vim<600: sw=4 ts=4
587 */
588