]> granicus.if.org Git - php/commitdiff
- Fixed bug #50005 (Throwing through Reflection modified Exception object makes segme...
authorFelipe Pena <felipe@php.net>
Thu, 12 Nov 2009 00:10:00 +0000 (00:10 +0000)
committerFelipe Pena <felipe@php.net>
Thu, 12 Nov 2009 00:10:00 +0000 (00:10 +0000)
NEWS
Zend/tests/bug50005.phpt [new file with mode: 0644]
main/main.c

diff --git a/NEWS b/NEWS
index c10b7ab44dd36f22fb38c5b8c3267869574156af..ad3a684fbe5600e56dea264db11bd8d21d6d3b1b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,8 @@ PHP                                                                        NEWS
 
 - Fixed bug #50073 (parse_url() incorrect when ? in fragment). (Ilia)
 - Fixed bug #50006 (Segfault caused by uksort()). (Felipe)
+- Fixed bug #50005 (Throwing through Reflection modified Exception object
+  makes segmentation fault). (Felipe)
 - Fixed bug #49990 (SNMP3 warning message about security level printed twice).
   (Jani)
 - Fixed bug #49985 (pdo_pgsql prepare() re-use previous aborted
diff --git a/Zend/tests/bug50005.phpt b/Zend/tests/bug50005.phpt
new file mode 100644 (file)
index 0000000..bf4fbbd
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST--
+Bug #50005 (Throwing through Reflection modified Exception object makes segmentation fault)
+--FILE--
+<?php
+
+class a extends exception {
+       public function __construct() {
+               $this->file = null;
+       }
+}
+
+throw new a;
+
+?>
+--EXPECTF--
+Fatal error: Uncaught exception 'a' in :%d
+Stack trace:
+#0 {main}
+  thrown in Unknown on line %d
index 4261b520cb25e38a63bfa6acc9d707bd2d0fe2c8..e6be4a2d434909c7d660f946eeb16a34bc14531c 100644 (file)
@@ -834,6 +834,9 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
                if (PG(last_error_file)) {
                        free(PG(last_error_file));
                }
+               if (!error_filename) {
+                       error_filename = "Unknown";
+               }
                PG(last_error_type) = type;
                PG(last_error_message) = strdup(buffer);
                PG(last_error_file) = strdup(error_filename);