summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2009-11-12 00:10:00 +0000
committerFelipe Pena <felipe@php.net>2009-11-12 00:10:00 +0000
commit8f0a4517474601df28111c381f8925b416bd2d46 (patch)
treed82082e136516c1497fc400f816163401b1a8a1b
parent01d9f2c9cefcea3e2742c69cb4968f9b535e6385 (diff)
downloadphp-git-8f0a4517474601df28111c381f8925b416bd2d46.tar.gz
- Fixed bug #50005 (Throwing through Reflection modified Exception object makes segmentation fault)
-rw-r--r--NEWS2
-rw-r--r--Zend/tests/bug50005.phpt19
-rw-r--r--main/main.c3
3 files changed, 24 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index fb38d5953d..9fc24ff99f 100644
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,8 @@ PHP NEWS
(Felipe)
- Fixed bug #50073 (parse_url() incorrect when ? in fragment). (Ilia)
- Fixed bug #50023 (pdo_mysql doesn't use PHP_MYSQL_UNIX_SOCK_ADDR). (Ilia)
+- Fixed bug #50005 (Throwing through Reflection modified Exception object
+ makes segmentation fault). (Felipe)
- Fixed bug #49910 (no support for ././@LongLink for long filenames in phar
tar support). (Greg)
- Fixed bug #49908 (throwing exception in __autoload crashes when interface
diff --git a/Zend/tests/bug50005.phpt b/Zend/tests/bug50005.phpt
new file mode 100644
index 0000000000..bf4fbbda68
--- /dev/null
+++ b/Zend/tests/bug50005.phpt
@@ -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
diff --git a/main/main.c b/main/main.c
index 9068ea4b46..12c35ac639 100644
--- a/main/main.c
+++ b/main/main.c
@@ -889,6 +889,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);