com php-src: Allow NULL for exception_ce: Zend/zend.c
| From: | Aaron Piotrowski | Date: | Tue, 07 Jul 2015 17:10:55 +0000 |
| Subject: | com php-src: Allow NULL for exception_ce: Zend/zend.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-87817@lists.php.net to get a copy of this message | ||
Commit: 29c3cd44485fb8e43b29c46b1f9451e99bca92c8
Author: Aaron Piotrowski <aaron@trowski.com> Tue, 7 Jul 2015 11:37:33 -0500
Parents: 54bcc6280c689a5b63f2c4d026e0ceeb7012b000
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=29c3cd44485fb8e43b29c46b1f9451e99bca92c8
Log:
Allow NULL for exception_ce
Changed paths:
M Zend/zend.c
Diff:
diff --git a/Zend/zend.c b/Zend/zend.c
index 9e8613a..e5fd2e8 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -1296,11 +1296,20 @@ ZEND_API void zend_throw_error(zend_class_entry *exception_ce, const char
*forma
{
va_list va;
char *message = NULL;
+
+ if (exception_ce) {
+ if (!instanceof_function(exception_ce, zend_ce_error)) {
+ zend_error(E_NOTICE, "Error exceptions must be derived from Error");
+ exception_ce = zend_ce_error;
+ }
+ } else {
+ exception_ce = zend_ce_error;
+ }
va_start(va, format);
zend_vspprintf(&message, 0, format, va);
- // TODO: we can't convert compile-time errors to exceptions yet???
+ //TODO: we can't convert compile-time errors to exceptions yet???
if (EG(current_execute_data) && !CG(in_compilation)) {
zend_throw_exception(exception_ce, message, 0);
} else {