cvs: ZendEngine2 / zend_reflection_api.c
| From: | Marcus Boerger | Date: | Mon, 20 Jun 2005 01:37:49 +0000 |
| Subject: | cvs: ZendEngine2 / zend_reflection_api.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-3834@lists.php.net to get a copy of this message | ||
helly Sun Jun 19 21:37:49 2005 EDT
Modified files:
/ZendEngine2 zend_reflection_api.c
Log:
- Fix bug #33389 by fixing copying
http://cvs.php.net/diff.php/ZendEngine2/zend_reflection_api.c?r1=1.160&r2=1.161&ty=u
Index: ZendEngine2/zend_reflection_api.c
diff -u ZendEngine2/zend_reflection_api.c:1.160 ZendEngine2/zend_reflection_api.c:1.161
--- ZendEngine2/zend_reflection_api.c:1.160 Sun Jun 19 21:08:57 2005
+++ ZendEngine2/zend_reflection_api.c Sun Jun 19 21:37:48 2005
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_reflection_api.c,v 1.160 2005/06/20 01:08:57 helly Exp $ */
+/* $Id: zend_reflection_api.c,v 1.161 2005/06/20 01:37:48 helly Exp $ */
#include "zend.h"
#include "zend_API.h"
#include "zend_exceptions.h"
@@ -560,8 +560,10 @@
zval *zv, zv_copy;
int use_copy;
string_write(str, " = ", sizeof(" = ")-1);
- zv_copy = precv->op2.u.constant;
- zv = &zv_copy;
+ ALLOC_ZVAL(zv);
+ *zv = precv->op2.u.constant;
+ zval_copy_ctor(zv);
+ INIT_PZVAL(zv);
zval_update_constant(&zv, (void*)1 TSRMLS_CC);
if (Z_TYPE_P(zv) == IS_BOOL) {
if (Z_LVAL_P(zv)) {
@@ -581,7 +583,6 @@
} else {
zend_make_printable_zval(zv, &zv_copy, &use_copy);
string_write(str, Z_STRVAL(zv_copy), Z_STRLEN(zv_copy));
- zval_dtor(&zv_copy);
}
zval_ptr_dtor(&zv);
}
@@ -1010,7 +1011,7 @@
/* {{{ _reflection_export */
static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *ce_ptr, int
ctor_argc)
{
- zval reflector, *reflector_ptr = &reflector;
+ zval *reflector_ptr;
zval output, *output_ptr = &output;
zval *argument_ptr, *argument2_ptr;
zval *retval_ptr, **params[2];
@@ -1033,8 +1034,8 @@
INIT_PZVAL(&output);
/* Create object */
- INIT_PZVAL(&reflector);
- if (object_and_properties_init(&reflector, ce_ptr, NULL) == FAILURE) {
+ MAKE_STD_ZVAL(reflector_ptr);
+ if (object_and_properties_init(reflector_ptr, ce_ptr, NULL) == FAILURE) {
_DO_THROW("Could not create reflector");
}
@@ -1063,14 +1064,12 @@
zval_ptr_dtor(&retval_ptr);
}
- RETURN_ON_EXCEPTION
-
if (EG(exception)) {
- zval_dtor(&reflector);
+ zval_ptr_dtor(&reflector_ptr);
return;
}
- if (result == FAILURE || EG(exception)) {
- zval_dtor(&reflector);
+ if (result == FAILURE) {
+ zval_ptr_dtor(&reflector_ptr);
_DO_THROW("Could not create reflector");
}
@@ -1091,7 +1090,7 @@
result = zend_call_function(&fci, NULL TSRMLS_CC);
if (result == FAILURE && EG(exception) == NULL) {
- zval_dtor(&reflector);
+ zval_ptr_dtor(&reflector_ptr);
zval_ptr_dtor(&retval_ptr);
_DO_THROW("Could not execute reflection::export()");
}
@@ -1103,7 +1102,7 @@
}
/* Destruct reflector which is no longer needed */
- zval_dtor(&reflector);
+ zval_ptr_dtor(&reflector_ptr);
}
/* }}} */
@@ -1119,7 +1118,7 @@
Exports a reflection object. Returns the output if TRUE is specified for return, printing it
otherwise. */
ZEND_METHOD(reflection, export)
{
- zval *object, *fname, *retval_ptr;
+ zval *object, fname, *retval_ptr;
int result;
zend_bool return_output = 0;
@@ -1128,10 +1127,9 @@
}
/* Invoke the __toString() method */
- MAKE_STD_ZVAL(fname);
- ZVAL_STRINGL(fname, "__tostring", sizeof("__tostring") - 1, 1);
- result= call_user_function_ex(NULL, &object, fname, &retval_ptr, 0, NULL, 0, NULL
TSRMLS_CC);
- zval_ptr_dtor(&fname);
+ ZVAL_STRINGL(&fname, "__tostring", sizeof("__tostring") - 1, 1);
+ result= call_user_function_ex(NULL, &object, &fname, &retval_ptr, 0, NULL, 0, NULL
TSRMLS_CC);
+ zval_dtor(&fname);
if (result == FAILURE) {
_DO_THROW("Invocation of method __toString() failed");
@@ -3668,7 +3666,7 @@
int number = va_arg(args, int);
if (number == constant->module_number) {
- MAKE_STD_ZVAL(const_val);
+ ALLOC_ZVAL(const_val);
*const_val = constant->value;
zval_copy_ctor(const_val);
INIT_PZVAL(const_val);