]> granicus.if.org Git - php/commitdiff
- Fixed crash (reported by Lupus Michaelis)
authorFelipe Pena <felipe@php.net>
Thu, 14 Aug 2008 19:11:42 +0000 (19:11 +0000)
committerFelipe Pena <felipe@php.net>
Thu, 14 Aug 2008 19:11:42 +0000 (19:11 +0000)
Zend/tests/exception_009.phpt [new file with mode: 0644]
Zend/zend_exceptions.c

diff --git a/Zend/tests/exception_009.phpt b/Zend/tests/exception_009.phpt
new file mode 100644 (file)
index 0000000..ee980c5
--- /dev/null
@@ -0,0 +1,28 @@
+--TEST--
+Testing exception properties
+--FILE--
+<?php
+
+class my_file
+{
+         public  function __toString()
+         {
+                 return "somebuildfilename" ;
+         }
+}
+
+class my_exception extends exception
+{
+         public  function __construct()
+         {
+                 $this->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
index 71dedf576496b6010a2cd7d6d6d086510a84216b..f50d73f375582a0f2e5696a9ac393cd6a795e9e5 100644 (file)
@@ -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;