From 0b1c8b455aee2bbf693f3b883dda29aaee05eae5 Mon Sep 17 00:00:00 2001 From: Zeev Suraski Date: Sun, 13 Feb 2000 00:52:33 +0000 Subject: [PATCH] Make (array) false == array() and not array(false) --- Zend/zend_operators.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index a2888ab7e9..f76cbb8849 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -402,6 +402,10 @@ ZEND_API void convert_to_array(zval *op) op->type = IS_ARRAY; op->value.ht = op->value.obj.properties; return; + case IS_NULL: + ALLOC_HASHTABLE(op->value.ht); + zend_hash_init(op->value.ht, 0, NULL, ZVAL_PTR_DTOR, 0); + op->type = IS_ARRAY; break; default: convert_scalar_to_array(op, IS_ARRAY); @@ -421,6 +425,11 @@ ZEND_API void convert_to_object(zval *op) break; case IS_OBJECT: return; + case IS_NULL: + ALLOC_HASHTABLE(op->value.obj.properties); + zend_hash_init(op->value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0); + op->value.obj.ce = &zend_standard_class_def; + op->type = IS_OBJECT; break; default: convert_scalar_to_array(op, IS_OBJECT); -- 2.50.1