Skip to content
Newer
Older
100755 441 lines (384 sloc) 13.3 KB
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
1 /*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
ccfc46b - Happy new year and PHP 5 for rest of the files too..
foobar authored
5 | Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
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 /* $Id$ */
20
21 #include "zend.h"
22 #include "zend_API.h"
23 #include "zend_interfaces.h"
24
25 zend_class_entry *zend_ce_traversable;
26 zend_class_entry *zend_ce_aggregate;
27 zend_class_entry *zend_ce_iterator;
4dba05d Add new interface ArrayAccess to use objects as Arrays
Marcus Boerger authored
28 zend_class_entry *zend_ce_arrayaccess;
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
29
30 /* {{{ zend_call_method
31 Only returns the returned zval if retval_ptr != NULL */
32 ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, char *function_name, int function_name_len, zval **retval_ptr_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC)
33 {
34 int result;
35 zend_fcall_info fci;
36 zval z_fname;
37 zval *retval;
38
39 zval **params[2];
40
41 params[0] = &arg1;
42 params[1] = &arg2;
43
44 fci.size = sizeof(fci);
45 /*fci.function_table = NULL; will be read form zend_class_entry of object if needed */
46 fci.object_pp = object_pp;
47 fci.function_name = &z_fname;
48 fci.retval_ptr_ptr = retval_ptr_ptr ? retval_ptr_ptr : &retval;
49 fci.param_count = param_count;
50 fci.params = params;
51 fci.no_separation = 1;
52 fci.symbol_table = NULL;
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(&z_fname, function_name, function_name_len, 0);
58 result = zend_call_function(&fci, NULL TSRMLS_CC);
59 } else {
60 zend_fcall_info_cache fcic;
61
62 fcic.initialized = 1;
63 if (!obj_ce) {
64 obj_ce = Z_OBJCE_PP(object_pp);
65 }
66 if (!fn_proxy || !*fn_proxy) {
67 if (zend_hash_find(&obj_ce->function_table, function_name, function_name_len+1, (void **) &fcic.function_handler) == FAILURE) {
68 /* error at c-level */
69 zend_error(E_CORE_ERROR, "Couldn't find implementation for method %s::%s", obj_ce->name, function_name);
70 }
71 if (fn_proxy) {
72 *fn_proxy = fcic.function_handler;
73 }
74 } else {
75 fcic.function_handler = *fn_proxy;
76 }
77 fcic.calling_scope = obj_ce;
78 fcic.object_pp = object_pp;
79 result = zend_call_function(&fci, &fcic TSRMLS_CC);
80 }
81 if (result == FAILURE) {
82 /* error at c-level */
83 if (!obj_ce) {
84 obj_ce = Z_OBJCE_PP(object_pp);
85 }
86 zend_error(E_CORE_ERROR, "Couldn't execute method %s::%s", obj_ce->name, function_name);
87 }
88 if (!retval_ptr_ptr) {
89 if (retval) {
39df192 Correct destruction
Marcus Boerger authored
90 zval_ptr_dtor(&retval);
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
91 }
92 return NULL;
93 }
94 return *retval_ptr_ptr;
95 }
96 /* }}} */
97
98 /* iterator interface, c-level functions used by engine */
99
6186617 - Export struct zend_user_iterator
Marcus Boerger authored
100 /* {{{ zend_user_it_new_iterator */
101 static zval *zend_user_it_new_iterator(zend_class_entry *ce, zval *object TSRMLS_DC)
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
102 {
103 zval *retval;
104
105 return zend_call_method_with_0_params(&object, ce, &ce->iterator_funcs.zf_new_iterator, "getiterator", &retval);
5824641 IteratorAggregate::getIterator() cannot return anythingy else than ob…
Marcus Boerger authored
106
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
107 }
108 /* }}} */
109
6186617 - Export struct zend_user_iterator
Marcus Boerger authored
110 /* {{{ zend_user_it_dtor */
111 ZEND_API void zend_user_it_free_current(zend_object_iterator *_iter TSRMLS_DC)
112 {
113 zend_user_iterator *iter = (zend_user_iterator*)_iter;
114
115 if (iter->value) {
116 zval_ptr_dtor(&iter->value);
117 iter->value = NULL;
118 }
119 }
120 /* }}} */
121
122 /* {{{ zend_user_it_dtor */
123 static void zend_user_it_dtor(zend_object_iterator *_iter TSRMLS_DC)
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
124 {
125 zend_user_iterator *iter = (zend_user_iterator*)_iter;
126 zval *object = (zval*)iter->it.data;
127
128 if (iter->value) {
129 zval_ptr_dtor(&iter->value);
130 iter->value = NULL;
131 }
132 zval_ptr_dtor(&object);
133 efree(iter);
134 }
135 /* }}} */
136
6186617 - Export struct zend_user_iterator
Marcus Boerger authored
137 /* {{{ zend_user_it_has_more */
138 static int zend_user_it_has_more(zend_object_iterator *_iter TSRMLS_DC)
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
139 {
f9d1309 Prevent some SEGV's when Exceptions are thorown inside iterators.
Marcus Boerger authored
140 if (_iter) {
141 zend_user_iterator *iter = (zend_user_iterator*)_iter;
142 zval *object = (zval*)iter->it.data;
143 zval *more;
144 int result;
145
b6b7c9e Rename hasMore() to valid() as discussed. (Part I)
Marcus Boerger authored
146 zend_call_method_with_0_params(&object, iter->ce, &iter->ce->iterator_funcs.zf_has_more, "valid", &more);
f9d1309 Prevent some SEGV's when Exceptions are thorown inside iterators.
Marcus Boerger authored
147 if (more) {
148 result = i_zend_is_true(more);
b29834a Use correct macro/function
Marcus Boerger authored
149 zval_ptr_dtor(&more);
f9d1309 Prevent some SEGV's when Exceptions are thorown inside iterators.
Marcus Boerger authored
150 return result ? SUCCESS : FAILURE;
151 }
152 }
153 return FAILURE;
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
154 }
155 /* }}} */
156
6186617 - Export struct zend_user_iterator
Marcus Boerger authored
157 /* {{{ zend_user_it_get_current_data */
158 static void zend_user_it_get_current_data(zend_object_iterator *_iter, zval ***data TSRMLS_DC)
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
159 {
160 zend_user_iterator *iter = (zend_user_iterator*)_iter;
161 zval *object = (zval*)iter->it.data;
162
163 if (!iter->value) {
164 zend_call_method_with_0_params(&object, iter->ce, &iter->ce->iterator_funcs.zf_current, "current", &iter->value);
165 }
166 *data = &iter->value;
167 }
168 /* }}} */
169
6186617 - Export struct zend_user_iterator
Marcus Boerger authored
170 /* {{{ zend_user_it_get_current_key_default */
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
171 #if 0
6186617 - Export struct zend_user_iterator
Marcus Boerger authored
172 static int zend_user_it_get_current_key_default(zend_object_iterator *_iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
173 {
da6d68d Little iterator improvement: ability to store index in iterator
Marcus Boerger authored
174 *int_key = _iter->index;
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
175 return HASH_KEY_IS_LONG;
176 }
177 #endif
178 /* }}} */
179
6186617 - Export struct zend_user_iterator
Marcus Boerger authored
180 /* {{{ zend_user_it_get_current_key */
181 static int zend_user_it_get_current_key(zend_object_iterator *_iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
182 {
183 zend_user_iterator *iter = (zend_user_iterator*)_iter;
184 zval *object = (zval*)iter->it.data;
185 zval *retval;
186
187 zend_call_method_with_0_params(&object, iter->ce, &iter->ce->iterator_funcs.zf_key, "key", &retval);
188
189 switch (retval->type) {
190 default:
191 zend_error(E_WARNING, "Illegal type returned from %s::key()", iter->ce->name);
192 case IS_NULL:
193 *str_key = "";
194 *str_key_len = 0;
195 *int_key = 0;
196 zval_ptr_dtor(&retval);
197 return HASH_KEY_IS_LONG;
198
199 case IS_STRING:
200 *str_key = estrndup(retval->value.str.val, retval->value.str.len);
201 *str_key_len = retval->value.str.len+1;
202 *int_key = 0;
203 zval_ptr_dtor(&retval);
204 return HASH_KEY_IS_STRING;
205
206 case IS_DOUBLE:
207 case IS_RESOURCE:
208 case IS_BOOL:
209 case IS_LONG: {
210 if (retval->type == IS_DOUBLE) {
211 *int_key = (long)retval->value.dval;
212 } else {
213 *int_key = retval->value.lval;
214 }
215 }
216 zval_ptr_dtor(&retval);
217 return HASH_KEY_IS_LONG;
218 }
219 }
220 /* }}} */
221
6186617 - Export struct zend_user_iterator
Marcus Boerger authored
222 /* {{{ zend_user_it_move_forward */
223 static void zend_user_it_move_forward(zend_object_iterator *_iter TSRMLS_DC)
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
224 {
225 zend_user_iterator *iter = (zend_user_iterator*)_iter;
226 zval *object = (zval*)iter->it.data;
227
228 if (iter->value) {
229 zval_ptr_dtor(&iter->value);
230 iter->value = NULL;
231 }
232 zend_call_method_with_0_params(&object, iter->ce, &iter->ce->iterator_funcs.zf_next, "next", NULL);
233 }
234 /* }}} */
235
6186617 - Export struct zend_user_iterator
Marcus Boerger authored
236 /* {{{ zend_user_it_rewind */
237 static void zend_user_it_rewind(zend_object_iterator *_iter TSRMLS_DC)
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
238 {
239 zend_user_iterator *iter = (zend_user_iterator*)_iter;
240 zval *object = (zval*)iter->it.data;
241
242 zend_call_method_with_0_params(&object, iter->ce, &iter->ce->iterator_funcs.zf_rewind, "rewind", NULL);
243 }
244 /* }}} */
245
246 zend_object_iterator_funcs zend_interface_iterator_funcs_iterator = {
6186617 - Export struct zend_user_iterator
Marcus Boerger authored
247 zend_user_it_dtor,
248 zend_user_it_has_more,
249 zend_user_it_get_current_data,
250 zend_user_it_get_current_key,
251 zend_user_it_move_forward,
252 zend_user_it_rewind
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
253 };
254
6186617 - Export struct zend_user_iterator
Marcus Boerger authored
255 /* {{{ zend_user_it_get_iterator */
256 static zend_object_iterator *zend_user_it_get_iterator(zend_class_entry *ce, zval *object TSRMLS_DC)
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
257 {
258 zend_user_iterator *iterator = emalloc(sizeof(zend_user_iterator));
259
260 object->refcount++;
261 iterator->it.data = (void*)object;
262 iterator->it.funcs = ce->iterator_funcs.funcs;
263 iterator->ce = Z_OBJCE_P(object);
264 iterator->value = NULL;
265 return (zend_object_iterator*)iterator;
266 }
267 /* }}} */
268
6186617 - Export struct zend_user_iterator
Marcus Boerger authored
269 /* {{{ zend_user_it_get_new_iterator */
270 static zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *ce, zval *object TSRMLS_DC)
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
271 {
6186617 - Export struct zend_user_iterator
Marcus Boerger authored
272 zval *iterator = zend_user_it_new_iterator(ce, object TSRMLS_CC);
c978cc2 Use correct order
Marcus Boerger authored
273 zend_object_iterator *new_iterator;
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
274
5824641 IteratorAggregate::getIterator() cannot return anythingy else than ob…
Marcus Boerger authored
275 zend_class_entry *ce_it = Z_TYPE_P(iterator) == IS_OBJECT ? Z_OBJCE_P(iterator) : NULL;
276
277 if (!ce || !ce_it || !ce_it->get_iterator) {
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
278 zend_error(E_WARNING, "Objects returned by %s::getIterator() must be traversable or implement interface Iterator", ce->name);
5824641 IteratorAggregate::getIterator() cannot return anythingy else than ob…
Marcus Boerger authored
279 zval_ptr_dtor(&iterator);
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
280 return NULL;
281 }
c978cc2 Use correct order
Marcus Boerger authored
282 new_iterator = ce_it->get_iterator(ce_it, iterator TSRMLS_CC);
283 zval_ptr_dtor(&iterator);
284 return new_iterator;
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
285 }
286 /* }}} */
287
288 /* {{{ zend_implement_traversable */
289 static int zend_implement_traversable(zend_class_entry *interface, zend_class_entry *class_type TSRMLS_DC)
290 {
291 /* check that class_type is traversable at c-level or implements at least one of 'aggregate' and 'Iterator' */
292 int i;
293
64c7645 #where has my bracket been gone?
Marcus Boerger authored
294 if (class_type->get_iterator || (class_type->parent && class_type->parent->get_iterator)) {
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
295 return SUCCESS;
296 }
297 for (i = 0; i < class_type->num_interfaces; i++) {
298 if (class_type->interfaces[i] == zend_ce_aggregate || class_type->interfaces[i] == zend_ce_iterator) {
299 return SUCCESS;
300 }
301 }
302 zend_error(E_CORE_ERROR, "Class %s must implement interface %s as part of either %s or %s",
303 class_type->name,
304 zend_ce_traversable->name,
305 zend_ce_iterator->name,
306 zend_ce_aggregate->name);
307 return FAILURE;
308 }
309 /* }}} */
310
311 /* {{{ zend_implement_aggregate */
312 static int zend_implement_aggregate(zend_class_entry *interface, zend_class_entry *class_type TSRMLS_DC)
313 {
851a02e Give some freedon to c iterators but not in userspace.
Marcus Boerger authored
314 if (class_type->get_iterator) {
315 if (class_type->type == ZEND_INTERNAL_CLASS) {
316 /* inheritance ensures the class has necessary userland methods */
317 return SUCCESS;
6186617 - Export struct zend_user_iterator
Marcus Boerger authored
318 } else if (class_type->get_iterator != zend_user_it_get_new_iterator) {
851a02e Give some freedon to c iterators but not in userspace.
Marcus Boerger authored
319 /* c-level get_iterator cannot be changed */
320 return FAILURE;
321 }
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
322 }
323 class_type->iterator_funcs.zf_new_iterator = NULL;
6186617 - Export struct zend_user_iterator
Marcus Boerger authored
324 class_type->get_iterator = zend_user_it_get_new_iterator;
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
325 return SUCCESS;
326 }
327 /* }}} */
328
329 /* {{{ zend_implement_iterator */
330 static int zend_implement_iterator(zend_class_entry *interface, zend_class_entry *class_type TSRMLS_DC)
331 {
6186617 - Export struct zend_user_iterator
Marcus Boerger authored
332 if (class_type->get_iterator && class_type->get_iterator != zend_user_it_get_iterator) {
851a02e Give some freedon to c iterators but not in userspace.
Marcus Boerger authored
333 if (class_type->type == ZEND_INTERNAL_CLASS) {
334 /* inheritance ensures the class has the necessary userland methods */
335 return SUCCESS;
6186617 - Export struct zend_user_iterator
Marcus Boerger authored
336 } else if (class_type->get_iterator != zend_user_it_get_new_iterator) {
851a02e Give some freedon to c iterators but not in userspace.
Marcus Boerger authored
337 /* c-level get_iterator cannot be changed */
338 return FAILURE;
339 }
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
340 }
6186617 - Export struct zend_user_iterator
Marcus Boerger authored
341 class_type->get_iterator = zend_user_it_get_iterator;
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
342 class_type->iterator_funcs.zf_has_more = NULL;
343 class_type->iterator_funcs.zf_current = NULL;
344 class_type->iterator_funcs.zf_key = NULL;
345 class_type->iterator_funcs.zf_next = NULL;
346 class_type->iterator_funcs.zf_rewind = NULL;
347 if (!class_type->iterator_funcs.funcs) {
348 class_type->iterator_funcs.funcs = &zend_interface_iterator_funcs_iterator;
349 }
350 return SUCCESS;
351 }
352 /* }}} */
353
4dba05d Add new interface ArrayAccess to use objects as Arrays
Marcus Boerger authored
354 /* {{{ zend_implement_arrayaccess */
355 static int zend_implement_arrayaccess(zend_class_entry *interface, zend_class_entry *class_type TSRMLS_DC)
356 {
6186617 - Export struct zend_user_iterator
Marcus Boerger authored
357 #if 0
358 /* get ht from ce */
359 if (ht->read_dimension != zend_std_read_dimension
360 || ht->write_dimension != zend_std_write_dimension
361 || ht->has_dimension != zend_std_has_dimension
362 || ht->unset_dimension != zend_std_unset_dimension) {
363 return FAILURE;
364 }
365 #endif
4dba05d Add new interface ArrayAccess to use objects as Arrays
Marcus Boerger authored
366 return SUCCESS;
367 }
368 /* }}}*/
369
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
370 /* {{{ function tables */
371 zend_function_entry zend_funcs_aggregate[] = {
372 ZEND_ABSTRACT_ME(iterator, getIterator, NULL)
373 {NULL, NULL, NULL}
374 };
375
376 zend_function_entry zend_funcs_iterator[] = {
377 ZEND_ABSTRACT_ME(iterator, current, NULL)
378 ZEND_ABSTRACT_ME(iterator, next, NULL)
379 ZEND_ABSTRACT_ME(iterator, key, NULL)
b6b7c9e Rename hasMore() to valid() as discussed. (Part I)
Marcus Boerger authored
380 ZEND_ABSTRACT_ME(iterator, valid, NULL)
da6d68d Little iterator improvement: ability to store index in iterator
Marcus Boerger authored
381 ZEND_ABSTRACT_ME(iterator, rewind, NULL)
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
382 {NULL, NULL, NULL}
383 };
384
385 zend_function_entry *zend_funcs_traversable = NULL;
4dba05d Add new interface ArrayAccess to use objects as Arrays
Marcus Boerger authored
386
387 static
e7e0f7d @zsuraski - Check return-by-reference bit when implementing interface prototypes
zsuraski authored
388 ZEND_BEGIN_ARG_INFO(arginfo_arrayaccess_offset, 0)
4dba05d Add new interface ArrayAccess to use objects as Arrays
Marcus Boerger authored
389 ZEND_ARG_INFO(0, offset)
390 ZEND_END_ARG_INFO();
391
392 static
393 ZEND_BEGIN_ARG_INFO(arginfo_arrayaccess_offset_value, 0)
394 ZEND_ARG_INFO(0, offset)
395 ZEND_ARG_INFO(0, value)
396 ZEND_END_ARG_INFO();
397
398 zend_function_entry zend_funcs_arrayaccess[] = {
399 ZEND_ABSTRACT_ME(arrayaccess, offsetExists, arginfo_arrayaccess_offset)
400 ZEND_ABSTRACT_ME(arrayaccess, offsetGet, arginfo_arrayaccess_offset)
401 ZEND_ABSTRACT_ME(arrayaccess, offsetSet, arginfo_arrayaccess_offset_value)
402 ZEND_ABSTRACT_ME(arrayaccess, offsetUnset, arginfo_arrayaccess_offset)
403 {NULL, NULL, NULL}
404 };
405
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
406 /* }}} */
407
408 #define REGISTER_ITERATOR_INTERFACE(class_name, class_name_str) \
409 {\
410 zend_class_entry ce;\
411 INIT_CLASS_ENTRY(ce, # class_name_str, zend_funcs_ ## class_name) \
412 zend_ce_ ## class_name = zend_register_internal_interface(&ce TSRMLS_CC);\
413 zend_ce_ ## class_name->interface_gets_implemented = zend_implement_ ## class_name;\
414 }
415
416 #define REGISTER_ITERATOR_IMPLEMENT(class_name, interface_name) \
417 zend_class_implements(zend_ce_ ## class_name TSRMLS_CC, 1, zend_ce_ ## interface_name)
418
419 /* {{{ zend_register_interfaces */
420 ZEND_API void zend_register_interfaces(TSRMLS_D)
421 {
422 REGISTER_ITERATOR_INTERFACE(traversable, Traversable);
423
424 REGISTER_ITERATOR_INTERFACE(aggregate, IteratorAggregate);
425 REGISTER_ITERATOR_IMPLEMENT(aggregate, traversable);
426
427 REGISTER_ITERATOR_INTERFACE(iterator, Iterator);
428 REGISTER_ITERATOR_IMPLEMENT(iterator, traversable);
4dba05d Add new interface ArrayAccess to use objects as Arrays
Marcus Boerger authored
429
430 REGISTER_ITERATOR_INTERFACE(arrayaccess, ArrayAccess);
8abb3bd Impement userspace iterator interfaces and tests. See tests for details
Marcus Boerger authored
431 }
432 /* }}} */
433
434 /*
435 * Local variables:
436 * tab-width: 4
437 * c-basic-offset: 4
438 * indent-tabs-mode: t
439 * End:
440 */
Something went wrong with that request. Please try again.