}
/* }}} */
+ZEND_API HashTable *zend_std_build_object_properties_array(zend_object *zobj) /* {{{ */
+{
+ zend_property_info *prop_info;
+ zend_class_entry *ce = zobj->ce;
+ HashTable *ht;
+ zval* prop;
+ int i;
+
+ ZEND_ASSERT(!zobj->properties);
+ ht = zend_new_array(ce->default_properties_count);
+ if (ce->default_properties_count) {
+ zend_hash_real_init_mixed(ht);
+ for (i = 0; i < ce->default_properties_count; i++) {
+ prop_info = ce->properties_info_table[i];
+
+ if (!prop_info) {
+ continue;
+ }
+
+ prop = OBJ_PROP(zobj, prop_info->offset);
+ if (UNEXPECTED(Z_TYPE_P(prop) == IS_UNDEF)) {
+ continue;
+ }
+
+ Z_TRY_ADDREF_P(prop);
+ _zend_hash_append(ht, prop_info->name, prop);
+ }
+ }
+ return ht;
+}
+/* }}} */
+
ZEND_API HashTable *zend_std_get_properties(zend_object *zobj) /* {{{ */
{
if (!zobj->properties) {
ZEND_API int zend_std_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, bool check_only);
ZEND_API void rebuild_object_properties(zend_object *zobj);
+ZEND_API HashTable *zend_std_build_object_properties_array(zend_object *zobj);
+
/* Handler for objects that cannot be meaningfully compared.
* Only objects with the same identity will be considered equal. */
ZEND_API int zend_objects_not_comparable(zval *o1, zval *o2);
case IS_OBJECT:
if (Z_OBJCE_P(op) == zend_ce_closure) {
convert_scalar_to_array(op);
+ } else if (Z_OBJ_P(op)->properties == NULL
+ && Z_OBJ_HT_P(op)->get_properties_for == NULL
+ && Z_OBJ_HT_P(op)->get_properties == zend_std_get_properties) {
+ /* Optimized version without rebulding properties HashTable */
+ HashTable *ht = zend_std_build_object_properties_array(Z_OBJ_P(op));
+ OBJ_RELEASE(Z_OBJ_P(op));
+ ZVAL_ARR(op, ht);
} else {
HashTable *obj_ht = zend_get_properties_for(op, ZEND_PROP_PURPOSE_ARRAY_CAST);
if (obj_ht) {
} else {
ZVAL_EMPTY_ARRAY(result);
}
+ } else if (Z_OBJ_P(expr)->properties == NULL
+ && Z_OBJ_HT_P(expr)->get_properties_for == NULL
+ && Z_OBJ_HT_P(expr)->get_properties == zend_std_get_properties) {
+ /* Optimized version without rebulding properties HashTable */
+ ZVAL_ARR(result, zend_std_build_object_properties_array(Z_OBJ_P(expr)));
} else {
HashTable *obj_ht = zend_get_properties_for(expr, ZEND_PROP_PURPOSE_ARRAY_CAST);
if (obj_ht) {
} else {
ZVAL_EMPTY_ARRAY(result);
}
+ } else if (Z_OBJ_P(expr)->properties == NULL
+ && Z_OBJ_HT_P(expr)->get_properties_for == NULL
+ && Z_OBJ_HT_P(expr)->get_properties == zend_std_get_properties) {
+ /* Optimized version without rebulding properties HashTable */
+ ZVAL_ARR(result, zend_std_build_object_properties_array(Z_OBJ_P(expr)));
} else {
HashTable *obj_ht = zend_get_properties_for(expr, ZEND_PROP_PURPOSE_ARRAY_CAST);
if (obj_ht) {
} else {
ZVAL_EMPTY_ARRAY(result);
}
+ } else if (Z_OBJ_P(expr)->properties == NULL
+ && Z_OBJ_HT_P(expr)->get_properties_for == NULL
+ && Z_OBJ_HT_P(expr)->get_properties == zend_std_get_properties) {
+ /* Optimized version without rebulding properties HashTable */
+ ZVAL_ARR(result, zend_std_build_object_properties_array(Z_OBJ_P(expr)));
} else {
HashTable *obj_ht = zend_get_properties_for(expr, ZEND_PROP_PURPOSE_ARRAY_CAST);
if (obj_ht) {
} else {
ZVAL_EMPTY_ARRAY(result);
}
+ } else if (Z_OBJ_P(expr)->properties == NULL
+ && Z_OBJ_HT_P(expr)->get_properties_for == NULL
+ && Z_OBJ_HT_P(expr)->get_properties == zend_std_get_properties) {
+ /* Optimized version without rebulding properties HashTable */
+ ZVAL_ARR(result, zend_std_build_object_properties_array(Z_OBJ_P(expr)));
} else {
HashTable *obj_ht = zend_get_properties_for(expr, ZEND_PROP_PURPOSE_ARRAY_CAST);
if (obj_ht) {
} else {
ZVAL_EMPTY_ARRAY(result);
}
+ } else if (Z_OBJ_P(expr)->properties == NULL
+ && Z_OBJ_HT_P(expr)->get_properties_for == NULL
+ && Z_OBJ_HT_P(expr)->get_properties == zend_std_get_properties) {
+ /* Optimized version without rebulding properties HashTable */
+ ZVAL_ARR(result, zend_std_build_object_properties_array(Z_OBJ_P(expr)));
} else {
HashTable *obj_ht = zend_get_properties_for(expr, ZEND_PROP_PURPOSE_ARRAY_CAST);
if (obj_ht) {