cvs: ZendEngine2 / zend_compile.c zend_compile.h zend_execute.c zend_object_handlers.c zend_object_handlers.h zend_objects_API.c

From: Date: Mon, 10 Nov 2003 16:14:44 +0000
Subject: cvs: ZendEngine2 / zend_compile.c zend_compile.h zend_execute.c zend_object_handlers.c zend_object_handlers.h zend_objects_API.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-1973@lists.php.net to get a copy of this message
helly Mon Nov 10 11:14:44 2003 EDT Modified files: /ZendEngine2 zend_compile.c zend_compile.h zend_execute.c zend_object_handlers.c zend_object_handlers.h zend_objects_API.c Log: Split isset/isempty for object property and object dimension hooking. Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.491 ZendEngine2/zend_compile.c:1.492 --- ZendEngine2/zend_compile.c:1.491 Fri Nov 7 05:22:16 2003 +++ ZendEngine2/zend_compile.c Mon Nov 10 11:14:44 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.491 2003/11/07 10:22:16 helly Exp $ */ +/* $Id: zend_compile.c,v 1.492 2003/11/10 16:14:44 helly Exp $ */ #include "zend_language_parser.h" #include "zend.h" @@ -3050,8 +3050,10 @@ last_op->opcode = ZEND_ISSET_ISEMPTY_VAR; break; case ZEND_FETCH_DIM_IS: - case ZEND_FETCH_OBJ_IS: last_op->opcode = ZEND_ISSET_ISEMPTY_DIM_OBJ; + break; + case ZEND_FETCH_OBJ_IS: + last_op->opcode = ZEND_ISSET_ISEMPTY_PROP_OBJ; break; } last_op->result.op_type = IS_TMP_VAR; Index: ZendEngine2/zend_compile.h diff -u ZendEngine2/zend_compile.h:1.261 ZendEngine2/zend_compile.h:1.262 --- ZendEngine2/zend_compile.h:1.261 Wed Oct 22 15:59:58 2003 +++ ZendEngine2/zend_compile.h Mon Nov 10 11:14:44 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.h,v 1.261 2003/10/22 19:59:58 helly Exp $ */ +/* $Id: zend_compile.h,v 1.262 2003/11/10 16:14:44 helly Exp $ */ #ifndef ZEND_COMPILE_H #define ZEND_COMPILE_H @@ -672,6 +672,8 @@ #define ZEND_VERIFY_ABSTRACT_CLASS 146 #define ZEND_ASSIGN_DIM 147 + +#define ZEND_ISSET_ISEMPTY_PROP_OBJ 148 /* end of block */ /* END: OPCODES */ Index: ZendEngine2/zend_execute.c diff -u ZendEngine2/zend_execute.c:1.547 ZendEngine2/zend_execute.c:1.548 --- ZendEngine2/zend_execute.c:1.547 Fri Nov 7 05:47:47 2003 +++ ZendEngine2/zend_execute.c Mon Nov 10 11:14:44 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute.c,v 1.547 2003/11/07 10:47:47 helly Exp $ */ +/* $Id: zend_execute.c,v 1.548 2003/11/10 16:14:44 helly Exp $ */ #define ZEND_INTENSIVE_DEBUGGING 0 @@ -3769,7 +3769,7 @@ } -int zend_isset_isempty_dim_obj_handler(ZEND_OPCODE_HANDLER_ARGS) +static int zend_isset_isempty_dim_prop_obj_handler(int prop_dim, ZEND_OPCODE_HANDLER_ARGS) { zval **container = get_obj_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_R TSRMLS_CC); zval *offset = get_zval_ptr(&EX(opline)->op2, EX(Ts), &EG(free_op2), BP_VAR_R); @@ -3831,7 +3831,11 @@ break; } } else if ((*container)->type == IS_OBJECT) { - result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (EX(opline)->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + if (prop_dim) { + result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (EX(opline)->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } else { + result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (EX(opline)->extended_value == ZEND_ISEMPTY) TSRMLS_CC); + } } else if ((*container)->type == IS_STRING) { /* string offsets */ switch (EX(opline)->extended_value) { case ZEND_ISSET: @@ -3865,6 +3869,18 @@ } +int zend_isset_isempty_dim_obj_handler(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_isset_isempty_dim_prop_obj_handler(0, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); +} + + +int zend_isset_isempty_prop_obj_handler(ZEND_OPCODE_HANDLER_ARGS) +{ + zend_isset_isempty_dim_prop_obj_handler(1, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); +} + + int zend_exit_handler(ZEND_OPCODE_HANDLER_ARGS) { if (EX(opline)->op1.op_type != IS_UNUSED) { @@ -4217,6 +4233,7 @@ zend_opcode_handlers[ZEND_ISSET_ISEMPTY_VAR] = zend_isset_isempty_var_handler; zend_opcode_handlers[ZEND_ISSET_ISEMPTY_DIM_OBJ] = zend_isset_isempty_dim_obj_handler; + zend_opcode_handlers[ZEND_ISSET_ISEMPTY_PROP_OBJ] = zend_isset_isempty_prop_obj_handler; zend_opcode_handlers[ZEND_PRE_INC_OBJ] = zend_pre_inc_obj_handler; zend_opcode_handlers[ZEND_PRE_DEC_OBJ] = zend_pre_dec_obj_handler; Index: ZendEngine2/zend_object_handlers.c diff -u ZendEngine2/zend_object_handlers.c:1.73 ZendEngine2/zend_object_handlers.c:1.74 --- ZendEngine2/zend_object_handlers.c:1.73 Sat Nov 8 09:06:07 2003 +++ ZendEngine2/zend_object_handlers.c Mon Nov 10 11:14:44 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_object_handlers.c,v 1.73 2003/11/08 14:06:07 helly Exp $ */ +/* $Id: zend_object_handlers.c,v 1.74 2003/11/10 16:14:44 helly Exp $ */ #include "zend.h" #include "zend_globals.h" @@ -386,6 +386,12 @@ } +static void zend_std_has_dimension(zval *object, zval *offset, zval *value TSRMLS_DC) +{ + zend_error(E_ERROR, "Cannot use object as array"); +} + + static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC) { zend_object *zobj; @@ -902,6 +908,7 @@ NULL, /* set */ zend_std_has_property, /* has_property */ zend_std_unset_property, /* unset_property */ + zend_std_has_dimension, /* has_dimension */ zend_std_unset_dimension, /* unset_dimension */ zend_std_get_properties, /* get_properties */ zend_std_get_method, /* get_method */ Index: ZendEngine2/zend_object_handlers.h diff -u ZendEngine2/zend_object_handlers.h:1.25 ZendEngine2/zend_object_handlers.h:1.26 --- ZendEngine2/zend_object_handlers.h:1.25 Sun Oct 5 03:52:28 2003 +++ ZendEngine2/zend_object_handlers.h Mon Nov 10 11:14:44 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_object_handlers.h,v 1.25 2003/10/05 07:52:28 zeev Exp $ */ +/* $Id: zend_object_handlers.h,v 1.26 2003/11/10 16:14:44 helly Exp $ */ #ifndef ZEND_OBJECT_HANDLERS_H #define ZEND_OBJECT_HANDLERS_H @@ -53,10 +53,13 @@ /* Used to check if a property of the object exists */ typedef int (*zend_object_has_property_t)(zval *object, zval *member, int check_empty TSRMLS_DC); +/* Used to check if a dimension of the object exists */ +typedef int (*zend_object_has_dimension_t)(zval *object, zval *member, int check_empty TSRMLS_DC); + /* Used to remove a property of the object */ typedef void (*zend_object_unset_property_t)(zval *object, zval *member TSRMLS_DC); -/* Used to remove a property of the object */ +/* Used to remove a dimension of the object */ typedef void (*zend_object_unset_dimension_t)(zval *object, zval *offset TSRMLS_DC); /* Used to get hash of the properties of the object, as hash of zval's */ @@ -98,6 +101,7 @@ zend_object_set_t set; zend_object_has_property_t has_property; zend_object_unset_property_t unset_property; + zend_object_has_dimension_t has_dimension; zend_object_unset_dimension_t unset_dimension; zend_object_get_properties_t get_properties; zend_object_get_method_t get_method; Index: ZendEngine2/zend_objects_API.c diff -u ZendEngine2/zend_objects_API.c:1.21 ZendEngine2/zend_objects_API.c:1.22 --- ZendEngine2/zend_objects_API.c:1.21 Sun Oct 5 03:52:28 2003 +++ ZendEngine2/zend_objects_API.c Mon Nov 10 11:14:44 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_objects_API.c,v 1.21 2003/10/05 07:52:28 zeev Exp $ */ +/* $Id: zend_objects_API.c,v 1.22 2003/11/10 16:14:44 helly Exp $ */ #include "zend.h" #include "zend_globals.h" @@ -280,6 +280,8 @@ zend_object_proxy_set, /* set */ NULL, /* has_property */ NULL, /* unset_property */ + NULL, /* has_dimension */ + NULL, /* unset_dimension */ NULL, /* get_properties */ NULL, /* get_method */ NULL, /* call_method */

« previous php.zend-engine.cvs (#1973) next »