cvs: ZendEngine2(PHP_5_2) / zend_API.c zend_API.h zend_operators.c

From: Date: Thu, 25 May 2006 10:01:06 +0000
Subject: cvs: ZendEngine2(PHP_5_2) / zend_API.c zend_API.h zend_operators.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-4924@lists.php.net to get a copy of this message
tony2001 Thu May 25 10:01:06 2006 UTC Modified files: (Branch: PHP_5_2) /ZendEngine2 zend_API.c zend_API.h zend_operators.c Log: fix error messages when converting objects to other types add new function MFB will follow soon http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_API.c?r1=1.296.2.27.2.9&r2=1.296.2.27.2.10&diff_format=u Index: ZendEngine2/zend_API.c diff -u ZendEngine2/zend_API.c:1.296.2.27.2.9 ZendEngine2/zend_API.c:1.296.2.27.2.10 --- ZendEngine2/zend_API.c:1.296.2.27.2.9 Tue May 23 22:22:11 2006 +++ ZendEngine2/zend_API.c Thu May 25 10:01:06 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.c,v 1.296.2.27.2.9 2006/05/23 22:22:11 helly Exp $ */ +/* $Id: zend_API.c,v 1.296.2.27.2.10 2006/05/25 10:01:06 tony2001 Exp $ */ #include "zend.h" #include "zend_execute.h" @@ -195,38 +195,35 @@ /* Argument parsing API -- andrei */ -ZEND_API char *zend_zval_type_name(zval *arg) +ZEND_API char *zend_get_type_by_const(int type) { - switch (Z_TYPE_P(arg)) { - case IS_NULL: - return "null"; - + switch(type) { + case IS_BOOL: + return "boolean"; case IS_LONG: return "integer"; - case IS_DOUBLE: return "double"; - case IS_STRING: return "string"; - - case IS_ARRAY: - return "array"; - case IS_OBJECT: return "object"; - - case IS_BOOL: - return "boolean"; - case IS_RESOURCE: return "resource"; - + case IS_NULL: + return "null"; + case IS_ARRAY: + return "array"; default: return "unknown"; } } +ZEND_API char *zend_zval_type_name(zval *arg) +{ + return zend_get_type_by_const(Z_TYPE_P(arg)); +} + ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject TSRMLS_DC) { if (Z_OBJ_HT_P(zobject)->get_class_entry) { http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_API.h?r1=1.207.2.8.2.1&r2=1.207.2.8.2.2&diff_format=u Index: ZendEngine2/zend_API.h diff -u ZendEngine2/zend_API.h:1.207.2.8.2.1 ZendEngine2/zend_API.h:1.207.2.8.2.2 --- ZendEngine2/zend_API.h:1.207.2.8.2.1 Tue May 9 23:53:23 2006 +++ ZendEngine2/zend_API.h Thu May 25 10:01:06 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.h,v 1.207.2.8.2.1 2006/05/09 23:53:23 helly Exp $ */ +/* $Id: zend_API.h,v 1.207.2.8.2.2 2006/05/25 10:01:06 tony2001 Exp $ */ #ifndef ZEND_API_H #define ZEND_API_H @@ -258,6 +258,7 @@ ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject TSRMLS_DC); ZEND_API int zend_get_object_classname(zval *object, char **class_name, zend_uint *class_name_len TSRMLS_DC); +ZEND_API char *zend_get_type_by_const(int type); #define getThis() (this_ptr) http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_operators.c?r1=1.208.2.4.2.1&r2=1.208.2.4.2.2&diff_format=u Index: ZendEngine2/zend_operators.c diff -u ZendEngine2/zend_operators.c:1.208.2.4.2.1 ZendEngine2/zend_operators.c:1.208.2.4.2.2 --- ZendEngine2/zend_operators.c:1.208.2.4.2.1 Tue May 9 23:53:23 2006 +++ ZendEngine2/zend_operators.c Thu May 25 10:01:06 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_operators.c,v 1.208.2.4.2.1 2006/05/09 23:53:23 helly Exp $ */ +/* $Id: zend_operators.c,v 1.208.2.4.2.2 2006/05/25 10:01:06 tony2001 Exp $ */ #include <ctype.h> @@ -271,7 +271,8 @@ zval dst; \ if (Z_OBJ_HT_P(op)->cast_object(op, &dst, ctype TSRMLS_CC) == FAILURE) { \ zend_error(E_RECOVERABLE_ERROR, \ - "Object of class %s could not be converted to " # ctype, Z_OBJCE_P(op)->name); \ + "Object of class %s could not be converted to %s", Z_OBJCE_P(op)->name, \ + zend_get_type_by_const(ctype)); \ } else { \ zval_dtor(op); \ Z_TYPE_P(op) = ctype; \

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