/* if old_exception is already an HttpRequestPoolException append the new one,
else create a new HttpRequestPoolException and append the old and new exceptions */
if (old_exception && Z_OBJCE_P(old_exception) == ce) {
- zval *exprop;
+ zval *old_exprop, *new_exprop;
- exprop = zend_read_property(ce, old_exception, "exceptionStack", lenof("exceptionStack"), 0 TSRMLS_CC);
- SEP_PROP(&exprop);
- convert_to_array(exprop);
-
- add_next_index_zval(exprop, new_exception);
- zend_update_property(ce, old_exception, "exceptionStack", lenof("exceptionStack"), exprop TSRMLS_CC);
+ MAKE_STD_ZVAL(new_exprop);
+ array_init(new_exprop);
+ old_exprop = zend_read_property(ce, old_exception, "exceptionStack", lenof("exceptionStack"), 0 TSRMLS_CC);
+ if (Z_TYPE_P(old_exprop) == IS_ARRAY) {
+ array_copy(old_exprop, new_exprop);
+ }
+ add_next_index_zval(new_exprop, new_exception);
+ zend_update_property(ce, old_exception, "exceptionStack", lenof("exceptionStack"), new_exprop TSRMLS_CC);
+ zval_ptr_dtor(&new_exprop);
EG(exception) = old_exception;
} else if (new_exception && Z_OBJCE_P(new_exception) != ce){
if (Z_TYPE_PP(tmp) != IS_ARRAY) { \
convert_to_array_ex(tmp); \
} \
+ ZVAL_ADDREF(*data); \
add_next_index_zval(*tmp, *data); \
} else { \
+ ZVAL_ADDREF(*data); \
add_assoc_zval(dst, key, *data); \
} \
- ZVAL_ADDREF(*data); \
key = NULL; \
} \
} \
# define ACC_PROP_PUBLIC(flags) (flags & ZEND_ACC_PUBLIC)
# define ACC_PROP(ce, flags) (ACC_PROP_PUBLIC(flags) || ACC_PROP_PRIVATE(ce, flags) || ACC_PROP_PROTECTED(ce, flags))
-# define INIT_PARR(o, n) \
- { \
- zval *__tmp; \
- MAKE_STD_ZVAL(__tmp); \
- array_init(__tmp); \
- SET_PROP(o, n, __tmp); \
- }
-
-# define FREE_PARR(o, p) \
- { \
- zval *__tmp = GET_PROP(o, p); \
- if (__tmp) { \
- zval_ptr_dtor(&__tmp); \
- } \
- }
-
-/*
- * the property *MUST* be updated after SEP_PROP()
- */
-# define SEP_PROP(zpp) \
- { \
- zval **op = zpp; \
- SEPARATE_ZVAL_IF_NOT_REF(zpp); \
- if (op != zpp) { \
- zval_ptr_dtor(op); \
- } \
- }
-
# define SET_EH_THROW() SET_EH_THROW_EX(zend_exception_get_default())
# define SET_EH_THROW_HTTP() SET_EH_THROW_EX(http_exception_get_default())
# define SET_EH_THROW_EX(ex) php_set_error_handling(EH_THROW, ex TSRMLS_CC)