cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c /ext/reflection/tests bug42976.phpt
| From: | Ilia Alshanetsky | Date: | Sun, 28 Oct 2007 13:42:24 +0000 |
| Subject: | cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c /ext/reflection/tests bug42976.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-46802@lists.php.net to get a copy of this message | ||
iliaa Sun Oct 28 13:42:24 2007 UTC
Added files: (Branch: PHP_5_3)
/php-src/ext/reflection/tests bug42976.phpt
Modified files:
/php-src/ext/reflection php_reflection.c
Log:
Fixed bug #42976 (Crash when constructor for newInstance() or
newInstanceArgs() fails)
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.3&r2=1.164.2.33.2.45.2.4&diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.3
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.4
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.3 Sun Oct 7 05:22:05 2007
+++ php-src/ext/reflection/php_reflection.c Sun Oct 28 13:42:24 2007
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.3 2007/10/07 05:22:05 davidw Exp $ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.4 2007/10/28 13:42:24 iliaa Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -3405,7 +3405,7 @@
Returns an instance of this class */
ZEND_METHOD(reflection_class, newInstance)
{
- zval *retval_ptr;
+ zval *retval_ptr = NULL;
reflection_object *intern;
zend_class_entry *ce;
int argc = ZEND_NUM_ARGS();
@@ -3449,7 +3449,9 @@
if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
efree(params);
- zval_ptr_dtor(&retval_ptr);
+ if (retval_ptr) {
+ zval_ptr_dtor(&retval_ptr);
+ }
zend_error(E_WARNING, "Invocation of %s's constructor failed", ce->name);
RETURN_NULL();
}
@@ -3469,7 +3471,7 @@
Returns an instance of this class */
ZEND_METHOD(reflection_class, newInstanceArgs)
{
- zval *retval_ptr;
+ zval *retval_ptr = NULL;
reflection_object *intern;
zend_class_entry *ce;
int argc = 0;
@@ -3524,7 +3526,9 @@
if (params) {
efree(params);
}
- zval_ptr_dtor(&retval_ptr);
+ if (retval_ptr) {
+ zval_ptr_dtor(&retval_ptr);
+ }
zend_error(E_WARNING, "Invocation of %s's constructor failed", ce->name);
RETURN_NULL();
}
@@ -4903,7 +4907,7 @@
php_info_print_table_start();
php_info_print_table_header(2, "Reflection", "enabled");
- php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.164.2.33.2.45.2.3
2007/10/07 05:22:05 davidw Exp $");
+ php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.164.2.33.2.45.2.4
2007/10/28 13:42:24 iliaa Exp $");
php_info_print_table_end();
} /* }}} */
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug42976.phpt?view=markup&rev=1.1
Index: php-src/ext/reflection/tests/bug42976.phpt
+++ php-src/ext/reflection/tests/bug42976.phpt