cvs: ZendEngine2 / zend_vm_def.h zend_vm_execute.h zend_vm_opcodes.h /tests bug30407.phpt php-src NEWS
| From: | Dmitry Stogov | Date: | Thu, 10 Feb 2005 11:45:25 +0000 |
| Subject: | cvs: ZendEngine2 / zend_vm_def.h zend_vm_execute.h zend_vm_opcodes.h /tests bug30407.phpt php-src NEWS | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-3378@lists.php.net to get a copy of this message | ||
dmitry Thu Feb 10 06:45:25 2005 EDT
Added files:
/ZendEngine2/tests bug30407.phpt
Modified files:
/php-src NEWS
/ZendEngine2 zend_vm_def.h zend_vm_execute.h zend_vm_opcodes.h
Log:
Fixed bug #30407 (Strange behaviour of default arguments)
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1840&r2=1.1841&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1840 php-src/NEWS:1.1841
--- php-src/NEWS:1.1840 Tue Feb 8 10:25:43 2005
+++ php-src/NEWS Thu Feb 10 06:45:22 2005
@@ -67,6 +67,7 @@
- Fixed bug in mysql::client_version(). (Georg)
- Fixed ZTS destruction. (Marcus)
- Fixed bug #31478 (segfault with empty() / isset()). (Moriyoshi)
+- Fixed bug #30407 (Strange behaviour of default arguments). (Dmitry)
- Fixed bug #29728 (Reflection API Feature: Default parameter value). (Marcus)
- Fixed bug #29522 (accessing properties without connection). (Georg)
- Fixed bug #29335 (fetch functions now use MYSQLI_BOTH as default). (Georg)
http://cvs.php.net/diff.php/ZendEngine2/zend_vm_def.h?r1=1.14&r2=1.15&ty=u
Index: ZendEngine2/zend_vm_def.h
diff -u ZendEngine2/zend_vm_def.h:1.14 ZendEngine2/zend_vm_def.h:1.15
--- ZendEngine2/zend_vm_def.h:1.14 Mon Feb 7 11:09:54 2005
+++ ZendEngine2/zend_vm_def.h Thu Feb 10 06:45:23 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_vm_def.h,v 1.14 2005/02/07 16:09:54 dmitry Exp $ */
+/* $Id: zend_vm_def.h,v 1.15 2005/02/10 11:45:23 dmitry Exp $ */
ZEND_VM_HANDLER(1, ZEND_ADD, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
{
@@ -2197,7 +2197,6 @@
zval **param, *assignment_value;
zend_uint arg_num = opline->op1.u.constant.value.lval;
zend_free_op free_res;
- zval **var_ptr = get_zval_ptr_ptr(&opline->result, EX(Ts), &free_res, BP_VAR_W);
if (zend_ptr_stack_get_arg(arg_num, (void **) ¶m TSRMLS_CC)==FAILURE) {
if (opline->op2.u.constant.type == IS_CONSTANT ||
opline->op2.u.constant.type==IS_CONSTANT_ARRAY) {
@@ -2219,8 +2218,10 @@
assignment_value = &opline->op2.u.constant;
}
zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value TSRMLS_CC);
- zend_receive(var_ptr, assignment_value TSRMLS_CC);
+ zend_assign_to_variable(NULL, &opline->result, NULL, assignment_value, IS_VAR, EX(Ts)
TSRMLS_CC);
} else {
+ zval **var_ptr = get_zval_ptr_ptr(&opline->result, EX(Ts), &free_res, BP_VAR_W);
+
assignment_value = *param;
zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value TSRMLS_CC);
if (PZVAL_IS_REF(assignment_value)) {
http://cvs.php.net/diff.php/ZendEngine2/zend_vm_execute.h?r1=1.16&r2=1.17&ty=u
Index: ZendEngine2/zend_vm_execute.h
diff -u ZendEngine2/zend_vm_execute.h:1.16 ZendEngine2/zend_vm_execute.h:1.17
--- ZendEngine2/zend_vm_execute.h:1.16 Mon Feb 7 11:09:54 2005
+++ ZendEngine2/zend_vm_execute.h Thu Feb 10 06:45:23 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_vm_execute.h,v 1.16 2005/02/07 16:09:54 dmitry Exp $ */
+/* $Id: zend_vm_execute.h,v 1.17 2005/02/10 11:45:23 dmitry Exp $ */
#define ZEND_VM_CONTINUE() return 0
@@ -638,7 +638,6 @@
zval **param, *assignment_value;
zend_uint arg_num = opline->op1.u.constant.value.lval;
zend_free_op free_res;
- zval **var_ptr = get_zval_ptr_ptr(&opline->result, EX(Ts), &free_res, BP_VAR_W);
if (zend_ptr_stack_get_arg(arg_num, (void **) ¶m TSRMLS_CC)==FAILURE) {
if (opline->op2.u.constant.type == IS_CONSTANT ||
opline->op2.u.constant.type==IS_CONSTANT_ARRAY) {
@@ -660,8 +659,10 @@
assignment_value = &opline->op2.u.constant;
}
zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value TSRMLS_CC);
- zend_receive(var_ptr, assignment_value TSRMLS_CC);
+ zend_assign_to_variable(NULL, &opline->result, NULL, assignment_value, IS_VAR, EX(Ts)
TSRMLS_CC);
} else {
+ zval **var_ptr = get_zval_ptr_ptr(&opline->result, EX(Ts), &free_res, BP_VAR_W);
+
assignment_value = *param;
zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value TSRMLS_CC);
if (PZVAL_IS_REF(assignment_value)) {
@@ -29910,7 +29911,6 @@
zval **param, *assignment_value;
zend_uint arg_num = opline->op1.u.constant.value.lval;
zend_free_op free_res;
- zval **var_ptr = get_zval_ptr_ptr(&opline->result, EX(Ts), &free_res, BP_VAR_W);
if (zend_ptr_stack_get_arg(arg_num, (void **) ¶m TSRMLS_CC)==FAILURE) {
if (opline->op2.u.constant.type == IS_CONSTANT ||
opline->op2.u.constant.type==IS_CONSTANT_ARRAY) {
@@ -29932,8 +29932,10 @@
assignment_value = &opline->op2.u.constant;
}
zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value TSRMLS_CC);
- zend_receive(var_ptr, assignment_value TSRMLS_CC);
+ zend_assign_to_variable(NULL, &opline->result, NULL, assignment_value, IS_VAR, EX(Ts)
TSRMLS_CC);
} else {
+ zval **var_ptr = get_zval_ptr_ptr(&opline->result, EX(Ts), &free_res, BP_VAR_W);
+
assignment_value = *param;
zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value TSRMLS_CC);
if (PZVAL_IS_REF(assignment_value)) {
http://cvs.php.net/diff.php/ZendEngine2/zend_vm_opcodes.h?r1=1.6&r2=1.7&ty=u
Index: ZendEngine2/zend_vm_opcodes.h
diff -u ZendEngine2/zend_vm_opcodes.h:1.6 ZendEngine2/zend_vm_opcodes.h:1.7
--- ZendEngine2/zend_vm_opcodes.h:1.6 Mon Feb 7 11:09:54 2005
+++ ZendEngine2/zend_vm_opcodes.h Thu Feb 10 06:45:24 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_vm_opcodes.h,v 1.6 2005/02/07 16:09:54 dmitry Exp $ */
+/* $Id: zend_vm_opcodes.h,v 1.7 2005/02/10 11:45:24 dmitry Exp $ */
#define ZEND_NOP 0
#define ZEND_ADD 1
http://cvs.php.net/co.php/ZendEngine2/tests/bug30407.phpt?r=1.1&p=1
Index: ZendEngine2/tests/bug30407.phpt
+++ ZendEngine2/tests/bug30407.phpt
--TEST--
Bug #30407 (Strange behaviour of default arguments)
--FILE--
<?php
function haricow($a = 'one') {
var_dump($a);
$a = 'two';
}
haricow();
haricow();
?>
===DONE===
--EXPECT--
string(3) "one"
string(3) "one"
===DONE===