cvs: ZendEngine2 / zend_API.c zend_API.h zend_compile.c zend_compile.h zend_execute.c
| From: | Zeev Suraski | Date: | Wed, 25 Feb 2004 14:56:46 +0000 |
| Subject: | cvs: ZendEngine2 / zend_API.c zend_API.h zend_compile.c zend_compile.h zend_execute.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-2408@lists.php.net to get a copy of this message | ||
zeev Wed Feb 25 09:56:46 2004 EDT
Modified files:
/ZendEngine2 zend_API.c zend_API.h zend_compile.c zend_compile.h
zend_execute.c
Log:
- Improve ARG_INFO() macros to support supplying required_num_args
- Initial fix for foreach($o->mthd()->arr) crash (now leaks)
http://cvs.php.net/diff.php/ZendEngine2/zend_API.c?r1=1.241&r2=1.242&ty=u
Index: ZendEngine2/zend_API.c
diff -u ZendEngine2/zend_API.c:1.241 ZendEngine2/zend_API.c:1.242
--- ZendEngine2/zend_API.c:1.241 Wed Feb 25 04:25:36 2004
+++ ZendEngine2/zend_API.c Wed Feb 25 09:56:45 2004
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_API.c,v 1.241 2004/02/25 09:25:36 zeev Exp $ */
+/* $Id: zend_API.c,v 1.242 2004/02/25 14:56:45 zeev Exp $ */
#include "zend.h"
#include "zend_execute.h"
@@ -1221,7 +1221,11 @@
internal_function->arg_info = ptr->arg_info+1;
internal_function->num_args = ptr->num_args;
/* Currently you cannot denote that the function can accept less arguments than num_args */
- internal_function->required_num_args = ptr->num_args;
+ if (ptr->arg_info[0].required_num_args == -1) {
+ internal_function->required_num_args = ptr->num_args;
+ } else {
+ internal_function->required_num_args = ptr->arg_info[0].required_num_args;
+ }
internal_function->pass_rest_by_reference = ptr->arg_info[0].pass_by_reference;
internal_function->return_reference = ptr->arg_info[0].return_reference;
} else {
http://cvs.php.net/diff.php/ZendEngine2/zend_API.h?r1=1.179&r2=1.180&ty=u
Index: ZendEngine2/zend_API.h
diff -u ZendEngine2/zend_API.h:1.179 ZendEngine2/zend_API.h:1.180
--- ZendEngine2/zend_API.h:1.179 Fri Feb 20 03:03:27 2004
+++ ZendEngine2/zend_API.h Wed Feb 25 09:56:45 2004
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_API.h,v 1.179 2004/02/20 08:03:27 hholzgra Exp $ */
+/* $Id: zend_API.h,v 1.180 2004/02/25 14:56:45 zeev Exp $ */
#ifndef ZEND_API_H
#define ZEND_API_H
@@ -57,14 +57,14 @@
ZEND_FENTRY(name, ZEND_FN(classname##_##alias),
arg_info, flags)
#define ZEND_ME_MAPPING(name, func_name, arg_types) ZEND_NAMED_FE(name, ZEND_FN(func_name),
arg_types)
-#define ZEND_ARG_INFO(pass_by_ref, name) { #name, sizeof(#name)-1, NULL, 0, 0, pass_by_ref, 0
},
-#define ZEND_ARG_PASS_INFO(pass_by_ref) { NULL, 0, NULL, 0, 0, pass_by_ref, 0 },
-#define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) { #name, sizeof(#name)-1,
#classname, sizeof(#classname)-1, allow_null, pass_by_ref, 0 },
-#define ZEND_BEGIN_ARG_INFO_EX(name, pass_rest_by_reference, return_reference) \
- zend_arg_info name[] = { \
- { NULL, 0, NULL, 0, 0, pass_rest_by_reference, return_reference },
+#define ZEND_ARG_INFO(pass_by_ref, name) { #name, sizeof(#name)-1, NULL, 0, 0, pass_by_ref,
0, 0 },
+#define ZEND_ARG_PASS_INFO(pass_by_ref) { NULL, 0, NULL, 0, 0, pass_by_ref, 0, 0 },
+#define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) { #name, sizeof(#name)-1,
#classname, sizeof(#classname)-1, allow_null, pass_by_ref, 0, 0 },
+#define ZEND_BEGIN_ARG_INFO_EX(name, pass_rest_by_reference, return_reference, required_num_args) \
+ zend_arg_info name[] = { \
+ { NULL, 0, NULL, 0, 0, pass_rest_by_reference, return_reference, required_num_args },
#define ZEND_BEGIN_ARG_INFO(name, pass_rest_by_reference) \
- ZEND_BEGIN_ARG_INFO_EX(name, pass_rest_by_reference, ZEND_RETURN_REFERENCE_AGNOSTIC)
+ ZEND_BEGIN_ARG_INFO_EX(name, pass_rest_by_reference, ZEND_RETURN_REFERENCE_AGNOSTIC, -1)
#define ZEND_END_ARG_INFO() };
/* Name macros */
http://cvs.php.net/diff.php/ZendEngine2/zend_compile.c?r1=1.545&r2=1.546&ty=u
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.545 ZendEngine2/zend_compile.c:1.546
--- ZendEngine2/zend_compile.c:1.545 Wed Feb 25 05:57:09 2004
+++ ZendEngine2/zend_compile.c Wed Feb 25 09:56:45 2004
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_compile.c,v 1.545 2004/02/25 10:57:09 zeev Exp $ */
+/* $Id: zend_compile.c,v 1.546 2004/02/25 14:56:45 zeev Exp $ */
#include "zend_language_parser.h"
#include "zend.h"
@@ -1713,7 +1713,7 @@
zend_uint i;
zend_function *proto = fe->common.prototype;
- if (!proto) {
+ if (!proto || !proto->common.arg_info) {
return 1;
}
@@ -3275,6 +3275,10 @@
is_variable = 1;
}
zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC);
+ if (CG(active_op_array)->opcodes[CG(active_op_array)->last-1].opcode == ZEND_FETCH_OBJ_W) {
+ /* FIXME: This will cause a leak, we have to unlock at the end of foreach() */
+ CG(active_op_array)->opcodes[CG(active_op_array)->last-1].extended_value |=
ZEND_FETCH_ADD_LOCK;
+ }
} else {
is_variable = 0;
}
http://cvs.php.net/diff.php/ZendEngine2/zend_compile.h?r1=1.276&r2=1.277&ty=u
Index: ZendEngine2/zend_compile.h
diff -u ZendEngine2/zend_compile.h:1.276 ZendEngine2/zend_compile.h:1.277
--- ZendEngine2/zend_compile.h:1.276 Wed Feb 25 04:25:37 2004
+++ ZendEngine2/zend_compile.h Wed Feb 25 09:56:45 2004
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_compile.h,v 1.276 2004/02/25 09:25:37 zeev Exp $ */
+/* $Id: zend_compile.h,v 1.277 2004/02/25 14:56:45 zeev Exp $ */
#ifndef ZEND_COMPILE_H
#define ZEND_COMPILE_H
@@ -141,6 +141,7 @@
zend_bool allow_null;
zend_bool pass_by_reference;
zend_bool return_reference;
+ int required_num_args;
} zend_arg_info;
struct _zend_op_array {
http://cvs.php.net/diff.php/ZendEngine2/zend_execute.c?r1=1.613&r2=1.614&ty=u
Index: ZendEngine2/zend_execute.c
diff -u ZendEngine2/zend_execute.c:1.613 ZendEngine2/zend_execute.c:1.614
--- ZendEngine2/zend_execute.c:1.613 Wed Feb 25 05:57:09 2004
+++ ZendEngine2/zend_execute.c Wed Feb 25 09:56:45 2004
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_execute.c,v 1.613 2004/02/25 10:57:09 zeev Exp $ */
+/* $Id: zend_execute.c,v 1.614 2004/02/25 14:56:45 zeev Exp $ */
#define ZEND_INTENSIVE_DEBUGGING 0
@@ -2040,6 +2040,9 @@
int zend_fetch_obj_w_handler(ZEND_OPCODE_HANDLER_ARGS)
{
+ if (opline->extended_value == ZEND_FETCH_ADD_LOCK) {
+ PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr);
+ }
zend_fetch_property_address(&opline->result, &opline->op1, &opline->op2,
EX(Ts), BP_VAR_W TSRMLS_CC);
NEXT_OPCODE();
}