Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_API.c zend_API.h zend_exceptions.c
| From: | Andrei Zmievski | Date: | Thu, 18 Aug 2005 21:31:57 +0000 |
| Subject: | Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_API.c zend_API.h zend_exceptions.c | ||
| References: | 1 2 3 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-4048@lists.php.net to get a copy of this message | ||
Sure.
-Andrei
On Aug 18, 2005, at 11:42 AM, Marcus Boerger wrote:
Hello Andrei, Thursday, August 18, 2005, 7:22:10 PM, you wrote:On Aug 18, 2005, at 8:42 AM, Dmitry Stogov wrote:+ZEND_API void zend_update_property_unicode(zend_class_entry *scope, zval *object, UChar *name, int name_length, char *value TSRMLS_DC) +{+ zval *tmp;++ ALLOC_ZVAL(tmp); + tmp->is_ref = 0; + tmp->refcount = 0; + ZVAL_UNICODE(tmp, value, 1); + zend_update_property(scope, object, name, name_length, tmpTSRMLS_CC); +} + +ZEND_API void zend_update_property_unicodel(zend_class_entry *scope, zval *object, UChar *name, int name_length, char *value, int value_len TSRMLS_DC) +{+ zval *tmp;++ ALLOC_ZVAL(tmp); + tmp->is_ref = 0; + tmp->refcount = 0; + ZVAL_UNICODEL(tmp, value, value_len, 1); + zend_update_property(scope, object, name, name_length, tmpTSRMLS_CC); +} + ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *name, int name_length, zend_bool silent TSRMLS_DC)[snipped]if (message) {- zend_update_property_string(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message TSRMLS_CC);+ if (message_type == IS_UNICODE) {+ zend_update_property_unicodel(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message, message_len TSRMLS_CC);+ } else {+ zend_update_property_stringl(U_CLASS_ENTRY(default_exception_ce), object, "message", sizeof("message")-1, message, message_len TSRMLS_CC);+ } }Dmitriy,Your function prototypes indicate that the name passed in should be a UChar* but you are passing a simple C string..Furthermore ti seems we most always will have places where we grep some string value by zend_parse_parameters...t... and the updating some property. Shouldn't we have somt typed property update function where i can pass the string as a void* and the type and internally the function select what is needed? Best regards, Marcus