mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
Add get_dim callback
This commit is contained in:
parent
ed97b9fb6e
commit
3cfa6a68f4
@ -920,6 +920,17 @@ static void zend_fetch_dimension_address(znode *result, znode *op1, znode *op2,
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case IS_OBJECT:
|
||||
if (type == BP_VAR_R) {
|
||||
zval *dim = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
|
||||
zval *overloaded_result = Z_OBJ_HT_P(container)->read_dimension(container, dim TSRMLS_CC);
|
||||
|
||||
*retval = &overloaded_result;
|
||||
AI_USE_PTR(T(result->u.var).var);
|
||||
FREE_OP(Ts, op2, EG(free_op2));
|
||||
SELECTIVE_PZVAL_LOCK(**retval, result);
|
||||
}
|
||||
break;
|
||||
default: {
|
||||
zval *offset;
|
||||
|
||||
|
@ -335,11 +335,28 @@ static void zend_std_write_property(zval *object, zval *member, zval *value TSRM
|
||||
}
|
||||
}
|
||||
|
||||
zval *zend_std_read_dimension(zval *object, zval *offset TSRMLS_DC)
|
||||
{
|
||||
#if 1
|
||||
zend_error(E_ERROR, "Cannot use object as array");
|
||||
#else
|
||||
zend_printf("Fetching from object: ");
|
||||
zend_print_zval(object, 0);
|
||||
|
||||
zend_printf("\n the offset: ");
|
||||
zend_print_zval(offset, 0);
|
||||
|
||||
zend_printf("\n");
|
||||
#endif
|
||||
return EG(uninitialized_zval_ptr);
|
||||
}
|
||||
|
||||
|
||||
static void zend_std_write_dimension(zval *object, zval *offset, zval *value TSRMLS_DC)
|
||||
{
|
||||
#if 1
|
||||
zend_error(E_ERROR, "Cannot use object as array");
|
||||
#if 0
|
||||
#else
|
||||
zend_printf("Assigning to object: ");
|
||||
zend_print_zval(object, 0);
|
||||
|
||||
@ -348,9 +365,9 @@ static void zend_std_write_dimension(zval *object, zval *offset, zval *value TSR
|
||||
|
||||
zend_printf("\n the value: ");
|
||||
zend_print_zval(value, 0);
|
||||
#endif
|
||||
|
||||
zend_printf("\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -835,6 +852,7 @@ zend_object_handlers std_object_handlers = {
|
||||
|
||||
zend_std_read_property, /* read_property */
|
||||
zend_std_write_property, /* write_property */
|
||||
zend_std_read_dimension, /* read_dimension */
|
||||
zend_std_write_dimension, /* write_dimension */
|
||||
zend_std_get_property_ptr, /* get_property_ptr */
|
||||
zend_std_get_property_ptr, /* get_property_zval_ptr */
|
||||
|
@ -27,6 +27,9 @@ union _zend_function;
|
||||
/* Used to fetch property from the object, read-only */
|
||||
typedef zval *(*zend_object_read_property_t)(zval *object, zval *member TSRMLS_DC);
|
||||
|
||||
/* Used to fetch dimension from the object, read-only */
|
||||
typedef zval *(*zend_object_read_dimension_t)(zval *object, zval *offset TSRMLS_DC);
|
||||
|
||||
/* Used to set property of the object */
|
||||
typedef void (*zend_object_write_property_t)(zval *object, zval *member, zval *value TSRMLS_DC);
|
||||
|
||||
@ -88,6 +91,7 @@ typedef struct _zend_object_handlers {
|
||||
/* individual object functions */
|
||||
zend_object_read_property_t read_property;
|
||||
zend_object_write_property_t write_property;
|
||||
zend_object_read_dimension_t read_dimension;
|
||||
zend_object_write_dimension_t write_dimension;
|
||||
zend_object_get_property_ptr_t get_property_ptr;
|
||||
zend_object_get_property_zval_ptr_t get_property_zval_ptr;
|
||||
|
@ -273,6 +273,7 @@ static zend_object_handlers zend_object_proxy_handlers = {
|
||||
|
||||
NULL, /* read_property */
|
||||
NULL, /* write_property */
|
||||
NULL, /* read dimension */
|
||||
NULL, /* write_dimension */
|
||||
NULL, /* get_property_ptr */
|
||||
NULL, /* get_property_zval_ptr */
|
||||
|
Loading…
Reference in New Issue
Block a user