From: Felipe Pena Date: Thu, 14 Aug 2008 19:11:42 +0000 (+0000) Subject: - Fixed crash (reported by Lupus Michaelis) X-Git-Tag: BEFORE_HEAD_NS_CHANGE~720 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7670379aec8f2140dc34090c783c6cae99f3a383;p=php - Fixed crash (reported by Lupus Michaelis) --- diff --git a/Zend/tests/exception_009.phpt b/Zend/tests/exception_009.phpt new file mode 100644 index 0000000000..ee980c51c3 --- /dev/null +++ b/Zend/tests/exception_009.phpt @@ -0,0 +1,28 @@ +--TEST-- +Testing exception properties +--FILE-- +message = new stdclass ; + $this->file = new my_file ; + $this->line = "12" ; + } +} + +throw new my_exception; + +?> +--EXPECT-- +Catchable fatal error: Object of class stdClass could not be converted to Unicode string in Unknown on line 0 diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 71dedf5764..f50d73f375 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -621,7 +621,9 @@ ZEND_METHOD(exception, __toString) _default_exception_get_entry(exception, "file", sizeof("file")-1, &file TSRMLS_CC); _default_exception_get_entry(exception, "line", sizeof("line")-1, &line TSRMLS_CC); - convert_to_long(&line); + convert_to_unicode(&message); + convert_to_unicode(&file); + convert_to_long(&line); fci.size = sizeof(fci); fci.function_table = &Z_OBJCE_P(getThis())->function_table;