]> 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)
Zend/tests/bug50005.phpt [new file with mode: 0644]
main/main.c

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 50f3e82e28000cb58e0f432358e7c24a8f22bec1..5742829769a2c300af4dcdae57a79cf335f4ae0d 100644 (file)
@@ -984,6 +984,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);