cvs: ZendEngine2 / zend_API.c zend_API.h zend_operators.c

From: Date: Thu, 25 May 2006 10:34:01 +0000
Subject: cvs: ZendEngine2 / 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-4925@lists.php.net to get a copy of this message
tony2001 Thu May 25 10:34:01 2006 UTC Modified files: /ZendEngine2 zend_API.c zend_API.h zend_operators.c Log: MFB: fix error messages when converting objects to other types http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_API.c?r1=1.362&r2=1.363&diff_format=u Index: ZendEngine2/zend_API.c diff -u ZendEngine2/zend_API.c:1.362 ZendEngine2/zend_API.c:1.363 --- ZendEngine2/zend_API.c:1.362 Tue May 23 22:21:52 2006 +++ ZendEngine2/zend_API.c Thu May 25 10:34:01 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.c,v 1.362 2006/05/23 22:21:52 helly Exp $ */ +/* $Id: zend_API.c,v 1.363 2006/05/25 10:34:01 tony2001 Exp $ */ #include "zend.h" #include "zend_execute.h" @@ -194,19 +194,15 @@ /* 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: { TSRMLS_FETCH(); @@ -217,26 +213,26 @@ 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"; case IS_UNICODE: return "Unicode string"; - 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.243&r2=1.244&diff_format=u Index: ZendEngine2/zend_API.h diff -u ZendEngine2/zend_API.h:1.243 ZendEngine2/zend_API.h:1.244 --- ZendEngine2/zend_API.h:1.243 Tue May 9 22:10:11 2006 +++ ZendEngine2/zend_API.h Thu May 25 10:34:01 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.h,v 1.243 2006/05/09 22:10:11 helly Exp $ */ +/* $Id: zend_API.h,v 1.244 2006/05/25 10:34:01 tony2001 Exp $ */ #ifndef ZEND_API_H #define ZEND_API_H @@ -289,6 +289,7 @@ ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject TSRMLS_DC); ZEND_API int zend_get_object_classname(zval *object, zstr *class_name, zend_uint *class_name_len TSRMLS_DC); ZEND_API zend_uchar zend_get_unified_string_type(int num_args 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.241&r2=1.242&diff_format=u Index: ZendEngine2/zend_operators.c diff -u ZendEngine2/zend_operators.c:1.241 ZendEngine2/zend_operators.c:1.242 --- ZendEngine2/zend_operators.c:1.241 Thu Apr 20 21:56:43 2006 +++ ZendEngine2/zend_operators.c Thu May 25 10:34:01 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_operators.c,v 1.241 2006/04/20 21:56:43 andrei Exp $ */ +/* $Id: zend_operators.c,v 1.242 2006/05/25 10:34:01 tony2001 Exp $ */ #include <ctype.h> @@ -318,10 +318,11 @@ zval dst; \ if (Z_OBJ_HT_P(op)->cast_object(op, &dst, ctype TSRMLS_CC) == FAILURE) { \ zend_error(E_RECOVERABLE_ERROR, \ - "Object of class %v could not be converted to " # ctype, Z_OBJCE_P(op)->name); \ + "Object of class %v 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; \ + Z_TYPE_P(op) = ctype; \ op->value = dst.value; \ } \ } else { \

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