cvs: ZendEngine2 / zend_builtin_functions.c zend_object_handlers.c zend_object_handlers.h
| From: | Marcus Boerger | Date: | Mon, 02 May 2005 16:18:02 +0000 |
| Subject: | cvs: ZendEngine2 / zend_builtin_functions.c zend_object_handlers.c zend_object_handlers.h | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-3633@lists.php.net to get a copy of this message | ||
helly Mon May 2 12:18:02 2005 EDT
Modified files:
/ZendEngine2 zend_builtin_functions.c zend_object_handlers.c
zend_object_handlers.h
Log:
- Extend API to support real existance test without the need to add any new
functions or change any behavior
http://cvs.php.net/diff.php/ZendEngine2/zend_builtin_functions.c?r1=1.268&r2=1.269&ty=u
Index: ZendEngine2/zend_builtin_functions.c
diff -u ZendEngine2/zend_builtin_functions.c:1.268 ZendEngine2/zend_builtin_functions.c:1.269
--- ZendEngine2/zend_builtin_functions.c:1.268 Tue Apr 26 04:47:31 2005
+++ ZendEngine2/zend_builtin_functions.c Mon May 2 12:18:01 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_builtin_functions.c,v 1.268 2005/04/26 08:47:31 dmitry Exp $ */
+/* $Id: zend_builtin_functions.c,v 1.269 2005/05/02 16:18:01 helly Exp $ */
#include "zend.h"
#include "zend_API.h"
@@ -953,7 +953,7 @@
RETURN_FALSE;
case IS_OBJECT:
- if (Z_OBJ_HANDLER_PP(object, has_property) && Z_OBJ_HANDLER_PP(object,
has_property)(*object, *property, 0 TSRMLS_CC)) {
+ if (Z_OBJ_HANDLER_PP(object, has_property) && Z_OBJ_HANDLER_PP(object,
has_property)(*object, *property, 2 TSRMLS_CC)) {
RETURN_TRUE;
}
RETURN_FALSE;
http://cvs.php.net/diff.php/ZendEngine2/zend_object_handlers.c?r1=1.121&r2=1.122&ty=u
Index: ZendEngine2/zend_object_handlers.c
diff -u ZendEngine2/zend_object_handlers.c:1.121 ZendEngine2/zend_object_handlers.c:1.122
--- ZendEngine2/zend_object_handlers.c:1.121 Fri Apr 29 06:40:01 2005
+++ ZendEngine2/zend_object_handlers.c Mon May 2 12:18:01 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_object_handlers.c,v 1.121 2005/04/29 10:40:01 sniper Exp $ */
+/* $Id: zend_object_handlers.c,v 1.122 2005/05/02 16:18:01 helly Exp $ */
#include "zend.h"
#include "zend_globals.h"
@@ -806,8 +806,7 @@
return zend_compare_symbol_tables_i(zobj1->properties, zobj2->properties TSRMLS_CC);
}
-
-static int zend_std_has_property(zval *object, zval *member, int check_empty TSRMLS_DC)
+static int zend_std_has_property(zval *object, zval *member, int has_set_exists TSRMLS_DC)
{
zend_object *zobj;
int result;
@@ -833,10 +832,16 @@
}
if (zend_hash_find(zobj->properties, property_info->name, property_info->name_length+1,
(void **) &value) == SUCCESS) {
- if (check_empty) {
- result = zend_is_true(*value);
- } else {
+ switch (has_set_exists) {
+ case 0:
result = (Z_TYPE_PP(value) != IS_NULL);
+ break;
+ default:
+ result = zend_is_true(*value);
+ break;
+ case 2:
+ result = 1;
+ break;
}
} else {
result = 0;
http://cvs.php.net/diff.php/ZendEngine2/zend_object_handlers.h?r1=1.44&r2=1.45&ty=u
Index: ZendEngine2/zend_object_handlers.h
diff -u ZendEngine2/zend_object_handlers.h:1.44 ZendEngine2/zend_object_handlers.h:1.45
--- ZendEngine2/zend_object_handlers.h:1.44 Wed Apr 27 11:45:35 2005
+++ ZendEngine2/zend_object_handlers.h Mon May 2 12:18:02 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_object_handlers.h,v 1.44 2005/04/27 15:45:35 dmitry Exp $ */
+/* $Id: zend_object_handlers.h,v 1.45 2005/05/02 16:18:02 helly Exp $ */
#ifndef ZEND_OBJECT_HANDLERS_H
#define ZEND_OBJECT_HANDLERS_H
@@ -61,7 +61,12 @@
typedef zval* (*zend_object_get_t)(zval *property TSRMLS_DC);
/* 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);
+/* param has_set_exists:
+ * 0 (has) whetehr property exists and is not NULL
+ * 1 (set) whether property exists and is true
+ * 2 (exists) whether property exists
+ */
+typedef int (*zend_object_has_property_t)(zval *object, zval *member, int has_set_exists
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);