summaryrefslogtreecommitdiff
path: root/Zend/zend_operators.c
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2010-06-26 17:14:33 +0000
committerFelipe Pena <felipe@php.net>2010-06-26 17:14:33 +0000
commit9ea7a70e24bc41cd5981e0fd16a9d7eb8fee6f39 (patch)
tree6eb8d2c09d6c159cfd4424184d471a3f0417c308 /Zend/zend_operators.c
parente64734f986a2e7db28f467d22a350d7c457ff4b4 (diff)
downloadphp-git-9ea7a70e24bc41cd5981e0fd16a9d7eb8fee6f39.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.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index 7ce2e6283a..24a2b1e417 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 *));