com php-src: Fixed exception constructor: Zend/zend_API.c Zend/zend_API.h Zend/zend_exceptions.c Zend/zend _object_handlers.c

From: Date: Fri, 21 Feb 2014 12:14:42 +0000
Subject: com php-src: Fixed exception constructor: Zend/zend_API.c Zend/zend_API.h Zend/zend_exceptions.c Zend/zend _object_handlers.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-78047@lists.php.net to get a copy of this message
Commit: 6fbea9ce6a6382d7999b6f6059c16348ee50ecda Author: Dmitry Stogov <dmitry@zend.com> Fri, 21 Feb 2014 16:14:42 +0400 Parents: 51d7c4828a8025c4fedf7b38380d17f7a2464256 Branches: phpng Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6fbea9ce6a6382d7999b6f6059c16348ee50ecda Log: Fixed exception constructor Changed paths: M Zend/zend_API.c M Zend/zend_API.h M Zend/zend_exceptions.c M Zend/zend_object_handlers.c Diff: diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 80eb984..e2737a2 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -3694,6 +3694,15 @@ ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, } /* }}} */ +ZEND_API void zend_update_property_str(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_string *value TSRMLS_DC) /* {{{ */ +{ + zval tmp; + + ZVAL_STR(&tmp, STR_COPY(value)); + zend_update_property(scope, object, name, name_length, &tmp TSRMLS_CC); +} +/* }}} */ + ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value TSRMLS_DC) /* {{{ */ { zval tmp; diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 7f8f30d..3aeac17 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -323,6 +323,7 @@ ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, c ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, int name_length, long value TSRMLS_DC); ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, const char *name, int name_length, long value TSRMLS_DC); ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, const char *name, int name_length, double value TSRMLS_DC); +ZEND_API void zend_update_property_str(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_string *value TSRMLS_DC); ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value TSRMLS_DC); ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value, int value_length TSRMLS_DC); diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 9473751..48779b4 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -160,6 +160,7 @@ static zend_object *zend_default_exception_new_ex(zend_class_entry *class_type, object_properties_init(object, class_type); zend_fetch_debug_backtrace(&trace, skip_top_traces, 0, 0 TSRMLS_CC); + Z_SET_REFCOUNT(trace, 0); zend_update_property_string(default_exception_ce, &obj, "file", sizeof("file")-1, zend_get_executed_filename(TSRMLS_C) TSRMLS_CC); zend_update_property_long(default_exception_ce, &obj, "line", sizeof("line")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC); @@ -194,19 +195,19 @@ ZEND_METHOD(exception, __clone) Exception constructor */ ZEND_METHOD(exception, __construct) { - char *message = NULL; + zend_string *message = NULL; long code = 0; zval *object, *previous = NULL; - int argc = ZEND_NUM_ARGS(), message_len; + int argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|slO!", &message, &message_len, &code, &previous, default_exception_ce) == FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, "|SlO!", &message, &code, &previous, default_exception_ce) == FAILURE) { zend_error(E_ERROR, "Wrong parameters for Exception([string $exception [, long $code [, Exception $previous = NULL]]])"); } object = getThis(); if (message) { - zend_update_property_stringl(default_exception_ce, object, "message", sizeof("message")-1, message, message_len TSRMLS_CC); + zend_update_property_str(default_exception_ce, object, "message", sizeof("message")-1, message TSRMLS_CC); } if (code) { diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index bbda58c..6acb504 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -579,6 +579,7 @@ found: zval_ptr_dtor(&garbage); } } + return; } } }

« previous php.cvs (#78047) next »