From bb524935a3cf730f3b2f52537d080a41faf72daa Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Thu, 12 Nov 2009 00:10:00 +0000 Subject: [PATCH] - Fixed bug #50005 (Throwing through Reflection modified Exception object makes segmentation fault) --- NEWS | 2 ++ Zend/tests/bug50005.phpt | 19 +++++++++++++++++++ main/main.c | 3 +++ 3 files changed, 24 insertions(+) create mode 100644 Zend/tests/bug50005.phpt diff --git a/NEWS b/NEWS index c10b7ab44d..ad3a684fbe 100644 --- 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 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-- +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 4261b520cb..e6be4a2d43 100644 --- a/main/main.c +++ b/main/main.c @@ -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); -- 2.40.0