mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Make (array) false == array() and not array(false)
This commit is contained in:
parent
003ef1aa74
commit
0b1c8b455a
1 changed files with 9 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue