From 8f0a4517474601df28111c381f8925b416bd2d46 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 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-- +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); -- 2.40.0