diff options
| author | Felipe Pena <felipe@php.net> | 2010-06-26 17:14:33 +0000 |
|---|---|---|
| committer | Felipe Pena <felipe@php.net> | 2010-06-26 17:14:33 +0000 |
| commit | 87c87daaf356e55b6ba062672429d80b566c4adf (patch) | |
| tree | a3180fed7dfecea46484f7a26be9ad07c369aae7 /Zend/zend_operators.c | |
| parent | 80926568f19901678754d37e3b4039ad2b1ffb48 (diff) | |
| download | php-git-87c87daaf356e55b6ba062672429d80b566c4adf.tar.gz | |
- Fixed bug #52193 (converting closure to array yields empty array)
Diffstat (limited to 'Zend/zend_operators.c')
| -rw-r--r-- | Zend/zend_operators.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 4d69c622f3..3a89c9c71f 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -30,6 +30,7 @@ #include "zend_multiply.h" #include "zend_strtod.h" #include "zend_exceptions.h" +#include "zend_closures.h" #define LONG_SIGN_MASK (1L << (8*sizeof(long)-1)) @@ -646,7 +647,14 @@ ZEND_API void convert_to_array(zval *op) /* {{{ */ ALLOC_HASHTABLE(ht); zend_hash_init(ht, 0, NULL, ZVAL_PTR_DTOR, 0); - if (Z_OBJ_HT_P(op)->get_properties) { + if (Z_OBJCE_P(op) == zend_ce_closure) { + convert_scalar_to_array(op, IS_ARRAY TSRMLS_CC); + if (Z_TYPE_P(op) == IS_ARRAY) { + zend_hash_destroy(ht); + FREE_HASHTABLE(ht); + return; + } + } else if (Z_OBJ_HT_P(op)->get_properties) { HashTable *obj_ht = Z_OBJ_HT_P(op)->get_properties(op TSRMLS_CC); if (obj_ht) { zend_hash_copy(ht, obj_ht, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); |
