version 1.1, 2012/02/21 23:47:52
|
version 1.1.1.5, 2014/06/15 20:04:04
|
Line 2
|
Line 2
|
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| Zend Engine | |
| Zend Engine | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) | | | Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| This source file is subject to version 2.00 of the Zend license, | |
| This source file is subject to version 2.00 of the Zend license, | |
| that is bundled with this package in the file LICENSE, and is | |
| that is bundled with this package in the file LICENSE, and is | |
Line 27
|
Line 27
|
|
|
ZEND_VM_HANDLER(1, ZEND_ADD, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(1, ZEND_ADD, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
|
|
add_function(&EX_T(opline->result.u.var).tmp_var, | SAVE_OPLINE(); |
| fast_add_function(&EX_T(opline->result.var).tmp_var, |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
FREE_OP1(); |
FREE_OP1(); |
FREE_OP2(); |
FREE_OP2(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(2, ZEND_SUB, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(2, ZEND_SUB, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
|
|
sub_function(&EX_T(opline->result.u.var).tmp_var, | SAVE_OPLINE(); |
| fast_sub_function(&EX_T(opline->result.var).tmp_var, |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
FREE_OP1(); |
FREE_OP1(); |
FREE_OP2(); |
FREE_OP2(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(3, ZEND_MUL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(3, ZEND_MUL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
|
|
mul_function(&EX_T(opline->result.u.var).tmp_var, | SAVE_OPLINE(); |
| fast_mul_function(&EX_T(opline->result.var).tmp_var, |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
FREE_OP1(); |
FREE_OP1(); |
FREE_OP2(); |
FREE_OP2(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(4, ZEND_DIV, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(4, ZEND_DIV, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
|
|
div_function(&EX_T(opline->result.u.var).tmp_var, | SAVE_OPLINE(); |
| fast_div_function(&EX_T(opline->result.var).tmp_var, |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
FREE_OP1(); |
FREE_OP1(); |
FREE_OP2(); |
FREE_OP2(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(5, ZEND_MOD, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(5, ZEND_MOD, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
|
|
mod_function(&EX_T(opline->result.u.var).tmp_var, | SAVE_OPLINE(); |
| fast_mod_function(&EX_T(opline->result.var).tmp_var, |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
FREE_OP1(); |
FREE_OP1(); |
FREE_OP2(); |
FREE_OP2(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(6, ZEND_SL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(6, ZEND_SL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
|
|
shift_left_function(&EX_T(opline->result.u.var).tmp_var, | SAVE_OPLINE(); |
| shift_left_function(&EX_T(opline->result.var).tmp_var, |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
FREE_OP1(); |
FREE_OP1(); |
FREE_OP2(); |
FREE_OP2(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(7, ZEND_SR, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(7, ZEND_SR, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
|
|
shift_right_function(&EX_T(opline->result.u.var).tmp_var, | SAVE_OPLINE(); |
| shift_right_function(&EX_T(opline->result.var).tmp_var, |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
FREE_OP1(); |
FREE_OP1(); |
FREE_OP2(); |
FREE_OP2(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(8, ZEND_CONCAT, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(8, ZEND_CONCAT, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
|
|
concat_function(&EX_T(opline->result.u.var).tmp_var, | SAVE_OPLINE(); |
| concat_function(&EX_T(opline->result.var).tmp_var, |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
FREE_OP1(); |
FREE_OP1(); |
FREE_OP2(); |
FREE_OP2(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(15, ZEND_IS_IDENTICAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(15, ZEND_IS_IDENTICAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
|
|
is_identical_function(&EX_T(opline->result.u.var).tmp_var, | SAVE_OPLINE(); |
| is_identical_function(&EX_T(opline->result.var).tmp_var, |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
FREE_OP1(); |
FREE_OP1(); |
FREE_OP2(); |
FREE_OP2(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(16, ZEND_IS_NOT_IDENTICAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(16, ZEND_IS_NOT_IDENTICAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
zval *result = &EX_T(opline->result.u.var).tmp_var; | zval *result = &EX_T(opline->result.var).tmp_var; |
|
|
|
SAVE_OPLINE(); |
is_identical_function(result, |
is_identical_function(result, |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
Z_LVAL_P(result) = !Z_LVAL_P(result); |
Z_LVAL_P(result) = !Z_LVAL_P(result); |
FREE_OP1(); |
FREE_OP1(); |
FREE_OP2(); |
FREE_OP2(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(17, ZEND_IS_EQUAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(17, ZEND_IS_EQUAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
zval *result = &EX_T(opline->result.u.var).tmp_var; | zval *result = &EX_T(opline->result.var).tmp_var; |
|
|
compare_function(result, | SAVE_OPLINE(); |
| ZVAL_BOOL(result, fast_equal_function(result, |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); | GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC)); |
ZVAL_BOOL(result, (Z_LVAL_P(result) == 0)); | |
FREE_OP1(); |
FREE_OP1(); |
FREE_OP2(); |
FREE_OP2(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(18, ZEND_IS_NOT_EQUAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(18, ZEND_IS_NOT_EQUAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
zval *result = &EX_T(opline->result.u.var).tmp_var; | zval *result = &EX_T(opline->result.var).tmp_var; |
|
|
compare_function(result, | SAVE_OPLINE(); |
| ZVAL_BOOL(result, fast_not_equal_function(result, |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); | GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC)); |
ZVAL_BOOL(result, (Z_LVAL_P(result) != 0)); | |
FREE_OP1(); |
FREE_OP1(); |
FREE_OP2(); |
FREE_OP2(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(19, ZEND_IS_SMALLER, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(19, ZEND_IS_SMALLER, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
zval *result = &EX_T(opline->result.u.var).tmp_var; | zval *result = &EX_T(opline->result.var).tmp_var; |
|
|
compare_function(result, | SAVE_OPLINE(); |
| ZVAL_BOOL(result, fast_is_smaller_function(result, |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); | GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC)); |
ZVAL_BOOL(result, (Z_LVAL_P(result) < 0)); | |
FREE_OP1(); |
FREE_OP1(); |
FREE_OP2(); |
FREE_OP2(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(20, ZEND_IS_SMALLER_OR_EQUAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(20, ZEND_IS_SMALLER_OR_EQUAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
zval *result = &EX_T(opline->result.u.var).tmp_var; | zval *result = &EX_T(opline->result.var).tmp_var; |
|
|
compare_function(result, | SAVE_OPLINE(); |
| ZVAL_BOOL(result, fast_is_smaller_or_equal_function(result, |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); | GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC)); |
ZVAL_BOOL(result, (Z_LVAL_P(result) <= 0)); | |
FREE_OP1(); |
FREE_OP1(); |
FREE_OP2(); |
FREE_OP2(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(9, ZEND_BW_OR, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(9, ZEND_BW_OR, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
|
|
bitwise_or_function(&EX_T(opline->result.u.var).tmp_var, | SAVE_OPLINE(); |
| bitwise_or_function(&EX_T(opline->result.var).tmp_var, |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
FREE_OP1(); |
FREE_OP1(); |
FREE_OP2(); |
FREE_OP2(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(10, ZEND_BW_AND, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(10, ZEND_BW_AND, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
|
|
bitwise_and_function(&EX_T(opline->result.u.var).tmp_var, | SAVE_OPLINE(); |
| bitwise_and_function(&EX_T(opline->result.var).tmp_var, |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
FREE_OP1(); |
FREE_OP1(); |
FREE_OP2(); |
FREE_OP2(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(11, ZEND_BW_XOR, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(11, ZEND_BW_XOR, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
|
|
bitwise_xor_function(&EX_T(opline->result.u.var).tmp_var, | SAVE_OPLINE(); |
| bitwise_xor_function(&EX_T(opline->result.var).tmp_var, |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
FREE_OP1(); |
FREE_OP1(); |
FREE_OP2(); |
FREE_OP2(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(14, ZEND_BOOL_XOR, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(14, ZEND_BOOL_XOR, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
|
|
boolean_xor_function(&EX_T(opline->result.u.var).tmp_var, | SAVE_OPLINE(); |
| boolean_xor_function(&EX_T(opline->result.var).tmp_var, |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
FREE_OP1(); |
FREE_OP1(); |
FREE_OP2(); |
FREE_OP2(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(12, ZEND_BW_NOT, CONST|TMP|VAR|CV, ANY) |
ZEND_VM_HANDLER(12, ZEND_BW_NOT, CONST|TMP|VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
|
|
bitwise_not_function(&EX_T(opline->result.u.var).tmp_var, | SAVE_OPLINE(); |
| bitwise_not_function(&EX_T(opline->result.var).tmp_var, |
GET_OP1_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
GET_OP1_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
FREE_OP1(); |
FREE_OP1(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(13, ZEND_BOOL_NOT, CONST|TMP|VAR|CV, ANY) |
ZEND_VM_HANDLER(13, ZEND_BOOL_NOT, CONST|TMP|VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
|
|
boolean_not_function(&EX_T(opline->result.u.var).tmp_var, | SAVE_OPLINE(); |
| boolean_not_function(&EX_T(opline->result.var).tmp_var, |
GET_OP1_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
GET_OP1_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
FREE_OP1(); |
FREE_OP1(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR|UNUSED|CV, int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC)) |
ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR|UNUSED|CV, int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC)) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_op *op_data = opline+1; | |
zend_free_op free_op1, free_op2, free_op_data1; |
zend_free_op free_op1, free_op2, free_op_data1; |
zval **object_ptr = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_W); | zval **object_ptr = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_RW); |
zval *object; |
zval *object; |
zval *property = GET_OP2_ZVAL_PTR(BP_VAR_R); |
zval *property = GET_OP2_ZVAL_PTR(BP_VAR_R); |
zval *value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); | zval *value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, EX_Ts(), &free_op_data1, BP_VAR_R); |
znode *result = &opline->result; | |
int have_get_ptr = 0; |
int have_get_ptr = 0; |
|
|
if (OP1_TYPE == IS_VAR && !object_ptr) { | if (OP1_TYPE == IS_VAR && UNEXPECTED(object_ptr == NULL)) { |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); |
} |
} |
|
|
EX_T(result->u.var).var.ptr_ptr = NULL; |
|
make_real_object(object_ptr TSRMLS_CC); |
make_real_object(object_ptr TSRMLS_CC); |
object = *object_ptr; |
object = *object_ptr; |
|
|
if (Z_TYPE_P(object) != IS_OBJECT) { | if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) { |
zend_error(E_WARNING, "Attempt to assign property of non-object"); |
zend_error(E_WARNING, "Attempt to assign property of non-object"); |
FREE_OP2(); |
FREE_OP2(); |
FREE_OP(free_op_data1); |
FREE_OP(free_op_data1); |
|
|
if (!RETURN_VALUE_UNUSED(result)) { | if (RETURN_VALUE_USED(opline)) { |
EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); | PZVAL_LOCK(&EG(uninitialized_zval)); |
EX_T(result->u.var).var.ptr_ptr = NULL; | EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval); |
PZVAL_LOCK(EG(uninitialized_zval_ptr)); | EX_T(opline->result.var).var.ptr_ptr = NULL; |
} |
} |
} else { |
} else { |
/* here we are sure we are dealing with an object */ |
/* here we are sure we are dealing with an object */ |
Line 330 ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VA
|
Line 363 ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VA
|
/* here property is a string */ |
/* here property is a string */ |
if (opline->extended_value == ZEND_ASSIGN_OBJ |
if (opline->extended_value == ZEND_ASSIGN_OBJ |
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) { |
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) { |
zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property TSRMLS_CC); | zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); |
if (zptr != NULL) { /* NULL means no success in getting PTR */ |
if (zptr != NULL) { /* NULL means no success in getting PTR */ |
SEPARATE_ZVAL_IF_NOT_REF(zptr); |
SEPARATE_ZVAL_IF_NOT_REF(zptr); |
|
|
have_get_ptr = 1; |
have_get_ptr = 1; |
binary_op(*zptr, *zptr, value TSRMLS_CC); |
binary_op(*zptr, *zptr, value TSRMLS_CC); |
if (!RETURN_VALUE_UNUSED(result)) { | if (RETURN_VALUE_USED(opline)) { |
EX_T(result->u.var).var.ptr = *zptr; | |
EX_T(result->u.var).var.ptr_ptr = NULL; | |
PZVAL_LOCK(*zptr); |
PZVAL_LOCK(*zptr); |
|
EX_T(opline->result.var).var.ptr = *zptr; |
|
EX_T(opline->result.var).var.ptr_ptr = NULL; |
} |
} |
} |
} |
} |
} |
Line 349 ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VA
|
Line 382 ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VA
|
|
|
if (opline->extended_value == ZEND_ASSIGN_OBJ) { |
if (opline->extended_value == ZEND_ASSIGN_OBJ) { |
if (Z_OBJ_HT_P(object)->read_property) { |
if (Z_OBJ_HT_P(object)->read_property) { |
z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); | z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); |
} |
} |
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { |
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { |
if (Z_OBJ_HT_P(object)->read_dimension) { |
if (Z_OBJ_HT_P(object)->read_dimension) { |
Line 371 ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VA
|
Line 404 ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VA
|
SEPARATE_ZVAL_IF_NOT_REF(&z); |
SEPARATE_ZVAL_IF_NOT_REF(&z); |
binary_op(z, z, value TSRMLS_CC); |
binary_op(z, z, value TSRMLS_CC); |
if (opline->extended_value == ZEND_ASSIGN_OBJ) { |
if (opline->extended_value == ZEND_ASSIGN_OBJ) { |
Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); | Z_OBJ_HT_P(object)->write_property(object, property, z, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); |
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { |
} else /* if (opline->extended_value == ZEND_ASSIGN_DIM) */ { |
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); |
Z_OBJ_HT_P(object)->write_dimension(object, property, z TSRMLS_CC); |
} |
} |
if (!RETURN_VALUE_UNUSED(result)) { | if (RETURN_VALUE_USED(opline)) { |
EX_T(result->u.var).var.ptr = z; | |
EX_T(result->u.var).var.ptr_ptr = NULL; | |
PZVAL_LOCK(z); |
PZVAL_LOCK(z); |
|
EX_T(opline->result.var).var.ptr = z; |
|
EX_T(opline->result.var).var.ptr_ptr = NULL; |
} |
} |
zval_ptr_dtor(&z); |
zval_ptr_dtor(&z); |
} else { |
} else { |
zend_error(E_WARNING, "Attempt to assign property of non-object"); |
zend_error(E_WARNING, "Attempt to assign property of non-object"); |
if (!RETURN_VALUE_UNUSED(result)) { | if (RETURN_VALUE_USED(opline)) { |
EX_T(result->u.var).var.ptr = EG(uninitialized_zval_ptr); | PZVAL_LOCK(&EG(uninitialized_zval)); |
EX_T(result->u.var).var.ptr_ptr = NULL; | EX_T(opline->result.var).var.ptr = &EG(uninitialized_zval); |
PZVAL_LOCK(EG(uninitialized_zval_ptr)); | EX_T(opline->result.var).var.ptr_ptr = NULL; |
} |
} |
} |
} |
} |
} |
Line 401 ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VA
|
Line 434 ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VA
|
|
|
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
/* assign_obj has two opcodes! */ |
/* assign_obj has two opcodes! */ |
|
CHECK_EXCEPTION(); |
ZEND_VM_INC_OPCODE(); |
ZEND_VM_INC_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HELPER_EX(zend_binary_assign_op_helper, VAR|UNUSED|CV, CONST|TMP|VAR|UNUSED|CV, int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC)) |
ZEND_VM_HELPER_EX(zend_binary_assign_op_helper, VAR|UNUSED|CV, CONST|TMP|VAR|UNUSED|CV, int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC)) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2, free_op_data2, free_op_data1; |
zend_free_op free_op1, free_op2, free_op_data2, free_op_data1; |
zval **var_ptr; |
zval **var_ptr; |
zval *value; |
zval *value; |
|
|
|
SAVE_OPLINE(); |
switch (opline->extended_value) { |
switch (opline->extended_value) { |
case ZEND_ASSIGN_OBJ: |
case ZEND_ASSIGN_OBJ: |
ZEND_VM_DISPATCH_TO_HELPER_EX(zend_binary_assign_op_obj_helper, binary_op, binary_op); |
ZEND_VM_DISPATCH_TO_HELPER_EX(zend_binary_assign_op_obj_helper, binary_op, binary_op); |
Line 419 ZEND_VM_HELPER_EX(zend_binary_assign_op_helper, VAR|UN
|
Line 454 ZEND_VM_HELPER_EX(zend_binary_assign_op_helper, VAR|UN
|
case ZEND_ASSIGN_DIM: { |
case ZEND_ASSIGN_DIM: { |
zval **container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_RW); |
zval **container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_RW); |
|
|
if (OP1_TYPE == IS_VAR && !container) { | if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) { |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); |
} else if (Z_TYPE_PP(container) == IS_OBJECT) { | } else if (UNEXPECTED(Z_TYPE_PP(container) == IS_OBJECT)) { |
if (OP1_TYPE == IS_VAR && !OP1_FREE) { |
if (OP1_TYPE == IS_VAR && !OP1_FREE) { |
Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */ |
Z_ADDREF_PP(container); /* undo the effect of get_obj_zval_ptr_ptr() */ |
} |
} |
ZEND_VM_DISPATCH_TO_HELPER_EX(zend_binary_assign_op_obj_helper, binary_op, binary_op); |
ZEND_VM_DISPATCH_TO_HELPER_EX(zend_binary_assign_op_obj_helper, binary_op, binary_op); |
} else { |
} else { |
zend_op *op_data = opline+1; |
|
zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R); |
zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R); |
|
|
zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), container, dim, IS_OP2_TMP_FREE(), BP_VAR_RW TSRMLS_CC); | zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), container, dim, OP2_TYPE, BP_VAR_RW TSRMLS_CC); |
value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); | value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, EX_Ts(), &free_op_data1, BP_VAR_R); |
var_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); | var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, EX_Ts(), &free_op_data2 TSRMLS_CC); |
ZEND_VM_INC_OPCODE(); | |
} |
} |
} |
} |
break; |
break; |
Line 444 ZEND_VM_HELPER_EX(zend_binary_assign_op_helper, VAR|UN
|
Line 477 ZEND_VM_HELPER_EX(zend_binary_assign_op_helper, VAR|UN
|
break; |
break; |
} |
} |
|
|
if (!var_ptr) { | if (UNEXPECTED(var_ptr == NULL)) { |
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets"); |
zend_error_noreturn(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets"); |
} |
} |
|
|
if (*var_ptr == EG(error_zval_ptr)) { | if (UNEXPECTED(*var_ptr == &EG(error_zval))) { |
if (!RETURN_VALUE_UNUSED(&opline->result)) { | if (RETURN_VALUE_USED(opline)) { |
AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); | PZVAL_LOCK(&EG(uninitialized_zval)); |
PZVAL_LOCK(EG(uninitialized_zval_ptr)); | AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); |
} |
} |
FREE_OP2(); |
FREE_OP2(); |
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
|
CHECK_EXCEPTION(); |
|
if (opline->extended_value == ZEND_ASSIGN_DIM) { |
|
ZEND_VM_INC_OPCODE(); |
|
} |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
SEPARATE_ZVAL_IF_NOT_REF(var_ptr); |
SEPARATE_ZVAL_IF_NOT_REF(var_ptr); |
|
|
if(Z_TYPE_PP(var_ptr) == IS_OBJECT && Z_OBJ_HANDLER_PP(var_ptr, get) | if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT) |
| && Z_OBJ_HANDLER_PP(var_ptr, get) |
&& Z_OBJ_HANDLER_PP(var_ptr, set)) { |
&& Z_OBJ_HANDLER_PP(var_ptr, set)) { |
/* proxy object */ |
/* proxy object */ |
zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); |
zval *objval = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); |
Line 472 ZEND_VM_HELPER_EX(zend_binary_assign_op_helper, VAR|UN
|
Line 510 ZEND_VM_HELPER_EX(zend_binary_assign_op_helper, VAR|UN
|
binary_op(*var_ptr, *var_ptr, value TSRMLS_CC); |
binary_op(*var_ptr, *var_ptr, value TSRMLS_CC); |
} |
} |
|
|
if (!RETURN_VALUE_UNUSED(&opline->result)) { | if (RETURN_VALUE_USED(opline)) { |
AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); | |
PZVAL_LOCK(*var_ptr); |
PZVAL_LOCK(*var_ptr); |
|
AI_SET_PTR(&EX_T(opline->result.var), *var_ptr); |
} |
} |
FREE_OP2(); |
FREE_OP2(); |
|
|
if (opline->extended_value == ZEND_ASSIGN_DIM) { |
if (opline->extended_value == ZEND_ASSIGN_DIM) { |
FREE_OP(free_op_data1); |
FREE_OP(free_op_data1); |
FREE_OP_VAR_PTR(free_op_data2); |
FREE_OP_VAR_PTR(free_op_data2); |
|
FREE_OP1_VAR_PTR(); |
|
CHECK_EXCEPTION(); |
|
ZEND_VM_INC_OPCODE(); |
|
} else { |
|
FREE_OP1_VAR_PTR(); |
|
CHECK_EXCEPTION(); |
} |
} |
FREE_OP1_VAR_PTR(); |
|
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
Line 543 ZEND_VM_HANDLER(33, ZEND_ASSIGN_BW_XOR, VAR|UNUSED|CV,
|
Line 586 ZEND_VM_HANDLER(33, ZEND_ASSIGN_BW_XOR, VAR|UNUSED|CV,
|
|
|
ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR|CV, incdec_t incdec_op) |
ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR|CV, incdec_t incdec_op) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
zval **object_ptr = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_W); | zval **object_ptr; |
zval *object; |
zval *object; |
zval *property = GET_OP2_ZVAL_PTR(BP_VAR_R); | zval *property; |
zval **retval = &EX_T(opline->result.u.var).var.ptr; | zval **retval; |
int have_get_ptr = 0; |
int have_get_ptr = 0; |
|
|
if (OP1_TYPE == IS_VAR && !object_ptr) { | SAVE_OPLINE(); |
| object_ptr = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_RW); |
| property = GET_OP2_ZVAL_PTR(BP_VAR_R); |
| retval = &EX_T(opline->result.var).var.ptr; |
| |
| if (OP1_TYPE == IS_VAR && UNEXPECTED(object_ptr == NULL)) { |
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); |
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); |
} |
} |
|
|
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ |
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ |
object = *object_ptr; |
object = *object_ptr; |
|
|
if (Z_TYPE_P(object) != IS_OBJECT) { | if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) { |
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); |
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); |
FREE_OP2(); |
FREE_OP2(); |
if (!RETURN_VALUE_UNUSED(&opline->result)) { | if (RETURN_VALUE_USED(opline)) { |
*retval = EG(uninitialized_zval_ptr); | PZVAL_LOCK(&EG(uninitialized_zval)); |
PZVAL_LOCK(*retval); | *retval = &EG(uninitialized_zval); |
} |
} |
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
Line 576 ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR
|
Line 625 ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR
|
} |
} |
|
|
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) { |
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) { |
zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property TSRMLS_CC); | zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); |
if (zptr != NULL) { /* NULL means no success in getting PTR */ |
if (zptr != NULL) { /* NULL means no success in getting PTR */ |
SEPARATE_ZVAL_IF_NOT_REF(zptr); |
SEPARATE_ZVAL_IF_NOT_REF(zptr); |
|
|
have_get_ptr = 1; |
have_get_ptr = 1; |
incdec_op(*zptr); |
incdec_op(*zptr); |
if (!RETURN_VALUE_UNUSED(&opline->result)) { | if (RETURN_VALUE_USED(opline)) { |
*retval = *zptr; |
*retval = *zptr; |
PZVAL_LOCK(*retval); |
PZVAL_LOCK(*retval); |
} |
} |
Line 591 ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR
|
Line 640 ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR
|
|
|
if (!have_get_ptr) { |
if (!have_get_ptr) { |
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { |
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { |
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); | zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); |
|
|
if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { | if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) { |
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); |
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); |
|
|
if (Z_REFCOUNT_P(z) == 0) { |
if (Z_REFCOUNT_P(z) == 0) { |
Line 607 ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR
|
Line 656 ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR
|
SEPARATE_ZVAL_IF_NOT_REF(&z); |
SEPARATE_ZVAL_IF_NOT_REF(&z); |
incdec_op(z); |
incdec_op(z); |
*retval = z; |
*retval = z; |
Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC); | Z_OBJ_HT_P(object)->write_property(object, property, z, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); |
SELECTIVE_PZVAL_LOCK(*retval, &opline->result); | SELECTIVE_PZVAL_LOCK(*retval, opline); |
zval_ptr_dtor(&z); |
zval_ptr_dtor(&z); |
} else { |
} else { |
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); |
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); |
if (!RETURN_VALUE_UNUSED(&opline->result)) { | if (RETURN_VALUE_USED(opline)) { |
*retval = EG(uninitialized_zval_ptr); | PZVAL_LOCK(&EG(uninitialized_zval)); |
PZVAL_LOCK(*retval); | *retval = &EG(uninitialized_zval); |
} |
} |
} |
} |
} |
} |
Line 625 ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR
|
Line 674 ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR
|
FREE_OP2(); |
FREE_OP2(); |
} |
} |
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
Line 640 ZEND_VM_HANDLER(133, ZEND_PRE_DEC_OBJ, VAR|UNUSED|CV,
|
Line 690 ZEND_VM_HANDLER(133, ZEND_PRE_DEC_OBJ, VAR|UNUSED|CV,
|
|
|
ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR|CV, incdec_t incdec_op) |
ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR|CV, incdec_t incdec_op) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
zval **object_ptr = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_W); | zval **object_ptr; |
zval *object; |
zval *object; |
zval *property = GET_OP2_ZVAL_PTR(BP_VAR_R); | zval *property; |
zval *retval = &EX_T(opline->result.u.var).tmp_var; | zval *retval; |
int have_get_ptr = 0; |
int have_get_ptr = 0; |
|
|
if (OP1_TYPE == IS_VAR && !object_ptr) { | SAVE_OPLINE(); |
| object_ptr = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_RW); |
| property = GET_OP2_ZVAL_PTR(BP_VAR_R); |
| retval = &EX_T(opline->result.var).tmp_var; |
| |
| if (OP1_TYPE == IS_VAR && UNEXPECTED(object_ptr == NULL)) { |
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); |
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); |
} |
} |
|
|
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ |
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */ |
object = *object_ptr; |
object = *object_ptr; |
|
|
if (Z_TYPE_P(object) != IS_OBJECT) { | if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) { |
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); |
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); |
FREE_OP2(); |
FREE_OP2(); |
*retval = *EG(uninitialized_zval_ptr); | ZVAL_NULL(retval); |
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
Line 670 ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VA
|
Line 726 ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VA
|
} |
} |
|
|
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) { |
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) { |
zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property TSRMLS_CC); | zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); |
if (zptr != NULL) { /* NULL means no success in getting PTR */ |
if (zptr != NULL) { /* NULL means no success in getting PTR */ |
have_get_ptr = 1; |
have_get_ptr = 1; |
SEPARATE_ZVAL_IF_NOT_REF(zptr); |
SEPARATE_ZVAL_IF_NOT_REF(zptr); |
|
|
*retval = **zptr; | ZVAL_COPY_VALUE(retval, *zptr); |
zendi_zval_copy_ctor(*retval); |
zendi_zval_copy_ctor(*retval); |
|
|
incdec_op(*zptr); |
incdec_op(*zptr); |
Line 685 ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VA
|
Line 741 ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VA
|
|
|
if (!have_get_ptr) { |
if (!have_get_ptr) { |
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { |
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) { |
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R TSRMLS_CC); | zval *z = Z_OBJ_HT_P(object)->read_property(object, property, BP_VAR_R, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); |
zval *z_copy; |
zval *z_copy; |
|
|
if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) { | if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) { |
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); |
zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC); |
|
|
if (Z_REFCOUNT_P(z) == 0) { |
if (Z_REFCOUNT_P(z) == 0) { |
Line 698 ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VA
|
Line 754 ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VA
|
} |
} |
z = value; |
z = value; |
} |
} |
*retval = *z; | ZVAL_COPY_VALUE(retval, z); |
zendi_zval_copy_ctor(*retval); |
zendi_zval_copy_ctor(*retval); |
ALLOC_ZVAL(z_copy); |
ALLOC_ZVAL(z_copy); |
*z_copy = *z; | INIT_PZVAL_COPY(z_copy, z); |
zendi_zval_copy_ctor(*z_copy); |
zendi_zval_copy_ctor(*z_copy); |
INIT_PZVAL(z_copy); |
|
incdec_op(z_copy); |
incdec_op(z_copy); |
Z_ADDREF_P(z); |
Z_ADDREF_P(z); |
Z_OBJ_HT_P(object)->write_property(object, property, z_copy TSRMLS_CC); | Z_OBJ_HT_P(object)->write_property(object, property, z_copy, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); |
zval_ptr_dtor(&z_copy); |
zval_ptr_dtor(&z_copy); |
zval_ptr_dtor(&z); |
zval_ptr_dtor(&z); |
} else { |
} else { |
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); |
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object"); |
*retval = *EG(uninitialized_zval_ptr); | ZVAL_NULL(retval); |
} |
} |
} |
} |
|
|
Line 721 ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VA
|
Line 776 ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VA
|
FREE_OP2(); |
FREE_OP2(); |
} |
} |
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
Line 736 ZEND_VM_HANDLER(135, ZEND_POST_DEC_OBJ, VAR|UNUSED|CV,
|
Line 792 ZEND_VM_HANDLER(135, ZEND_POST_DEC_OBJ, VAR|UNUSED|CV,
|
|
|
ZEND_VM_HANDLER(34, ZEND_PRE_INC, VAR|CV, ANY) |
ZEND_VM_HANDLER(34, ZEND_PRE_INC, VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval **var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW); | zval **var_ptr; |
|
|
if (OP1_TYPE == IS_VAR && !var_ptr) { | SAVE_OPLINE(); |
| var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW); |
| |
| if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == NULL)) { |
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); |
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); |
} |
} |
if (OP1_TYPE == IS_VAR && *var_ptr == EG(error_zval_ptr)) { | if (OP1_TYPE == IS_VAR && UNEXPECTED(*var_ptr == &EG(error_zval))) { |
if (!RETURN_VALUE_UNUSED(&opline->result)) { | if (RETURN_VALUE_USED(opline)) { |
AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); | PZVAL_LOCK(&EG(uninitialized_zval)); |
PZVAL_LOCK(EG(uninitialized_zval_ptr)); | AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); |
} |
} |
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
SEPARATE_ZVAL_IF_NOT_REF(var_ptr); |
SEPARATE_ZVAL_IF_NOT_REF(var_ptr); |
|
|
if(Z_TYPE_PP(var_ptr) == IS_OBJECT && Z_OBJ_HANDLER_PP(var_ptr, get) | if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT) |
| && Z_OBJ_HANDLER_PP(var_ptr, get) |
&& Z_OBJ_HANDLER_PP(var_ptr, set)) { |
&& Z_OBJ_HANDLER_PP(var_ptr, set)) { |
/* proxy object */ |
/* proxy object */ |
zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); |
zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); |
Z_ADDREF_P(val); |
Z_ADDREF_P(val); |
increment_function(val); | fast_increment_function(val); |
Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC); |
Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC); |
zval_ptr_dtor(&val); |
zval_ptr_dtor(&val); |
} else { |
} else { |
increment_function(*var_ptr); | fast_increment_function(*var_ptr); |
} |
} |
|
|
if (!RETURN_VALUE_UNUSED(&opline->result)) { | if (RETURN_VALUE_USED(opline)) { |
AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); | |
PZVAL_LOCK(*var_ptr); |
PZVAL_LOCK(*var_ptr); |
|
AI_SET_PTR(&EX_T(opline->result.var), *var_ptr); |
} |
} |
|
|
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(35, ZEND_PRE_DEC, VAR|CV, ANY) |
ZEND_VM_HANDLER(35, ZEND_PRE_DEC, VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval **var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW); | zval **var_ptr; |
|
|
if (OP1_TYPE == IS_VAR && !var_ptr) { | SAVE_OPLINE(); |
| var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW); |
| |
| if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == NULL)) { |
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); |
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); |
} |
} |
if (OP1_TYPE == IS_VAR && *var_ptr == EG(error_zval_ptr)) { | if (OP1_TYPE == IS_VAR && UNEXPECTED(*var_ptr == &EG(error_zval))) { |
if (!RETURN_VALUE_UNUSED(&opline->result)) { | if (RETURN_VALUE_USED(opline)) { |
AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); | PZVAL_LOCK(&EG(uninitialized_zval)); |
PZVAL_LOCK(EG(uninitialized_zval_ptr)); | AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); |
} |
} |
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
SEPARATE_ZVAL_IF_NOT_REF(var_ptr); |
SEPARATE_ZVAL_IF_NOT_REF(var_ptr); |
|
|
if(Z_TYPE_PP(var_ptr) == IS_OBJECT && Z_OBJ_HANDLER_PP(var_ptr, get) | if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT) |
| && Z_OBJ_HANDLER_PP(var_ptr, get) |
&& Z_OBJ_HANDLER_PP(var_ptr, set)) { |
&& Z_OBJ_HANDLER_PP(var_ptr, set)) { |
/* proxy object */ |
/* proxy object */ |
zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); |
zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); |
Z_ADDREF_P(val); |
Z_ADDREF_P(val); |
decrement_function(val); | fast_decrement_function(val); |
Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC); |
Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC); |
zval_ptr_dtor(&val); |
zval_ptr_dtor(&val); |
} else { |
} else { |
decrement_function(*var_ptr); | fast_decrement_function(*var_ptr); |
} |
} |
|
|
if (!RETURN_VALUE_UNUSED(&opline->result)) { | if (RETURN_VALUE_USED(opline)) { |
AI_SET_PTR(EX_T(opline->result.u.var).var, *var_ptr); | |
PZVAL_LOCK(*var_ptr); |
PZVAL_LOCK(*var_ptr); |
|
AI_SET_PTR(&EX_T(opline->result.var), *var_ptr); |
} |
} |
|
|
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(36, ZEND_POST_INC, VAR|CV, ANY) |
ZEND_VM_HANDLER(36, ZEND_POST_INC, VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval **var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW); | zval **var_ptr, *retval; |
|
|
if (OP1_TYPE == IS_VAR && !var_ptr) { | SAVE_OPLINE(); |
| var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW); |
| |
| if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == NULL)) { |
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); |
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); |
} |
} |
if (OP1_TYPE == IS_VAR && *var_ptr == EG(error_zval_ptr)) { | if (OP1_TYPE == IS_VAR && UNEXPECTED(*var_ptr == &EG(error_zval))) { |
if (!RETURN_VALUE_UNUSED(&opline->result)) { | ZVAL_NULL(&EX_T(opline->result.var).tmp_var); |
EX_T(opline->result.u.var).tmp_var = *EG(uninitialized_zval_ptr); | |
} | |
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
EX_T(opline->result.u.var).tmp_var = **var_ptr; | retval = &EX_T(opline->result.var).tmp_var; |
zendi_zval_copy_ctor(EX_T(opline->result.u.var).tmp_var); | ZVAL_COPY_VALUE(retval, *var_ptr); |
| zendi_zval_copy_ctor(*retval); |
|
|
SEPARATE_ZVAL_IF_NOT_REF(var_ptr); |
SEPARATE_ZVAL_IF_NOT_REF(var_ptr); |
|
|
if(Z_TYPE_PP(var_ptr) == IS_OBJECT && Z_OBJ_HANDLER_PP(var_ptr, get) | if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT) |
| && Z_OBJ_HANDLER_PP(var_ptr, get) |
&& Z_OBJ_HANDLER_PP(var_ptr, set)) { |
&& Z_OBJ_HANDLER_PP(var_ptr, set)) { |
/* proxy object */ |
/* proxy object */ |
zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); |
zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); |
Z_ADDREF_P(val); |
Z_ADDREF_P(val); |
increment_function(val); | fast_increment_function(val); |
Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC); |
Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC); |
zval_ptr_dtor(&val); |
zval_ptr_dtor(&val); |
} else { |
} else { |
increment_function(*var_ptr); | fast_increment_function(*var_ptr); |
} |
} |
|
|
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(37, ZEND_POST_DEC, VAR|CV, ANY) |
ZEND_VM_HANDLER(37, ZEND_POST_DEC, VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval **var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW); | zval **var_ptr, *retval; |
|
|
if (OP1_TYPE == IS_VAR && !var_ptr) { | SAVE_OPLINE(); |
| var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW); |
| |
| if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == NULL)) { |
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); |
zend_error_noreturn(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); |
} |
} |
if (OP1_TYPE == IS_VAR && *var_ptr == EG(error_zval_ptr)) { | if (OP1_TYPE == IS_VAR && UNEXPECTED(*var_ptr == &EG(error_zval))) { |
if (!RETURN_VALUE_UNUSED(&opline->result)) { | ZVAL_NULL(&EX_T(opline->result.var).tmp_var); |
EX_T(opline->result.u.var).tmp_var = *EG(uninitialized_zval_ptr); | |
} | |
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
EX_T(opline->result.u.var).tmp_var = **var_ptr; | retval = &EX_T(opline->result.var).tmp_var; |
zendi_zval_copy_ctor(EX_T(opline->result.u.var).tmp_var); | ZVAL_COPY_VALUE(retval, *var_ptr); |
| zendi_zval_copy_ctor(*retval); |
|
|
SEPARATE_ZVAL_IF_NOT_REF(var_ptr); |
SEPARATE_ZVAL_IF_NOT_REF(var_ptr); |
|
|
if(Z_TYPE_PP(var_ptr) == IS_OBJECT && Z_OBJ_HANDLER_PP(var_ptr, get) | if (UNEXPECTED(Z_TYPE_PP(var_ptr) == IS_OBJECT) |
| && Z_OBJ_HANDLER_PP(var_ptr, get) |
&& Z_OBJ_HANDLER_PP(var_ptr, set)) { |
&& Z_OBJ_HANDLER_PP(var_ptr, set)) { |
/* proxy object */ |
/* proxy object */ |
zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); |
zval *val = Z_OBJ_HANDLER_PP(var_ptr, get)(*var_ptr TSRMLS_CC); |
Z_ADDREF_P(val); |
Z_ADDREF_P(val); |
decrement_function(val); | fast_decrement_function(val); |
Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC); |
Z_OBJ_HANDLER_PP(var_ptr, set)(var_ptr, val TSRMLS_CC); |
zval_ptr_dtor(&val); |
zval_ptr_dtor(&val); |
} else { |
} else { |
decrement_function(*var_ptr); | fast_decrement_function(*var_ptr); |
} |
} |
|
|
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(40, ZEND_ECHO, CONST|TMP|VAR|CV, ANY) |
ZEND_VM_HANDLER(40, ZEND_ECHO, CONST|TMP|VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval z_copy; | zval *z; |
zval *z = GET_OP1_ZVAL_PTR(BP_VAR_R); | |
|
|
if (OP1_TYPE != IS_CONST && | SAVE_OPLINE(); |
Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get_method != NULL) { | z = GET_OP1_ZVAL_PTR(BP_VAR_R); |
if (OP1_TYPE == IS_TMP_VAR) { | |
INIT_PZVAL(z); | if (OP1_TYPE == IS_TMP_VAR && Z_TYPE_P(z) == IS_OBJECT) { |
} | INIT_PZVAL(z); |
if (zend_std_cast_object_tostring(z, &z_copy, IS_STRING TSRMLS_CC) == SUCCESS) { | |
zend_print_variable(&z_copy); | |
zval_dtor(&z_copy); | |
} else { | |
zend_print_variable(z); | |
} | |
} else { | |
zend_print_variable(z); | |
} |
} |
|
zend_print_variable(z); |
|
|
FREE_OP1(); |
FREE_OP1(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(41, ZEND_PRINT, CONST|TMP|VAR|CV, ANY) |
ZEND_VM_HANDLER(41, ZEND_PRINT, CONST|TMP|VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
|
|
Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 1; | ZVAL_LONG(&EX_T(opline->result.var).tmp_var, 1); |
Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_LONG; | |
| |
ZEND_VM_DISPATCH_TO_HANDLER(ZEND_ECHO); |
ZEND_VM_DISPATCH_TO_HANDLER(ZEND_ECHO); |
} |
} |
|
|
ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, ANY, int type) | ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMP|VAR|CV, UNUSED|CONST|VAR, int type) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval *varname = GET_OP1_ZVAL_PTR(BP_VAR_R); | zval *varname; |
zval **retval; |
zval **retval; |
zval tmp_varname; |
zval tmp_varname; |
HashTable *target_symbol_table; |
HashTable *target_symbol_table; |
|
ulong hash_value; |
|
|
if (OP1_TYPE != IS_CONST && Z_TYPE_P(varname) != IS_STRING) { | SAVE_OPLINE(); |
tmp_varname = *varname; | varname = GET_OP1_ZVAL_PTR(BP_VAR_R); |
| |
| if (OP1_TYPE != IS_CONST && UNEXPECTED(Z_TYPE_P(varname) != IS_STRING)) { |
| ZVAL_COPY_VALUE(&tmp_varname, varname); |
zval_copy_ctor(&tmp_varname); |
zval_copy_ctor(&tmp_varname); |
|
Z_SET_REFCOUNT(tmp_varname, 1); |
|
Z_UNSET_ISREF(tmp_varname); |
convert_to_string(&tmp_varname); |
convert_to_string(&tmp_varname); |
varname = &tmp_varname; |
varname = &tmp_varname; |
} |
} |
|
|
if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { | if (OP2_TYPE != IS_UNUSED) { |
retval = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0 TSRMLS_CC); | zend_class_entry *ce; |
| |
| if (OP2_TYPE == IS_CONST) { |
| if (CACHED_PTR(opline->op2.literal->cache_slot)) { |
| ce = CACHED_PTR(opline->op2.literal->cache_slot); |
| } else { |
| ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); |
| if (UNEXPECTED(ce == NULL)) { |
| if (OP1_TYPE != IS_CONST && varname == &tmp_varname) { |
| zval_dtor(&tmp_varname); |
| } |
| FREE_OP1(); |
| CHECK_EXCEPTION(); |
| ZEND_VM_NEXT_OPCODE(); |
| } |
| CACHE_PTR(opline->op2.literal->cache_slot, ce); |
| } |
| } else { |
| ce = EX_T(opline->op2.var).class_entry; |
| } |
| retval = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0, ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); |
FREE_OP1(); |
FREE_OP1(); |
} else { |
} else { |
target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), type, varname TSRMLS_CC); | target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); |
/* |
/* |
if (!target_symbol_table) { |
if (!target_symbol_table) { |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
*/ |
*/ |
if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &retval) == FAILURE) { | if (OP1_TYPE == IS_CONST) { |
| hash_value = Z_HASH_P(varname); |
| } else if (IS_INTERNED(Z_STRVAL_P(varname))) { |
| hash_value = INTERNED_HASH(Z_STRVAL_P(varname)); |
| } else { |
| hash_value = zend_hash_func(Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1); |
| } |
| |
| if (zend_hash_quick_find(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, (void **) &retval) == FAILURE) { |
switch (type) { |
switch (type) { |
case BP_VAR_R: |
case BP_VAR_R: |
case BP_VAR_UNSET: |
case BP_VAR_UNSET: |
Line 966 ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST
|
Line 1070 ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST
|
case BP_VAR_RW: |
case BP_VAR_RW: |
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname)); |
zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname)); |
/* break missing intentionally */ |
/* break missing intentionally */ |
case BP_VAR_W: { | case BP_VAR_W: |
zval *new_zval = &EG(uninitialized_zval); | Z_ADDREF_P(&EG(uninitialized_zval)); |
| zend_hash_quick_update(target_symbol_table, Z_STRVAL_P(varname), Z_STRLEN_P(varname)+1, hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **) &retval); |
Z_ADDREF_P(new_zval); | |
zend_hash_update(target_symbol_table, varname->value.str.val, varname->value.str.len+1, &new_zval, sizeof(zval *), (void **) &retval); | |
} | |
break; |
break; |
EMPTY_SWITCH_DEFAULT_CASE() |
EMPTY_SWITCH_DEFAULT_CASE() |
} |
} |
} |
} |
switch (opline->op2.u.EA.type) { | switch (opline->extended_value & ZEND_FETCH_TYPE_MASK) { |
case ZEND_FETCH_GLOBAL: |
case ZEND_FETCH_GLOBAL: |
if (OP1_TYPE != IS_TMP_VAR) { |
if (OP1_TYPE != IS_TMP_VAR) { |
FREE_OP1(); |
FREE_OP1(); |
Line 990 ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST
|
Line 1091 ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST
|
break; |
break; |
case ZEND_FETCH_GLOBAL_LOCK: |
case ZEND_FETCH_GLOBAL_LOCK: |
if (OP1_TYPE == IS_VAR && !free_op1.var) { |
if (OP1_TYPE == IS_VAR && !free_op1.var) { |
PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); | PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); |
} |
} |
break; |
break; |
} |
} |
Line 998 ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST
|
Line 1099 ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST
|
|
|
|
|
if (OP1_TYPE != IS_CONST && varname == &tmp_varname) { |
if (OP1_TYPE != IS_CONST && varname == &tmp_varname) { |
zval_dtor(varname); | zval_dtor(&tmp_varname); |
} |
} |
if (!RETURN_VALUE_UNUSED(&opline->result)) { | if (opline->extended_value & ZEND_FETCH_MAKE_REF) { |
if (opline->extended_value & ZEND_FETCH_MAKE_REF) { | SEPARATE_ZVAL_TO_MAKE_IS_REF(retval); |
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval); | } |
} | PZVAL_LOCK(*retval); |
PZVAL_LOCK(*retval); | switch (type) { |
switch (type) { | case BP_VAR_R: |
case BP_VAR_R: | case BP_VAR_IS: |
case BP_VAR_IS: | AI_SET_PTR(&EX_T(opline->result.var), *retval); |
AI_SET_PTR(EX_T(opline->result.u.var).var, *retval); | break; |
break; | case BP_VAR_UNSET: { |
case BP_VAR_UNSET: { | zend_free_op free_res; |
zend_free_op free_res; | |
|
|
EX_T(opline->result.u.var).var.ptr_ptr = retval; | PZVAL_UNLOCK(*retval, &free_res); |
PZVAL_UNLOCK(*EX_T(opline->result.u.var).var.ptr_ptr, &free_res); | if (retval != &EG(uninitialized_zval_ptr)) { |
if (EX_T(opline->result.u.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) { | SEPARATE_ZVAL_IF_NOT_REF(retval); |
SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.u.var).var.ptr_ptr); | |
} | |
PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); | |
FREE_OP_VAR_PTR(free_res); | |
break; | |
default: | |
EX_T(opline->result.u.var).var.ptr_ptr = retval; | |
break; | |
} |
} |
|
PZVAL_LOCK(*retval); |
|
FREE_OP_VAR_PTR(free_res); |
} |
} |
|
/* break missing intentionally */ |
|
default: |
|
EX_T(opline->result.var).var.ptr_ptr = retval; |
|
break; |
} |
} |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(80, ZEND_FETCH_R, CONST|TMP|VAR|CV, ANY) | ZEND_VM_HANDLER(80, ZEND_FETCH_R, CONST|TMP|VAR|CV, UNUSED|CONST|VAR) |
{ |
{ |
ZEND_VM_DISPATCH_TO_HELPER_EX(zend_fetch_var_address_helper, type, BP_VAR_R); |
ZEND_VM_DISPATCH_TO_HELPER_EX(zend_fetch_var_address_helper, type, BP_VAR_R); |
} |
} |
|
|
ZEND_VM_HANDLER(83, ZEND_FETCH_W, CONST|TMP|VAR|CV, ANY) | ZEND_VM_HANDLER(83, ZEND_FETCH_W, CONST|TMP|VAR|CV, UNUSED|CONST|VAR) |
{ |
{ |
ZEND_VM_DISPATCH_TO_HELPER_EX(zend_fetch_var_address_helper, type, BP_VAR_W); |
ZEND_VM_DISPATCH_TO_HELPER_EX(zend_fetch_var_address_helper, type, BP_VAR_W); |
} |
} |
|
|
ZEND_VM_HANDLER(86, ZEND_FETCH_RW, CONST|TMP|VAR|CV, ANY) | ZEND_VM_HANDLER(86, ZEND_FETCH_RW, CONST|TMP|VAR|CV, UNUSED|CONST|VAR) |
{ |
{ |
ZEND_VM_DISPATCH_TO_HELPER_EX(zend_fetch_var_address_helper, type, BP_VAR_RW); |
ZEND_VM_DISPATCH_TO_HELPER_EX(zend_fetch_var_address_helper, type, BP_VAR_RW); |
} |
} |
|
|
ZEND_VM_HANDLER(92, ZEND_FETCH_FUNC_ARG, CONST|TMP|VAR|CV, ANY) | ZEND_VM_HANDLER(92, ZEND_FETCH_FUNC_ARG, CONST|TMP|VAR|CV, UNUSED|CONST|VAR) |
{ |
{ |
|
USE_OPLINE |
|
|
ZEND_VM_DISPATCH_TO_HELPER_EX(zend_fetch_var_address_helper, type, |
ZEND_VM_DISPATCH_TO_HELPER_EX(zend_fetch_var_address_helper, type, |
ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), EX(opline)->extended_value)?BP_VAR_W:BP_VAR_R); | ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), (opline->extended_value & ZEND_FETCH_ARG_MASK))?BP_VAR_W:BP_VAR_R); |
} |
} |
|
|
ZEND_VM_HANDLER(95, ZEND_FETCH_UNSET, CONST|TMP|VAR|CV, ANY) | ZEND_VM_HANDLER(95, ZEND_FETCH_UNSET, CONST|TMP|VAR|CV, UNUSED|CONST|VAR) |
{ |
{ |
ZEND_VM_DISPATCH_TO_HELPER_EX(zend_fetch_var_address_helper, type, BP_VAR_UNSET); |
ZEND_VM_DISPATCH_TO_HELPER_EX(zend_fetch_var_address_helper, type, BP_VAR_UNSET); |
} |
} |
|
|
ZEND_VM_HANDLER(89, ZEND_FETCH_IS, CONST|TMP|VAR|CV, ANY) | ZEND_VM_HANDLER(89, ZEND_FETCH_IS, CONST|TMP|VAR|CV, UNUSED|CONST|VAR) |
{ |
{ |
ZEND_VM_DISPATCH_TO_HELPER_EX(zend_fetch_var_address_helper, type, BP_VAR_IS); |
ZEND_VM_DISPATCH_TO_HELPER_EX(zend_fetch_var_address_helper, type, BP_VAR_IS); |
} |
} |
|
|
ZEND_VM_HANDLER(81, ZEND_FETCH_DIM_R, VAR|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(81, ZEND_FETCH_DIM_R, VAR|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R); | zval *container; |
zval **container; | |
|
|
if (opline->extended_value == ZEND_FETCH_ADD_LOCK && | SAVE_OPLINE(); |
OP1_TYPE != IS_CV && | |
EX_T(opline->op1.u.var).var.ptr_ptr) { | if (OP1_TYPE == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { |
PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); | PZVAL_LOCK(EX_T(opline->op1.var).var.ptr); |
} |
} |
container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_R); | container = GET_OP1_ZVAL_PTR(BP_VAR_R); |
if (OP1_TYPE == IS_VAR && !container) { | zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC); |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); | |
} | |
zend_fetch_dimension_address_read(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, dim, IS_OP2_TMP_FREE(), BP_VAR_R TSRMLS_CC); | |
FREE_OP2(); |
FREE_OP2(); |
FREE_OP1_VAR_PTR(); | FREE_OP1(); |
| CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(84, ZEND_FETCH_DIM_W, VAR|CV, CONST|TMP|VAR|UNUSED|CV) |
ZEND_VM_HANDLER(84, ZEND_FETCH_DIM_W, VAR|CV, CONST|TMP|VAR|UNUSED|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R); | zval **container; |
zval **container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); | |
|
|
if (OP1_TYPE == IS_VAR && !container) { | SAVE_OPLINE(); |
| container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); |
| |
| if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) { |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); |
} |
} |
zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, IS_OP2_TMP_FREE(), BP_VAR_W TSRMLS_CC); | zend_fetch_dimension_address(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_W TSRMLS_CC); |
FREE_OP2(); |
FREE_OP2(); |
if (OP1_TYPE == IS_VAR && OP1_FREE && | if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) { |
READY_TO_DESTROY(free_op1.var)) { | EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); |
AI_USE_PTR(EX_T(opline->result.u.var).var); | |
if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && | |
Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { | |
SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); | |
} | |
} |
} |
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
|
|
/* We are going to assign the result by reference */ |
/* We are going to assign the result by reference */ |
if (opline->extended_value && EX_T(opline->result.u.var).var.ptr_ptr) { | if (UNEXPECTED(opline->extended_value != 0)) { |
Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); | zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr; |
SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); | |
Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); | if (retval_ptr) { |
| Z_DELREF_PP(retval_ptr); |
| SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr); |
| Z_ADDREF_PP(retval_ptr); |
| } |
} |
} |
|
|
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(87, ZEND_FETCH_DIM_RW, VAR|CV, CONST|TMP|VAR|UNUSED|CV) |
ZEND_VM_HANDLER(87, ZEND_FETCH_DIM_RW, VAR|CV, CONST|TMP|VAR|UNUSED|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R); | zval **container; |
zval **container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW); | |
|
|
if (OP1_TYPE == IS_VAR && !container) { | SAVE_OPLINE(); |
| container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW); |
| |
| if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) { |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); |
} |
} |
zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, IS_OP2_TMP_FREE(), BP_VAR_RW TSRMLS_CC); | zend_fetch_dimension_address(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_RW TSRMLS_CC); |
FREE_OP2(); |
FREE_OP2(); |
if (OP1_TYPE == IS_VAR && OP1_FREE && | if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) { |
READY_TO_DESTROY(free_op1.var)) { | EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); |
AI_USE_PTR(EX_T(opline->result.u.var).var); | |
if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && | |
Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { | |
SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); | |
} | |
} |
} |
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(90, ZEND_FETCH_DIM_IS, VAR|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(90, ZEND_FETCH_DIM_IS, VAR|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R); | zval *container; |
zval **container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_IS); | |
|
|
if (OP1_TYPE == IS_VAR && !container) { | SAVE_OPLINE(); |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); | container = GET_OP1_ZVAL_PTR(BP_VAR_IS); |
} | zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_IS TSRMLS_CC); |
zend_fetch_dimension_address_read(&EX_T(opline->result.u.var), container, dim, IS_OP2_TMP_FREE(), BP_VAR_IS TSRMLS_CC); | |
FREE_OP2(); |
FREE_OP2(); |
FREE_OP1_VAR_PTR(); | FREE_OP1(); |
| CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(93, ZEND_FETCH_DIM_FUNC_ARG, VAR|CV, CONST|TMP|VAR|UNUSED|CV) |
ZEND_VM_HANDLER(93, ZEND_FETCH_DIM_FUNC_ARG, VAR|CV, CONST|TMP|VAR|UNUSED|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R); |
|
zval **container; |
|
|
|
if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)) { | SAVE_OPLINE(); |
container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); | |
if (OP1_TYPE == IS_VAR && !container) { | if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), (opline->extended_value & ZEND_FETCH_ARG_MASK))) { |
| zval **container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); |
| |
| if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) { |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); |
} |
} |
zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, IS_OP2_TMP_FREE(), BP_VAR_W TSRMLS_CC); | zend_fetch_dimension_address(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_W TSRMLS_CC); |
if (OP1_TYPE == IS_VAR && OP1_FREE && | if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) { |
READY_TO_DESTROY(free_op1.var)) { | EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); |
AI_USE_PTR(EX_T(opline->result.u.var).var); | |
if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && | |
Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { | |
SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); | |
} | |
} |
} |
|
FREE_OP2(); |
|
FREE_OP1_VAR_PTR(); |
} else { |
} else { |
|
zval *container; |
|
|
if (OP2_TYPE == IS_UNUSED) { |
if (OP2_TYPE == IS_UNUSED) { |
zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); |
zend_error_noreturn(E_ERROR, "Cannot use [] for reading"); |
} |
} |
container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_R); | container = GET_OP1_ZVAL_PTR(BP_VAR_R); |
if (OP1_TYPE == IS_VAR && !container) { | zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC); |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); | FREE_OP2(); |
} | FREE_OP1(); |
zend_fetch_dimension_address_read(&EX_T(opline->result.u.var), container, dim, IS_OP2_TMP_FREE(), BP_VAR_R TSRMLS_CC); | |
} |
} |
FREE_OP2(); | CHECK_EXCEPTION(); |
FREE_OP1_VAR_PTR(); | |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(96, ZEND_FETCH_DIM_UNSET, VAR|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(96, ZEND_FETCH_DIM_UNSET, VAR|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
zval **container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_UNSET); | zval **container; |
zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R); | |
|
|
/* Not needed in DIM_UNSET | SAVE_OPLINE(); |
if (opline->extended_value == ZEND_FETCH_ADD_LOCK) { | container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_UNSET); |
PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); | |
} | |
*/ | |
if (OP1_TYPE == IS_CV) { |
if (OP1_TYPE == IS_CV) { |
if (container != &EG(uninitialized_zval_ptr)) { |
if (container != &EG(uninitialized_zval_ptr)) { |
SEPARATE_ZVAL_IF_NOT_REF(container); |
SEPARATE_ZVAL_IF_NOT_REF(container); |
} |
} |
} |
} |
if (OP1_TYPE == IS_VAR && !container) { | if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) { |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); |
} |
} |
zend_fetch_dimension_address(&EX_T(opline->result.u.var), container, dim, IS_OP2_TMP_FREE(), BP_VAR_UNSET TSRMLS_CC); | zend_fetch_dimension_address(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_UNSET TSRMLS_CC); |
FREE_OP2(); |
FREE_OP2(); |
if (OP1_TYPE == IS_VAR && OP1_FREE && | if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) { |
READY_TO_DESTROY(free_op1.var)) { | EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); |
AI_USE_PTR(EX_T(opline->result.u.var).var); | |
if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && | |
Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { | |
SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); | |
} | |
} |
} |
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
if (EX_T(opline->result.u.var).var.ptr_ptr == NULL) { | if (UNEXPECTED(EX_T(opline->result.var).var.ptr_ptr == NULL)) { |
zend_error_noreturn(E_ERROR, "Cannot unset string offsets"); |
zend_error_noreturn(E_ERROR, "Cannot unset string offsets"); |
} else { |
} else { |
zend_free_op free_res; |
zend_free_op free_res; |
|
zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr; |
|
|
PZVAL_UNLOCK(*EX_T(opline->result.u.var).var.ptr_ptr, &free_res); | PZVAL_UNLOCK(*retval_ptr, &free_res); |
if (EX_T(opline->result.u.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) { | if (retval_ptr != &EG(uninitialized_zval_ptr)) { |
SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.u.var).var.ptr_ptr); | SEPARATE_ZVAL_IF_NOT_REF(retval_ptr); |
} |
} |
PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); | PZVAL_LOCK(*retval_ptr); |
FREE_OP_VAR_PTR(free_res); |
FREE_OP_VAR_PTR(free_res); |
|
CHECK_EXCEPTION(); |
|
ZEND_VM_NEXT_OPCODE(); |
} |
} |
ZEND_VM_NEXT_OPCODE(); |
|
} |
} |
|
|
ZEND_VM_HELPER_EX(zend_fetch_property_address_read_helper, VAR|UNUSED|CV, CONST|TMP|VAR|CV, int type) | ZEND_VM_HELPER(zend_fetch_property_address_read_helper, VAR|UNUSED|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval *container = GET_OP1_OBJ_ZVAL_PTR(type); | zval *container; |
zend_free_op free_op2; |
zend_free_op free_op2; |
zval *offset = GET_OP2_ZVAL_PTR(BP_VAR_R); | zval *offset; |
|
|
if (Z_TYPE_P(container) != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) { | SAVE_OPLINE(); |
if (type != BP_VAR_IS) { | container = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_R); |
zend_error(E_NOTICE, "Trying to get property of non-object"); | offset = GET_OP2_ZVAL_PTR(BP_VAR_R); |
} | |
if (!RETURN_VALUE_UNUSED(&opline->result)) { | if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) || |
AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); | UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) { |
PZVAL_LOCK(EG(uninitialized_zval_ptr)); | zend_error(E_NOTICE, "Trying to get property of non-object"); |
} | PZVAL_LOCK(&EG(uninitialized_zval)); |
| AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); |
FREE_OP2(); |
FREE_OP2(); |
} else { |
} else { |
zval *retval; |
zval *retval; |
Line 1262 ZEND_VM_HELPER_EX(zend_fetch_property_address_read_hel
|
Line 1352 ZEND_VM_HELPER_EX(zend_fetch_property_address_read_hel
|
} |
} |
|
|
/* here we are sure we are dealing with an object */ |
/* here we are sure we are dealing with an object */ |
retval = Z_OBJ_HT_P(container)->read_property(container, offset, type TSRMLS_CC); | retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); |
|
|
if (RETURN_VALUE_UNUSED(&opline->result)) { | PZVAL_LOCK(retval); |
if (Z_REFCOUNT_P(retval) == 0) { | AI_SET_PTR(&EX_T(opline->result.var), retval); |
GC_REMOVE_ZVAL_FROM_BUFFER(retval); | |
zval_dtor(retval); | |
FREE_ZVAL(retval); | |
} | |
} else { | |
AI_SET_PTR(EX_T(opline->result.u.var).var, retval); | |
PZVAL_LOCK(retval); | |
} | |
|
|
if (IS_OP2_TMP_FREE()) { |
if (IS_OP2_TMP_FREE()) { |
zval_ptr_dtor(&offset); |
zval_ptr_dtor(&offset); |
Line 1283 ZEND_VM_HELPER_EX(zend_fetch_property_address_read_hel
|
Line 1365 ZEND_VM_HELPER_EX(zend_fetch_property_address_read_hel
|
} |
} |
|
|
FREE_OP1(); |
FREE_OP1(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(82, ZEND_FETCH_OBJ_R, VAR|UNUSED|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(82, ZEND_FETCH_OBJ_R, VAR|UNUSED|CV, CONST|TMP|VAR|CV) |
{ |
{ |
ZEND_VM_DISPATCH_TO_HELPER_EX(zend_fetch_property_address_read_helper, type, BP_VAR_R); | ZEND_VM_DISPATCH_TO_HELPER(zend_fetch_property_address_read_helper); |
} |
} |
|
|
ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
zval *property = GET_OP2_ZVAL_PTR(BP_VAR_R); | zval *property; |
zval **container; |
zval **container; |
|
|
|
SAVE_OPLINE(); |
|
property = GET_OP2_ZVAL_PTR(BP_VAR_R); |
|
|
if (OP1_TYPE == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { |
if (OP1_TYPE == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) { |
PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr); | PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr); |
EX_T(opline->op1.u.var).var.ptr = *EX_T(opline->op1.u.var).var.ptr_ptr; | EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr; |
} |
} |
|
|
if (IS_OP2_TMP_FREE()) { |
if (IS_OP2_TMP_FREE()) { |
MAKE_REAL_ZVAL_PTR(property); |
MAKE_REAL_ZVAL_PTR(property); |
} |
} |
container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_W); |
container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_W); |
if (OP1_TYPE == IS_VAR && !container) { | if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) { |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); |
} |
} |
zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); | |
| zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC); |
if (IS_OP2_TMP_FREE()) { |
if (IS_OP2_TMP_FREE()) { |
zval_ptr_dtor(&property); |
zval_ptr_dtor(&property); |
} else { |
} else { |
FREE_OP2(); |
FREE_OP2(); |
} |
} |
if (OP1_TYPE == IS_VAR && OP1_FREE && | if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) { |
READY_TO_DESTROY(free_op1.var)) { | EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); |
AI_USE_PTR(EX_T(opline->result.u.var).var); | |
if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && | |
Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { | |
SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); | |
} | |
} |
} |
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
|
|
/* We are going to assign the result by reference */ |
/* We are going to assign the result by reference */ |
if (opline->extended_value & ZEND_FETCH_MAKE_REF) { |
if (opline->extended_value & ZEND_FETCH_MAKE_REF) { |
Z_DELREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); | zval **retval_ptr = EX_T(opline->result.var).var.ptr_ptr; |
SEPARATE_ZVAL_TO_MAKE_IS_REF(EX_T(opline->result.u.var).var.ptr_ptr); | |
Z_ADDREF_PP(EX_T(opline->result.u.var).var.ptr_ptr); | Z_DELREF_PP(retval_ptr); |
| SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr); |
| Z_ADDREF_PP(retval_ptr); |
| EX_T(opline->result.var).var.ptr = *EX_T(opline->result.var).var.ptr_ptr; |
| EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr; |
} |
} |
| |
| CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(88, ZEND_FETCH_OBJ_RW, VAR|UNUSED|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(88, ZEND_FETCH_OBJ_RW, VAR|UNUSED|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
zval *property = GET_OP2_ZVAL_PTR(BP_VAR_R); | zval *property; |
zval **container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_RW); | zval **container; |
|
|
|
SAVE_OPLINE(); |
|
property = GET_OP2_ZVAL_PTR(BP_VAR_R); |
|
container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_RW); |
|
|
if (IS_OP2_TMP_FREE()) { |
if (IS_OP2_TMP_FREE()) { |
MAKE_REAL_ZVAL_PTR(property); |
MAKE_REAL_ZVAL_PTR(property); |
} |
} |
if (OP1_TYPE == IS_VAR && !container) { | if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) { |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); |
} |
} |
zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_RW TSRMLS_CC); | zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_RW TSRMLS_CC); |
if (IS_OP2_TMP_FREE()) { |
if (IS_OP2_TMP_FREE()) { |
zval_ptr_dtor(&property); |
zval_ptr_dtor(&property); |
} else { |
} else { |
FREE_OP2(); |
FREE_OP2(); |
} |
} |
if (OP1_TYPE == IS_VAR && OP1_FREE && | if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) { |
READY_TO_DESTROY(free_op1.var)) { | EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); |
AI_USE_PTR(EX_T(opline->result.u.var).var); | |
if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && | |
Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { | |
SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); | |
} | |
} |
} |
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(91, ZEND_FETCH_OBJ_IS, VAR|UNUSED|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(91, ZEND_FETCH_OBJ_IS, VAR|UNUSED|CV, CONST|TMP|VAR|CV) |
{ |
{ |
ZEND_VM_DISPATCH_TO_HELPER_EX(zend_fetch_property_address_read_helper, type, BP_VAR_IS); | USE_OPLINE |
| zend_free_op free_op1; |
| zval *container; |
| zend_free_op free_op2; |
| zval *offset; |
| |
| SAVE_OPLINE(); |
| container = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_IS); |
| offset = GET_OP2_ZVAL_PTR(BP_VAR_R); |
| |
| if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) || |
| UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) { |
| PZVAL_LOCK(&EG(uninitialized_zval)); |
| AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); |
| FREE_OP2(); |
| } else { |
| zval *retval; |
| |
| if (IS_OP2_TMP_FREE()) { |
| MAKE_REAL_ZVAL_PTR(offset); |
| } |
| |
| /* here we are sure we are dealing with an object */ |
| retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); |
| |
| PZVAL_LOCK(retval); |
| AI_SET_PTR(&EX_T(opline->result.var), retval); |
| |
| if (IS_OP2_TMP_FREE()) { |
| zval_ptr_dtor(&offset); |
| } else { |
| FREE_OP2(); |
| } |
| } |
| |
| FREE_OP1(); |
| CHECK_EXCEPTION(); |
| ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(94, ZEND_FETCH_OBJ_FUNC_ARG, VAR|UNUSED|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(94, ZEND_FETCH_OBJ_FUNC_ARG, VAR|UNUSED|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
|
|
if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->extended_value)) { | if (ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), (opline->extended_value & ZEND_FETCH_ARG_MASK))) { |
/* Behave like FETCH_OBJ_W */ |
/* Behave like FETCH_OBJ_W */ |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
zval *property = GET_OP2_ZVAL_PTR(BP_VAR_R); | zval *property; |
zval **container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_W); | zval **container; |
|
|
|
SAVE_OPLINE(); |
|
property = GET_OP2_ZVAL_PTR(BP_VAR_R); |
|
container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_W); |
|
|
if (IS_OP2_TMP_FREE()) { |
if (IS_OP2_TMP_FREE()) { |
MAKE_REAL_ZVAL_PTR(property); |
MAKE_REAL_ZVAL_PTR(property); |
} |
} |
if (OP1_TYPE == IS_VAR && !container) { | if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) { |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); |
} |
} |
zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_W TSRMLS_CC); | zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_W TSRMLS_CC); |
if (IS_OP2_TMP_FREE()) { |
if (IS_OP2_TMP_FREE()) { |
zval_ptr_dtor(&property); |
zval_ptr_dtor(&property); |
} else { |
} else { |
FREE_OP2(); |
FREE_OP2(); |
} |
} |
if (OP1_TYPE == IS_VAR && OP1_FREE && | if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) { |
READY_TO_DESTROY(free_op1.var)) { | EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); |
AI_USE_PTR(EX_T(opline->result.u.var).var); | |
if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && | |
Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { | |
SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); | |
} | |
} |
} |
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} else { |
} else { |
ZEND_VM_DISPATCH_TO_HELPER_EX(zend_fetch_property_address_read_helper, type, BP_VAR_R); | ZEND_VM_DISPATCH_TO_HELPER(zend_fetch_property_address_read_helper); |
} |
} |
} |
} |
|
|
ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2, free_res; |
zend_free_op free_op1, free_op2, free_res; |
zval **container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_R); | zval **container; |
zval *property = GET_OP2_ZVAL_PTR(BP_VAR_R); | zval *property; |
|
|
|
SAVE_OPLINE(); |
|
container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_UNSET); |
|
property = GET_OP2_ZVAL_PTR(BP_VAR_R); |
|
|
if (OP1_TYPE == IS_CV) { |
if (OP1_TYPE == IS_CV) { |
if (container != &EG(uninitialized_zval_ptr)) { |
if (container != &EG(uninitialized_zval_ptr)) { |
SEPARATE_ZVAL_IF_NOT_REF(container); |
SEPARATE_ZVAL_IF_NOT_REF(container); |
Line 1424 ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|C
|
Line 1552 ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|C
|
if (IS_OP2_TMP_FREE()) { |
if (IS_OP2_TMP_FREE()) { |
MAKE_REAL_ZVAL_PTR(property); |
MAKE_REAL_ZVAL_PTR(property); |
} |
} |
if (OP1_TYPE == IS_VAR && !container) { | if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) { |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); |
} |
} |
zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC); | zend_fetch_property_address(&EX_T(opline->result.var), container, property, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL), BP_VAR_UNSET TSRMLS_CC); |
if (IS_OP2_TMP_FREE()) { |
if (IS_OP2_TMP_FREE()) { |
zval_ptr_dtor(&property); |
zval_ptr_dtor(&property); |
} else { |
} else { |
FREE_OP2(); |
FREE_OP2(); |
} |
} |
if (OP1_TYPE == IS_VAR && OP1_FREE && | if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) { |
READY_TO_DESTROY(free_op1.var)) { | EXTRACT_ZVAL_PTR(&EX_T(opline->result.var)); |
AI_USE_PTR(EX_T(opline->result.u.var).var); | |
if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && | |
Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { | |
SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); | |
} | |
} |
} |
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
|
|
PZVAL_UNLOCK(*EX_T(opline->result.u.var).var.ptr_ptr, &free_res); | PZVAL_UNLOCK(*EX_T(opline->result.var).var.ptr_ptr, &free_res); |
if (EX_T(opline->result.u.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) { | if (EX_T(opline->result.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) { |
SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.u.var).var.ptr_ptr); | SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.var).var.ptr_ptr); |
} |
} |
PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr); | PZVAL_LOCK(*EX_T(opline->result.var).var.ptr_ptr); |
FREE_OP_VAR_PTR(free_res); |
FREE_OP_VAR_PTR(free_res); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(98, ZEND_FETCH_DIM_TMP_VAR, CONST|TMP, CONST) |
ZEND_VM_HANDLER(98, ZEND_FETCH_DIM_TMP_VAR, CONST|TMP, CONST) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval *container = GET_OP1_ZVAL_PTR(BP_VAR_R); | zval *container; |
|
|
if (Z_TYPE_P(container) != IS_ARRAY) { | SAVE_OPLINE(); |
if (!RETURN_VALUE_UNUSED(&opline->result)) { | container = GET_OP1_ZVAL_PTR(BP_VAR_R); |
AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); | |
PZVAL_LOCK(EG(uninitialized_zval_ptr)); | if (UNEXPECTED(Z_TYPE_P(container) != IS_ARRAY)) { |
} | PZVAL_LOCK(&EG(uninitialized_zval)); |
| AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); |
} else { |
} else { |
zend_free_op free_op2; |
zend_free_op free_op2; |
zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R); | zval *value = *zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC); |
|
|
AI_SET_PTR(EX_T(opline->result.u.var).var, *zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, BP_VAR_R TSRMLS_CC)); | PZVAL_LOCK(value); |
SELECTIVE_PZVAL_LOCK(EX_T(opline->result.u.var).var.ptr, &opline->result); | AI_SET_PTR(&EX_T(opline->result.var), value); |
FREE_OP2(); |
FREE_OP2(); |
} |
} |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(136, ZEND_ASSIGN_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(136, ZEND_ASSIGN_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_op *op_data = opline+1; | |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
zval **object_ptr = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_W); | zval **object_ptr; |
zval *property_name = GET_OP2_ZVAL_PTR(BP_VAR_R); | zval *property_name; |
|
|
|
SAVE_OPLINE(); |
|
object_ptr = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_W); |
|
property_name = GET_OP2_ZVAL_PTR(BP_VAR_R); |
|
|
if (IS_OP2_TMP_FREE()) { |
if (IS_OP2_TMP_FREE()) { |
MAKE_REAL_ZVAL_PTR(property_name); |
MAKE_REAL_ZVAL_PTR(property_name); |
} |
} |
if (OP1_TYPE == IS_VAR && !object_ptr) { | if (OP1_TYPE == IS_VAR && UNEXPECTED(object_ptr == NULL)) { |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); |
} |
} |
zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_OBJ TSRMLS_CC); | zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, EX_Ts(), ZEND_ASSIGN_OBJ, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); |
if (IS_OP2_TMP_FREE()) { |
if (IS_OP2_TMP_FREE()) { |
zval_ptr_dtor(&property_name); |
zval_ptr_dtor(&property_name); |
} else { |
} else { |
Line 1496 ZEND_VM_HANDLER(136, ZEND_ASSIGN_OBJ, VAR|UNUSED|CV, C
|
Line 1625 ZEND_VM_HANDLER(136, ZEND_ASSIGN_OBJ, VAR|UNUSED|CV, C
|
} |
} |
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
/* assign_obj has two opcodes! */ |
/* assign_obj has two opcodes! */ |
|
CHECK_EXCEPTION(); |
ZEND_VM_INC_OPCODE(); |
ZEND_VM_INC_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(147, ZEND_ASSIGN_DIM, VAR|CV, CONST|TMP|VAR|UNUSED|CV) |
ZEND_VM_HANDLER(147, ZEND_ASSIGN_DIM, VAR|CV, CONST|TMP|VAR|UNUSED|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_op *op_data = opline+1; | |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval **object_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); | zval **object_ptr; |
|
|
if (OP1_TYPE == IS_VAR && !object_ptr) { | SAVE_OPLINE(); |
| object_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); |
| |
| if (OP1_TYPE == IS_VAR && UNEXPECTED(object_ptr == NULL)) { |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); |
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); |
} |
} |
if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { |
if (Z_TYPE_PP(object_ptr) == IS_OBJECT) { |
Line 1517 ZEND_VM_HANDLER(147, ZEND_ASSIGN_DIM, VAR|CV, CONST|TM
|
Line 1649 ZEND_VM_HANDLER(147, ZEND_ASSIGN_DIM, VAR|CV, CONST|TM
|
if (IS_OP2_TMP_FREE()) { |
if (IS_OP2_TMP_FREE()) { |
MAKE_REAL_ZVAL_PTR(property_name); |
MAKE_REAL_ZVAL_PTR(property_name); |
} |
} |
zend_assign_to_object(&opline->result, object_ptr, property_name, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC); | zend_assign_to_object(RETURN_VALUE_USED(opline)?&EX_T(opline->result.var).var.ptr:NULL, object_ptr, property_name, (opline+1)->op1_type, &(opline+1)->op1, EX_Ts(), ZEND_ASSIGN_DIM, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); |
if (IS_OP2_TMP_FREE()) { |
if (IS_OP2_TMP_FREE()) { |
zval_ptr_dtor(&property_name); |
zval_ptr_dtor(&property_name); |
} else { |
} else { |
Line 1529 ZEND_VM_HANDLER(147, ZEND_ASSIGN_DIM, VAR|CV, CONST|TM
|
Line 1661 ZEND_VM_HANDLER(147, ZEND_ASSIGN_DIM, VAR|CV, CONST|TM
|
zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R); |
zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R); |
zval **variable_ptr_ptr; |
zval **variable_ptr_ptr; |
|
|
zend_fetch_dimension_address(&EX_T(op_data->op2.u.var), object_ptr, dim, IS_OP2_TMP_FREE(), BP_VAR_W TSRMLS_CC); | zend_fetch_dimension_address(&EX_T((opline+1)->op2.var), object_ptr, dim, OP2_TYPE, BP_VAR_W TSRMLS_CC); |
FREE_OP2(); |
FREE_OP2(); |
|
|
value = get_zval_ptr(&op_data->op1, EX(Ts), &free_op_data1, BP_VAR_R); | value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, EX_Ts(), &free_op_data1, BP_VAR_R); |
variable_ptr_ptr = _get_zval_ptr_ptr_var(&op_data->op2, EX(Ts), &free_op_data2 TSRMLS_CC); | variable_ptr_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, EX_Ts(), &free_op_data2 TSRMLS_CC); |
if (!variable_ptr_ptr) { | if (UNEXPECTED(variable_ptr_ptr == NULL)) { |
if (zend_assign_to_string_offset(&EX_T(op_data->op2.u.var), value, op_data->op1.op_type TSRMLS_CC)) { | if (zend_assign_to_string_offset(&EX_T((opline+1)->op2.var), value, (opline+1)->op1_type TSRMLS_CC)) { |
if (!RETURN_VALUE_UNUSED(&opline->result)) { | if (RETURN_VALUE_USED(opline)) { |
EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; | zval *retval; |
ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); | |
INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); | ALLOC_ZVAL(retval); |
ZVAL_STRINGL(EX_T(opline->result.u.var).var.ptr, Z_STRVAL_P(EX_T(op_data->op2.u.var).str_offset.str)+EX_T(op_data->op2.u.var).str_offset.offset, 1, 1); | ZVAL_STRINGL(retval, Z_STRVAL_P(EX_T((opline+1)->op2.var).str_offset.str)+EX_T((opline+1)->op2.var).str_offset.offset, 1, 1); |
| INIT_PZVAL(retval); |
| AI_SET_PTR(&EX_T(opline->result.var), retval); |
} |
} |
} else if (!RETURN_VALUE_UNUSED(&opline->result)) { | } else if (RETURN_VALUE_USED(opline)) { |
AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); | PZVAL_LOCK(&EG(uninitialized_zval)); |
PZVAL_LOCK(EG(uninitialized_zval_ptr)); | AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); |
} |
} |
|
} else if (UNEXPECTED(*variable_ptr_ptr == &EG(error_zval))) { |
|
if (IS_TMP_FREE(free_op_data1)) { |
|
zval_dtor(value); |
|
} |
|
if (RETURN_VALUE_USED(opline)) { |
|
PZVAL_LOCK(&EG(uninitialized_zval)); |
|
AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); |
|
} |
} else { |
} else { |
value = zend_assign_to_variable(variable_ptr_ptr, value, IS_TMP_FREE(free_op_data1) TSRMLS_CC); | if ((opline+1)->op1_type == IS_TMP_VAR) { |
if (!RETURN_VALUE_UNUSED(&opline->result)) { | value = zend_assign_tmp_to_variable(variable_ptr_ptr, value TSRMLS_CC); |
AI_SET_PTR(EX_T(opline->result.u.var).var, value); | } else if ((opline+1)->op1_type == IS_CONST) { |
| value = zend_assign_const_to_variable(variable_ptr_ptr, value TSRMLS_CC); |
| } else { |
| value = zend_assign_to_variable(variable_ptr_ptr, value TSRMLS_CC); |
| } |
| if (RETURN_VALUE_USED(opline)) { |
PZVAL_LOCK(value); |
PZVAL_LOCK(value); |
|
AI_SET_PTR(&EX_T(opline->result.var), value); |
} |
} |
} |
} |
FREE_OP_VAR_PTR(free_op_data2); |
FREE_OP_VAR_PTR(free_op_data2); |
Line 1558 ZEND_VM_HANDLER(147, ZEND_ASSIGN_DIM, VAR|CV, CONST|TM
|
Line 1706 ZEND_VM_HANDLER(147, ZEND_ASSIGN_DIM, VAR|CV, CONST|TM
|
} |
} |
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
/* assign_dim has two opcodes! */ |
/* assign_dim has two opcodes! */ |
|
CHECK_EXCEPTION(); |
ZEND_VM_INC_OPCODE(); |
ZEND_VM_INC_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(38, ZEND_ASSIGN, VAR|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(38, ZEND_ASSIGN, VAR|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
zval *value = GET_OP2_ZVAL_PTR(BP_VAR_R); | zval *value; |
zval **variable_ptr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); | zval **variable_ptr_ptr; |
|
|
if (OP1_TYPE == IS_VAR && !variable_ptr_ptr) { | SAVE_OPLINE(); |
if (zend_assign_to_string_offset(&EX_T(opline->op1.u.var), value, OP2_TYPE TSRMLS_CC)) { | value = GET_OP2_ZVAL_PTR(BP_VAR_R); |
if (!RETURN_VALUE_UNUSED(&opline->result)) { | variable_ptr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); |
EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; | |
ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); | if (OP1_TYPE == IS_VAR && UNEXPECTED(variable_ptr_ptr == NULL)) { |
INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); | if (zend_assign_to_string_offset(&EX_T(opline->op1.var), value, OP2_TYPE TSRMLS_CC)) { |
ZVAL_STRINGL(EX_T(opline->result.u.var).var.ptr, Z_STRVAL_P(EX_T(opline->op1.u.var).str_offset.str)+EX_T(opline->op1.u.var).str_offset.offset, 1, 1); | if (RETURN_VALUE_USED(opline)) { |
| zval *retval; |
| |
| ALLOC_ZVAL(retval); |
| ZVAL_STRINGL(retval, Z_STRVAL_P(EX_T(opline->op1.var).str_offset.str)+EX_T(opline->op1.var).str_offset.offset, 1, 1); |
| INIT_PZVAL(retval); |
| AI_SET_PTR(&EX_T(opline->result.var), retval); |
} |
} |
} else if (!RETURN_VALUE_UNUSED(&opline->result)) { | } else if (RETURN_VALUE_USED(opline)) { |
AI_SET_PTR(EX_T(opline->result.u.var).var, EG(uninitialized_zval_ptr)); | PZVAL_LOCK(&EG(uninitialized_zval)); |
PZVAL_LOCK(EG(uninitialized_zval_ptr)); | AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); |
} |
} |
|
} else if (OP1_TYPE == IS_VAR && UNEXPECTED(*variable_ptr_ptr == &EG(error_zval))) { |
|
if (IS_OP2_TMP_FREE()) { |
|
zval_dtor(value); |
|
} |
|
if (RETURN_VALUE_USED(opline)) { |
|
PZVAL_LOCK(&EG(uninitialized_zval)); |
|
AI_SET_PTR(&EX_T(opline->result.var), &EG(uninitialized_zval)); |
|
} |
} else { |
} else { |
value = zend_assign_to_variable(variable_ptr_ptr, value, IS_OP2_TMP_FREE() TSRMLS_CC); | if (OP2_TYPE == IS_TMP_VAR) { |
if (!RETURN_VALUE_UNUSED(&opline->result)) { | value = zend_assign_tmp_to_variable(variable_ptr_ptr, value TSRMLS_CC); |
AI_SET_PTR(EX_T(opline->result.u.var).var, value); | } else if (OP2_TYPE == IS_CONST) { |
| value = zend_assign_const_to_variable(variable_ptr_ptr, value TSRMLS_CC); |
| } else { |
| value = zend_assign_to_variable(variable_ptr_ptr, value TSRMLS_CC); |
| } |
| if (RETURN_VALUE_USED(opline)) { |
PZVAL_LOCK(value); |
PZVAL_LOCK(value); |
|
AI_SET_PTR(&EX_T(opline->result.var), value); |
} |
} |
} |
} |
|
|
Line 1594 ZEND_VM_HANDLER(38, ZEND_ASSIGN, VAR|CV, CONST|TMP|VAR
|
Line 1763 ZEND_VM_HANDLER(38, ZEND_ASSIGN, VAR|CV, CONST|TMP|VAR
|
/* zend_assign_to_variable() always takes care of op2, never free it! */ |
/* zend_assign_to_variable() always takes care of op2, never free it! */ |
FREE_OP2_IF_VAR(); |
FREE_OP2_IF_VAR(); |
|
|
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(39, ZEND_ASSIGN_REF, VAR|CV, VAR|CV) |
ZEND_VM_HANDLER(39, ZEND_ASSIGN_REF, VAR|CV, VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
zval **variable_ptr_ptr; |
zval **variable_ptr_ptr; |
zval **value_ptr_ptr = GET_OP2_ZVAL_PTR_PTR(BP_VAR_W); | zval **value_ptr_ptr; |
|
|
|
SAVE_OPLINE(); |
|
value_ptr_ptr = GET_OP2_ZVAL_PTR_PTR(BP_VAR_W); |
|
|
if (OP2_TYPE == IS_VAR && |
if (OP2_TYPE == IS_VAR && |
value_ptr_ptr && |
value_ptr_ptr && |
!Z_ISREF_PP(value_ptr_ptr) && |
!Z_ISREF_PP(value_ptr_ptr) && |
opline->extended_value == ZEND_RETURNS_FUNCTION && |
opline->extended_value == ZEND_RETURNS_FUNCTION && |
!EX_T(opline->op2.u.var).var.fcall_returned_reference) { | !EX_T(opline->op2.var).var.fcall_returned_reference) { |
if (free_op2.var == NULL) { |
if (free_op2.var == NULL) { |
PZVAL_LOCK(*value_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ |
PZVAL_LOCK(*value_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ |
} |
} |
zend_error(E_STRICT, "Only variables should be assigned by reference"); |
zend_error(E_STRICT, "Only variables should be assigned by reference"); |
if (UNEXPECTED(EG(exception) != NULL)) { |
if (UNEXPECTED(EG(exception) != NULL)) { |
FREE_OP2_VAR_PTR(); |
FREE_OP2_VAR_PTR(); |
ZEND_VM_NEXT_OPCODE(); | HANDLE_EXCEPTION(); |
} |
} |
ZEND_VM_DISPATCH_TO_HANDLER(ZEND_ASSIGN); |
ZEND_VM_DISPATCH_TO_HANDLER(ZEND_ASSIGN); |
} else if (OP2_TYPE == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) { |
} else if (OP2_TYPE == IS_VAR && opline->extended_value == ZEND_RETURNS_NEW) { |
PZVAL_LOCK(*value_ptr_ptr); |
PZVAL_LOCK(*value_ptr_ptr); |
} |
} |
if (OP1_TYPE == IS_VAR && EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr) { | if (OP1_TYPE == IS_VAR && UNEXPECTED(EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr)) { |
zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object"); |
zend_error_noreturn(E_ERROR, "Cannot assign by reference to overloaded object"); |
} |
} |
|
|
variable_ptr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); |
variable_ptr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); |
if ((OP2_TYPE == IS_VAR && !value_ptr_ptr) || | if ((OP2_TYPE == IS_VAR && UNEXPECTED(value_ptr_ptr == NULL)) || |
(OP1_TYPE == IS_VAR && !variable_ptr_ptr)) { | (OP1_TYPE == IS_VAR && UNEXPECTED(variable_ptr_ptr == NULL))) { |
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets nor overloaded objects"); |
zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets nor overloaded objects"); |
} |
} |
zend_assign_to_variable_reference(variable_ptr_ptr, value_ptr_ptr TSRMLS_CC); |
zend_assign_to_variable_reference(variable_ptr_ptr, value_ptr_ptr TSRMLS_CC); |
Line 1636 ZEND_VM_HANDLER(39, ZEND_ASSIGN_REF, VAR|CV, VAR|CV)
|
Line 1809 ZEND_VM_HANDLER(39, ZEND_ASSIGN_REF, VAR|CV, VAR|CV)
|
Z_DELREF_PP(variable_ptr_ptr); |
Z_DELREF_PP(variable_ptr_ptr); |
} |
} |
|
|
if (!RETURN_VALUE_UNUSED(&opline->result)) { | if (RETURN_VALUE_USED(opline)) { |
AI_SET_PTR(EX_T(opline->result.u.var).var, *variable_ptr_ptr); | |
PZVAL_LOCK(*variable_ptr_ptr); |
PZVAL_LOCK(*variable_ptr_ptr); |
|
AI_SET_PTR(&EX_T(opline->result.var), *variable_ptr_ptr); |
} |
} |
|
|
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
FREE_OP2_VAR_PTR(); |
FREE_OP2_VAR_PTR(); |
|
|
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(42, ZEND_JMP, ANY, ANY) |
ZEND_VM_HANDLER(42, ZEND_JMP, ANY, ANY) |
{ |
{ |
|
USE_OPLINE |
|
|
#if DEBUG_ZEND>=2 |
#if DEBUG_ZEND>=2 |
printf("Jumping to %d\n", EX(opline)->op1.u.opline_num); | printf("Jumping to %d\n", opline->op1.opline_num); |
#endif |
#endif |
ZEND_VM_SET_OPCODE(EX(opline)->op1.u.jmp_addr); | ZEND_VM_SET_OPCODE(opline->op1.jmp_addr); |
ZEND_VM_CONTINUE(); /* CHECK_ME */ |
ZEND_VM_CONTINUE(); /* CHECK_ME */ |
} |
} |
|
|
ZEND_VM_HANDLER(43, ZEND_JMPZ, CONST|TMP|VAR|CV, ANY) |
ZEND_VM_HANDLER(43, ZEND_JMPZ, CONST|TMP|VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval *val = GET_OP1_ZVAL_PTR(BP_VAR_R); | zval *val; |
int ret; |
int ret; |
|
|
if (OP1_TYPE == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { | SAVE_OPLINE(); |
| val = GET_OP1_ZVAL_PTR(BP_VAR_R); |
| |
| if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) == IS_BOOL)) { |
ret = Z_LVAL_P(val); |
ret = Z_LVAL_P(val); |
} else { |
} else { |
ret = i_zend_is_true(val); |
ret = i_zend_is_true(val); |
FREE_OP1(); |
FREE_OP1(); |
if (UNEXPECTED(EG(exception) != NULL)) { |
if (UNEXPECTED(EG(exception) != NULL)) { |
ZEND_VM_CONTINUE(); | HANDLE_EXCEPTION(); |
} |
} |
} |
} |
if (!ret) { |
if (!ret) { |
#if DEBUG_ZEND>=2 |
#if DEBUG_ZEND>=2 |
printf("Conditional jmp to %d\n", opline->op2.u.opline_num); | printf("Conditional jmp to %d\n", opline->op2.opline_num); |
#endif |
#endif |
ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr); | ZEND_VM_SET_OPCODE(opline->op2.jmp_addr); |
ZEND_VM_CONTINUE(); |
ZEND_VM_CONTINUE(); |
} |
} |
|
|
Line 1685 ZEND_VM_HANDLER(43, ZEND_JMPZ, CONST|TMP|VAR|CV, ANY)
|
Line 1864 ZEND_VM_HANDLER(43, ZEND_JMPZ, CONST|TMP|VAR|CV, ANY)
|
|
|
ZEND_VM_HANDLER(44, ZEND_JMPNZ, CONST|TMP|VAR|CV, ANY) |
ZEND_VM_HANDLER(44, ZEND_JMPNZ, CONST|TMP|VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval *val = GET_OP1_ZVAL_PTR(BP_VAR_R); | zval *val; |
int ret; |
int ret; |
|
|
if (OP1_TYPE == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { | SAVE_OPLINE(); |
| val = GET_OP1_ZVAL_PTR(BP_VAR_R); |
| |
| if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) == IS_BOOL)) { |
ret = Z_LVAL_P(val); |
ret = Z_LVAL_P(val); |
} else { |
} else { |
ret = i_zend_is_true(val); |
ret = i_zend_is_true(val); |
FREE_OP1(); |
FREE_OP1(); |
if (UNEXPECTED(EG(exception) != NULL)) { |
if (UNEXPECTED(EG(exception) != NULL)) { |
ZEND_VM_CONTINUE(); | HANDLE_EXCEPTION(); |
} |
} |
} |
} |
if (ret) { |
if (ret) { |
#if DEBUG_ZEND>=2 |
#if DEBUG_ZEND>=2 |
printf("Conditional jmp to %d\n", opline->op2.u.opline_num); | printf("Conditional jmp to %d\n", opline->op2.opline_num); |
#endif |
#endif |
ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr); | ZEND_VM_SET_OPCODE(opline->op2.jmp_addr); |
ZEND_VM_CONTINUE(); |
ZEND_VM_CONTINUE(); |
} |
} |
|
|
Line 1712 ZEND_VM_HANDLER(44, ZEND_JMPNZ, CONST|TMP|VAR|CV, ANY)
|
Line 1894 ZEND_VM_HANDLER(44, ZEND_JMPNZ, CONST|TMP|VAR|CV, ANY)
|
|
|
ZEND_VM_HANDLER(45, ZEND_JMPZNZ, CONST|TMP|VAR|CV, ANY) |
ZEND_VM_HANDLER(45, ZEND_JMPZNZ, CONST|TMP|VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval *val = GET_OP1_ZVAL_PTR(BP_VAR_R); | zval *val; |
int retval; |
int retval; |
|
|
if (OP1_TYPE == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { | SAVE_OPLINE(); |
| val = GET_OP1_ZVAL_PTR(BP_VAR_R); |
| |
| if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) == IS_BOOL)) { |
retval = Z_LVAL_P(val); |
retval = Z_LVAL_P(val); |
} else { |
} else { |
retval = i_zend_is_true(val); |
retval = i_zend_is_true(val); |
FREE_OP1(); |
FREE_OP1(); |
if (UNEXPECTED(EG(exception) != NULL)) { |
if (UNEXPECTED(EG(exception) != NULL)) { |
ZEND_VM_CONTINUE(); | HANDLE_EXCEPTION(); |
} |
} |
} |
} |
if (EXPECTED(retval != 0)) { |
if (EXPECTED(retval != 0)) { |
Line 1734 ZEND_VM_HANDLER(45, ZEND_JMPZNZ, CONST|TMP|VAR|CV, ANY
|
Line 1919 ZEND_VM_HANDLER(45, ZEND_JMPZNZ, CONST|TMP|VAR|CV, ANY
|
ZEND_VM_CONTINUE(); /* CHECK_ME */ |
ZEND_VM_CONTINUE(); /* CHECK_ME */ |
} else { |
} else { |
#if DEBUG_ZEND>=2 |
#if DEBUG_ZEND>=2 |
printf("Conditional jmp on false to %d\n", opline->op2.u.opline_num); | printf("Conditional jmp on false to %d\n", opline->op2.opline_num); |
#endif |
#endif |
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->op2.u.opline_num]); | ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->op2.opline_num]); |
ZEND_VM_CONTINUE(); /* CHECK_ME */ |
ZEND_VM_CONTINUE(); /* CHECK_ME */ |
} |
} |
} |
} |
|
|
ZEND_VM_HANDLER(46, ZEND_JMPZ_EX, CONST|TMP|VAR|CV, ANY) |
ZEND_VM_HANDLER(46, ZEND_JMPZ_EX, CONST|TMP|VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval *val = GET_OP1_ZVAL_PTR(BP_VAR_R); | zval *val; |
int retval; |
int retval; |
|
|
if (OP1_TYPE == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { | SAVE_OPLINE(); |
| val = GET_OP1_ZVAL_PTR(BP_VAR_R); |
| |
| if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) == IS_BOOL)) { |
retval = Z_LVAL_P(val); |
retval = Z_LVAL_P(val); |
} else { |
} else { |
retval = i_zend_is_true(val); |
retval = i_zend_is_true(val); |
FREE_OP1(); |
FREE_OP1(); |
if (UNEXPECTED(EG(exception) != NULL)) { |
if (UNEXPECTED(EG(exception) != NULL)) { |
ZEND_VM_CONTINUE(); | HANDLE_EXCEPTION(); |
} |
} |
} |
} |
Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; | Z_LVAL(EX_T(opline->result.var).tmp_var) = retval; |
Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; | Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL; |
if (!retval) { |
if (!retval) { |
#if DEBUG_ZEND>=2 |
#if DEBUG_ZEND>=2 |
printf("Conditional jmp to %d\n", opline->op2.u.opline_num); | printf("Conditional jmp to %d\n", opline->op2.opline_num); |
#endif |
#endif |
ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr); | ZEND_VM_SET_OPCODE(opline->op2.jmp_addr); |
ZEND_VM_CONTINUE(); |
ZEND_VM_CONTINUE(); |
} |
} |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
Line 1771 ZEND_VM_HANDLER(46, ZEND_JMPZ_EX, CONST|TMP|VAR|CV, AN
|
Line 1959 ZEND_VM_HANDLER(46, ZEND_JMPZ_EX, CONST|TMP|VAR|CV, AN
|
|
|
ZEND_VM_HANDLER(47, ZEND_JMPNZ_EX, CONST|TMP|VAR|CV, ANY) |
ZEND_VM_HANDLER(47, ZEND_JMPNZ_EX, CONST|TMP|VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval *val = GET_OP1_ZVAL_PTR(BP_VAR_R); | zval *val; |
int retval; |
int retval; |
|
|
if (OP1_TYPE == IS_TMP_VAR && Z_TYPE_P(val) == IS_BOOL) { | SAVE_OPLINE(); |
| val = GET_OP1_ZVAL_PTR(BP_VAR_R); |
| |
| if (OP1_TYPE == IS_TMP_VAR && EXPECTED(Z_TYPE_P(val) == IS_BOOL)) { |
retval = Z_LVAL_P(val); |
retval = Z_LVAL_P(val); |
} else { |
} else { |
retval = i_zend_is_true(val); |
retval = i_zend_is_true(val); |
FREE_OP1(); |
FREE_OP1(); |
if (UNEXPECTED(EG(exception) != NULL)) { |
if (UNEXPECTED(EG(exception) != NULL)) { |
ZEND_VM_CONTINUE(); | HANDLE_EXCEPTION(); |
} |
} |
} |
} |
Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval; | Z_LVAL(EX_T(opline->result.var).tmp_var) = retval; |
Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; | Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL; |
if (retval) { |
if (retval) { |
#if DEBUG_ZEND>=2 |
#if DEBUG_ZEND>=2 |
printf("Conditional jmp to %d\n", opline->op2.u.opline_num); | printf("Conditional jmp to %d\n", opline->op2.opline_num); |
#endif |
#endif |
ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr); | ZEND_VM_SET_OPCODE(opline->op2.jmp_addr); |
ZEND_VM_CONTINUE(); |
ZEND_VM_CONTINUE(); |
} |
} |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(70, ZEND_FREE, TMP, ANY) | ZEND_VM_HANDLER(70, ZEND_FREE, TMP|VAR, ANY) |
{ |
{ |
zendi_zval_dtor(EX_T(EX(opline)->op1.u.var).tmp_var); | USE_OPLINE |
| |
| SAVE_OPLINE(); |
| if (OP1_TYPE == IS_TMP_VAR) { |
| zendi_zval_dtor(EX_T(opline->op1.var).tmp_var); |
| } else { |
| zval_ptr_dtor(&EX_T(opline->op1.var).var.ptr); |
| } |
| CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(53, ZEND_INIT_STRING, ANY, ANY) |
ZEND_VM_HANDLER(53, ZEND_INIT_STRING, ANY, ANY) |
{ |
{ |
zval *tmp = &EX_T(EX(opline)->result.u.var).tmp_var; | USE_OPLINE |
| zval *tmp = &EX_T(opline->result.var).tmp_var; |
|
|
|
SAVE_OPLINE(); |
tmp->value.str.val = emalloc(1); |
tmp->value.str.val = emalloc(1); |
tmp->value.str.val[0] = 0; |
tmp->value.str.val[0] = 0; |
tmp->value.str.len = 0; |
tmp->value.str.len = 0; |
Z_SET_REFCOUNT_P(tmp, 1); |
Z_SET_REFCOUNT_P(tmp, 1); |
tmp->type = IS_STRING; |
tmp->type = IS_STRING; |
Z_UNSET_ISREF_P(tmp); |
Z_UNSET_ISREF_P(tmp); |
|
/*CHECK_EXCEPTION();*/ |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(54, ZEND_ADD_CHAR, TMP|UNUSED, CONST) |
ZEND_VM_HANDLER(54, ZEND_ADD_CHAR, TMP|UNUSED, CONST) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zval *str = &EX_T(opline->result.u.var).tmp_var; | zval *str = &EX_T(opline->result.var).tmp_var; |
|
|
|
SAVE_OPLINE(); |
|
|
if (OP1_TYPE == IS_UNUSED) { |
if (OP1_TYPE == IS_UNUSED) { |
/* Initialize for erealloc in add_char_to_string */ |
/* Initialize for erealloc in add_char_to_string */ |
Z_STRVAL_P(str) = NULL; |
Z_STRVAL_P(str) = NULL; |
Line 1830 ZEND_VM_HANDLER(54, ZEND_ADD_CHAR, TMP|UNUSED, CONST)
|
Line 2034 ZEND_VM_HANDLER(54, ZEND_ADD_CHAR, TMP|UNUSED, CONST)
|
INIT_PZVAL(str); |
INIT_PZVAL(str); |
} |
} |
|
|
add_char_to_string(str, str, &opline->op2.u.constant); | add_char_to_string(str, str, opline->op2.zv); |
|
|
/* FREE_OP is missing intentionally here - we're always working on the same temporary variable */ |
/* FREE_OP is missing intentionally here - we're always working on the same temporary variable */ |
|
/*CHECK_EXCEPTION();*/ |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(55, ZEND_ADD_STRING, TMP|UNUSED, CONST) |
ZEND_VM_HANDLER(55, ZEND_ADD_STRING, TMP|UNUSED, CONST) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zval *str = &EX_T(opline->result.u.var).tmp_var; | zval *str = &EX_T(opline->result.var).tmp_var; |
|
|
|
SAVE_OPLINE(); |
|
|
if (OP1_TYPE == IS_UNUSED) { |
if (OP1_TYPE == IS_UNUSED) { |
/* Initialize for erealloc in add_string_to_string */ |
/* Initialize for erealloc in add_string_to_string */ |
Z_STRVAL_P(str) = NULL; |
Z_STRVAL_P(str) = NULL; |
Line 1850 ZEND_VM_HANDLER(55, ZEND_ADD_STRING, TMP|UNUSED, CONST
|
Line 2057 ZEND_VM_HANDLER(55, ZEND_ADD_STRING, TMP|UNUSED, CONST
|
INIT_PZVAL(str); |
INIT_PZVAL(str); |
} |
} |
|
|
add_string_to_string(str, str, &opline->op2.u.constant); | add_string_to_string(str, str, opline->op2.zv); |
|
|
/* FREE_OP is missing intentionally here - we're always working on the same temporary variable */ |
/* FREE_OP is missing intentionally here - we're always working on the same temporary variable */ |
|
/*CHECK_EXCEPTION();*/ |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(56, ZEND_ADD_VAR, TMP|UNUSED, TMP|VAR|CV) |
ZEND_VM_HANDLER(56, ZEND_ADD_VAR, TMP|UNUSED, TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op2; |
zend_free_op free_op2; |
zval *str = &EX_T(opline->result.u.var).tmp_var; | zval *str = &EX_T(opline->result.var).tmp_var; |
zval *var = GET_OP2_ZVAL_PTR(BP_VAR_R); | zval *var; |
zval var_copy; |
zval var_copy; |
int use_copy = 0; |
int use_copy = 0; |
|
|
|
SAVE_OPLINE(); |
|
var = GET_OP2_ZVAL_PTR(BP_VAR_R); |
|
|
if (OP1_TYPE == IS_UNUSED) { |
if (OP1_TYPE == IS_UNUSED) { |
/* Initialize for erealloc in add_string_to_string */ |
/* Initialize for erealloc in add_string_to_string */ |
Z_STRVAL_P(str) = NULL; |
Z_STRVAL_P(str) = NULL; |
Line 1894 ZEND_VM_HANDLER(56, ZEND_ADD_VAR, TMP|UNUSED, TMP|VAR|
|
Line 2105 ZEND_VM_HANDLER(56, ZEND_ADD_VAR, TMP|UNUSED, TMP|VAR|
|
*/ |
*/ |
FREE_OP2(); |
FREE_OP2(); |
|
|
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(109, ZEND_FETCH_CLASS, ANY, CONST|TMP|VAR|UNUSED|CV) |
ZEND_VM_HANDLER(109, ZEND_FETCH_CLASS, ANY, CONST|TMP|VAR|UNUSED|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
|
|
| SAVE_OPLINE(); |
| EG(exception) = NULL; |
if (OP2_TYPE == IS_UNUSED) { |
if (OP2_TYPE == IS_UNUSED) { |
EX_T(opline->result.u.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); | EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC); |
| CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} else { |
} else { |
zend_free_op free_op2; |
zend_free_op free_op2; |
zval *class_name = GET_OP2_ZVAL_PTR(BP_VAR_R); |
zval *class_name = GET_OP2_ZVAL_PTR(BP_VAR_R); |
|
|
if (OP2_TYPE != IS_CONST && Z_TYPE_P(class_name) == IS_OBJECT) { | if (OP2_TYPE == IS_CONST) { |
EX_T(opline->result.u.var).class_entry = Z_OBJCE_P(class_name); | if (CACHED_PTR(opline->op2.literal->cache_slot)) { |
| EX_T(opline->result.var).class_entry = CACHED_PTR(opline->op2.literal->cache_slot); |
| } else { |
| EX_T(opline->result.var).class_entry = zend_fetch_class_by_name(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); |
| CACHE_PTR(opline->op2.literal->cache_slot, EX_T(opline->result.var).class_entry); |
| } |
| } else if (Z_TYPE_P(class_name) == IS_OBJECT) { |
| EX_T(opline->result.var).class_entry = Z_OBJCE_P(class_name); |
} else if (Z_TYPE_P(class_name) == IS_STRING) { |
} else if (Z_TYPE_P(class_name) == IS_STRING) { |
EX_T(opline->result.u.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC); | EX_T(opline->result.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC); |
} else { |
} else { |
zend_error_noreturn(E_ERROR, "Class name must be a valid object or a string"); |
zend_error_noreturn(E_ERROR, "Class name must be a valid object or a string"); |
} |
} |
|
|
FREE_OP2(); |
FREE_OP2(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
} |
} |
|
|
ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zval *function_name; |
zval *function_name; |
char *function_name_strval; |
char *function_name_strval; |
int function_name_strlen; |
int function_name_strlen; |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
|
|
|
SAVE_OPLINE(); |
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); |
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); |
|
|
function_name = GET_OP2_ZVAL_PTR(BP_VAR_R); |
function_name = GET_OP2_ZVAL_PTR(BP_VAR_R); |
|
|
if (Z_TYPE_P(function_name)!=IS_STRING) { | if (OP2_TYPE != IS_CONST && |
| UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) { |
zend_error_noreturn(E_ERROR, "Method name must be a string"); |
zend_error_noreturn(E_ERROR, "Method name must be a string"); |
} |
} |
|
|
Line 1943 ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UN
|
Line 2167 ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UN
|
|
|
EX(object) = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_R); |
EX(object) = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_R); |
|
|
if (EX(object) && Z_TYPE_P(EX(object)) == IS_OBJECT) { | if (EXPECTED(EX(object) != NULL) && |
if (Z_OBJ_HT_P(EX(object))->get_method == NULL) { | EXPECTED(Z_TYPE_P(EX(object)) == IS_OBJECT)) { |
zend_error_noreturn(E_ERROR, "Object does not support method calls"); | EX(called_scope) = Z_OBJCE_P(EX(object)); |
} | |
|
|
/* First, locate the function. */ | if (OP2_TYPE != IS_CONST || |
EX(fbc) = Z_OBJ_HT_P(EX(object))->get_method(&EX(object), function_name_strval, function_name_strlen TSRMLS_CC); | (EX(fbc) = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, EX(called_scope))) == NULL) { |
if (!EX(fbc)) { | zval *object = EX(object); |
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), function_name_strval); | |
| if (UNEXPECTED(Z_OBJ_HT_P(EX(object))->get_method == NULL)) { |
| zend_error_noreturn(E_ERROR, "Object does not support method calls"); |
| } |
| |
| /* First, locate the function. */ |
| EX(fbc) = Z_OBJ_HT_P(EX(object))->get_method(&EX(object), function_name_strval, function_name_strlen, ((OP2_TYPE == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC); |
| if (UNEXPECTED(EX(fbc) == NULL)) { |
| zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), function_name_strval); |
| } |
| if (OP2_TYPE == IS_CONST && |
| EXPECTED(EX(fbc)->type <= ZEND_USER_FUNCTION) && |
| EXPECTED((EX(fbc)->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0) && |
| EXPECTED(EX(object) == object)) { |
| CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, EX(called_scope), EX(fbc)); |
| } |
} |
} |
|
|
EX(called_scope) = Z_OBJCE_P(EX(object)); |
|
} else { |
} else { |
zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); |
zend_error_noreturn(E_ERROR, "Call to a member function %s() on a non-object", function_name_strval); |
} |
} |
| |
if ((EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0) { |
if ((EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0) { |
EX(object) = NULL; |
EX(object) = NULL; |
} else { | } else { |
if (!PZVAL_IS_REF(EX(object))) { |
if (!PZVAL_IS_REF(EX(object))) { |
Z_ADDREF_P(EX(object)); /* For $this pointer */ |
Z_ADDREF_P(EX(object)); /* For $this pointer */ |
} else { |
} else { |
Line 1976 ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UN
|
Line 2212 ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UN
|
FREE_OP2(); |
FREE_OP2(); |
FREE_OP1_IF_VAR(); |
FREE_OP1_IF_VAR(); |
|
|
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUSED|CV) |
ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUSED|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zval *function_name; |
zval *function_name; |
zend_class_entry *ce; |
zend_class_entry *ce; |
|
|
|
SAVE_OPLINE(); |
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); |
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); |
|
|
if (OP1_TYPE == IS_CONST) { |
if (OP1_TYPE == IS_CONST) { |
/* no function found. try a static method in class */ |
/* no function found. try a static method in class */ |
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); | if (CACHED_PTR(opline->op1.literal->cache_slot)) { |
if (!ce) { | ce = CACHED_PTR(opline->op1.literal->cache_slot); |
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL(opline->op1.u.constant)); | } else { |
| ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); |
| if (UNEXPECTED(EG(exception) != NULL)) { |
| HANDLE_EXCEPTION(); |
| } |
| if (UNEXPECTED(ce == NULL)) { |
| zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv)); |
| } |
| CACHE_PTR(opline->op1.literal->cache_slot, ce); |
} |
} |
EX(called_scope) = ce; |
EX(called_scope) = ce; |
} else { |
} else { |
ce = EX_T(opline->op1.u.var).class_entry; | ce = EX_T(opline->op1.var).class_entry; |
| |
if (opline->op1.u.EA.type == ZEND_FETCH_CLASS_PARENT || opline->op1.u.EA.type == ZEND_FETCH_CLASS_SELF) { | if (opline->extended_value == ZEND_FETCH_CLASS_PARENT || opline->extended_value == ZEND_FETCH_CLASS_SELF) { |
EX(called_scope) = EG(called_scope); |
EX(called_scope) = EG(called_scope); |
} else { |
} else { |
EX(called_scope) = ce; |
EX(called_scope) = ce; |
} |
} |
} |
} |
if(OP2_TYPE != IS_UNUSED) { | |
| if (OP1_TYPE == IS_CONST && |
| OP2_TYPE == IS_CONST && |
| CACHED_PTR(opline->op2.literal->cache_slot)) { |
| EX(fbc) = CACHED_PTR(opline->op2.literal->cache_slot); |
| } else if (OP1_TYPE != IS_CONST && |
| OP2_TYPE == IS_CONST && |
| (EX(fbc) = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce))) { |
| /* do nothing */ |
| } else if (OP2_TYPE != IS_UNUSED) { |
char *function_name_strval = NULL; |
char *function_name_strval = NULL; |
int function_name_strlen = 0; |
int function_name_strlen = 0; |
zend_free_op free_op2; |
zend_free_op free_op2; |
|
|
if (OP2_TYPE == IS_CONST) { |
if (OP2_TYPE == IS_CONST) { |
function_name_strval = Z_STRVAL(opline->op2.u.constant); | function_name_strval = Z_STRVAL_P(opline->op2.zv); |
function_name_strlen = Z_STRLEN(opline->op2.u.constant); | function_name_strlen = Z_STRLEN_P(opline->op2.zv); |
} else { |
} else { |
function_name = GET_OP2_ZVAL_PTR(BP_VAR_R); |
function_name = GET_OP2_ZVAL_PTR(BP_VAR_R); |
|
|
if (Z_TYPE_P(function_name) != IS_STRING) { | if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) { |
zend_error_noreturn(E_ERROR, "Function name must be a string"); |
zend_error_noreturn(E_ERROR, "Function name must be a string"); |
} else { |
} else { |
function_name_strval = Z_STRVAL_P(function_name); |
function_name_strval = Z_STRVAL_P(function_name); |
Line 2026 ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CON
|
Line 2281 ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CON
|
if (ce->get_static_method) { |
if (ce->get_static_method) { |
EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); |
EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); |
} else { |
} else { |
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); | EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen, ((OP2_TYPE == IS_CONST) ? (opline->op2.literal + 1) : NULL) TSRMLS_CC); |
} |
} |
if (!EX(fbc)) { | if (UNEXPECTED(EX(fbc) == NULL)) { |
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval); |
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval); |
} |
} |
|
if (OP2_TYPE == IS_CONST && |
|
EXPECTED(EX(fbc)->type <= ZEND_USER_FUNCTION) && |
|
EXPECTED((EX(fbc)->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) { |
|
if (OP1_TYPE == IS_CONST) { |
|
CACHE_PTR(opline->op2.literal->cache_slot, EX(fbc)); |
|
} else { |
|
CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, EX(fbc)); |
|
} |
|
} |
} |
} |
|
|
if (OP2_TYPE != IS_CONST) { |
if (OP2_TYPE != IS_CONST) { |
FREE_OP2(); |
FREE_OP2(); |
} |
} |
} else { |
} else { |
if(!ce->constructor) { | if (UNEXPECTED(ce->constructor == NULL)) { |
zend_error_noreturn(E_ERROR, "Cannot call constructor"); |
zend_error_noreturn(E_ERROR, "Cannot call constructor"); |
} |
} |
if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { |
if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { |
zend_error(E_COMPILE_ERROR, "Cannot call private %s::__construct()", ce->name); | zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name); |
} |
} |
EX(fbc) = ce->constructor; |
EX(fbc) = ce->constructor; |
} |
} |
Line 2054 ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CON
|
Line 2317 ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CON
|
!instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { |
!instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { |
/* We are calling method of the other (incompatible) class, |
/* We are calling method of the other (incompatible) class, |
but passing $this. This is done for compatibility with php-4. */ |
but passing $this. This is done for compatibility with php-4. */ |
int severity; |
|
char *verb; |
|
if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { |
if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { |
severity = E_STRICT; | zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name); |
verb = "should not"; | |
} else { |
} else { |
/* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ |
/* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ |
severity = E_ERROR; | zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name); |
verb = "cannot"; | |
} |
} |
zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb); |
|
|
|
} |
} |
if ((EX(object) = EG(This))) { |
if ((EX(object) = EG(This))) { |
Z_ADDREF_P(EX(object)); |
Z_ADDREF_P(EX(object)); |
Line 2073 ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CON
|
Line 2330 ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CON
|
} |
} |
} |
} |
|
|
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zval *function_name; |
zval *function_name; |
char *function_name_strval, *lcname; |
|
int function_name_strlen; |
|
zend_free_op free_op2; |
|
|
|
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); |
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); |
|
|
if (OP2_TYPE == IS_CONST) { |
if (OP2_TYPE == IS_CONST) { |
if (zend_hash_quick_find(EG(function_table), Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant)+1, opline->extended_value, (void **) &EX(fbc)) == FAILURE) { | function_name = (zval*)(opline->op2.literal+1); |
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL(opline->op2.u.constant)); | if (CACHED_PTR(opline->op2.literal->cache_slot)) { |
| EX(fbc) = CACHED_PTR(opline->op2.literal->cache_slot); |
| } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)+1, Z_HASH_P(function_name), (void **) &EX(fbc)) == FAILURE)) { |
| SAVE_OPLINE(); |
| zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv)); |
| } else { |
| CACHE_PTR(opline->op2.literal->cache_slot, EX(fbc)); |
} |
} |
|
EX(object) = NULL; |
|
/*CHECK_EXCEPTION();*/ |
|
ZEND_VM_NEXT_OPCODE(); |
} else { |
} else { |
|
char *function_name_strval, *lcname; |
|
int function_name_strlen; |
|
zend_free_op free_op2; |
|
|
|
SAVE_OPLINE(); |
function_name = GET_OP2_ZVAL_PTR(BP_VAR_R); |
function_name = GET_OP2_ZVAL_PTR(BP_VAR_R); |
|
|
if (OP2_TYPE != IS_CONST && OP2_TYPE != IS_TMP_VAR && | if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) { |
Z_TYPE_P(function_name) == IS_OBJECT && | function_name_strval = Z_STRVAL_P(function_name); |
| function_name_strlen = Z_STRLEN_P(function_name); |
| if (function_name_strval[0] == '\\') { |
| function_name_strlen -= 1; |
| lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen); |
| } else { |
| lcname = zend_str_tolower_dup(function_name_strval, function_name_strlen); |
| } |
| if (UNEXPECTED(zend_hash_find(EG(function_table), lcname, function_name_strlen+1, (void **) &EX(fbc)) == FAILURE)) { |
| zend_error_noreturn(E_ERROR, "Call to undefined function %s()", function_name_strval); |
| } |
| efree(lcname); |
| FREE_OP2(); |
| EX(object) = NULL; |
| CHECK_EXCEPTION(); |
| ZEND_VM_NEXT_OPCODE(); |
| } else if (OP2_TYPE != IS_CONST && OP2_TYPE != IS_TMP_VAR && |
| EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT) && |
Z_OBJ_HANDLER_P(function_name, get_closure) && |
Z_OBJ_HANDLER_P(function_name, get_closure) && |
Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &EX(called_scope), &EX(fbc), &EX(object) TSRMLS_CC) == SUCCESS) { |
Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &EX(called_scope), &EX(fbc), &EX(object) TSRMLS_CC) == SUCCESS) { |
if (EX(object)) { |
if (EX(object)) { |
Line 2107 ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONS
|
Line 2392 ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONS
|
} else { |
} else { |
FREE_OP2(); |
FREE_OP2(); |
} |
} |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} | } else if (OP2_TYPE != IS_CONST && |
| EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) && |
| zend_hash_num_elements(Z_ARRVAL_P(function_name)) == 2) { |
| zend_class_entry *ce; |
| zval **method = NULL; |
| zval **obj = NULL; |
|
|
if (Z_TYPE_P(function_name) != IS_STRING) { | zend_hash_index_find(Z_ARRVAL_P(function_name), 0, (void **) &obj); |
zend_error_noreturn(E_ERROR, "Function name must be a string"); | zend_hash_index_find(Z_ARRVAL_P(function_name), 1, (void **) &method); |
} | |
function_name_strval = Z_STRVAL_P(function_name); | |
function_name_strlen = Z_STRLEN_P(function_name); | |
if (function_name_strval[0] == '\\') { | |
|
|
function_name_strlen -= 1; | if (!obj || !method) { |
lcname = zend_str_tolower_dup(function_name_strval + 1, function_name_strlen); | zend_error_noreturn(E_ERROR, "Array callback has to contain indices 0 and 1"); |
| } |
| |
| if (Z_TYPE_PP(obj) != IS_STRING && Z_TYPE_PP(obj) != IS_OBJECT) { |
| zend_error_noreturn(E_ERROR, "First array member is not a valid class name or object"); |
| } |
| |
| if (Z_TYPE_PP(method) != IS_STRING) { |
| zend_error_noreturn(E_ERROR, "Second array member is not a valid method"); |
| } |
| |
| if (Z_TYPE_PP(obj) == IS_STRING) { |
| ce = zend_fetch_class_by_name(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), NULL, 0 TSRMLS_CC); |
| if (UNEXPECTED(EG(exception) != NULL)) { |
| HANDLE_EXCEPTION(); |
| } |
| if (UNEXPECTED(ce == NULL)) { |
| zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_PP(obj)); |
| } |
| EX(called_scope) = ce; |
| EX(object) = NULL; |
| |
| if (ce->get_static_method) { |
| EX(fbc) = ce->get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method) TSRMLS_CC); |
| } else { |
| EX(fbc) = zend_std_get_static_method(ce, Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); |
| } |
| } else { |
| EX(object) = *obj; |
| ce = EX(called_scope) = Z_OBJCE_PP(obj); |
| |
| EX(fbc) = Z_OBJ_HT_P(EX(object))->get_method(&EX(object), Z_STRVAL_PP(method), Z_STRLEN_PP(method), NULL TSRMLS_CC); |
| if (UNEXPECTED(EX(fbc) == NULL)) { |
| zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(EX(object)), Z_STRVAL_PP(method)); |
| } |
| |
| if ((EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) != 0) { |
| EX(object) = NULL; |
| } else { |
| if (!PZVAL_IS_REF(EX(object))) { |
| Z_ADDREF_P(EX(object)); /* For $this pointer */ |
| } else { |
| zval *this_ptr; |
| ALLOC_ZVAL(this_ptr); |
| INIT_PZVAL_COPY(this_ptr, EX(object)); |
| zval_copy_ctor(this_ptr); |
| EX(object) = this_ptr; |
| } |
| } |
| } |
| |
| if (UNEXPECTED(EX(fbc) == NULL)) { |
| zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, Z_STRVAL_PP(method)); |
| } |
| FREE_OP2(); |
| CHECK_EXCEPTION(); |
| ZEND_VM_NEXT_OPCODE(); |
} else { |
} else { |
lcname = zend_str_tolower_dup(function_name_strval, function_name_strlen); | zend_error_noreturn(E_ERROR, "Function name must be a string"); |
} |
} |
if (zend_hash_find(EG(function_table), lcname, function_name_strlen+1, (void **) &EX(fbc)) == FAILURE) { |
|
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", function_name_strval); |
|
} |
|
efree(lcname); |
|
FREE_OP2(); |
|
} |
} |
|
|
EX(object) = NULL; |
|
ZEND_VM_NEXT_OPCODE(); |
|
} |
} |
|
|
|
|
ZEND_VM_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST) |
ZEND_VM_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_op *op_data = opline + 1; | zend_literal *func_name; |
|
|
ZEND_VM_INC_OPCODE(); |
|
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); |
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); |
|
|
if (zend_hash_quick_find(EG(function_table), Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant)+1, opline->extended_value, (void **) &EX(fbc))==FAILURE) { | func_name = opline->op2.literal + 1; |
char *short_name = Z_STRVAL(opline->op1.u.constant)+Z_LVAL(op_data->op1.u.constant); | if (CACHED_PTR(opline->op2.literal->cache_slot)) { |
if (zend_hash_quick_find(EG(function_table), short_name, Z_STRLEN(opline->op1.u.constant)-Z_LVAL(op_data->op1.u.constant)+1, op_data->extended_value, (void **) &EX(fbc))==FAILURE) { | EX(fbc) = CACHED_PTR(opline->op2.literal->cache_slot); |
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL(opline->op2.u.constant)); | } else if (zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &EX(fbc))==FAILURE) { |
| func_name++; |
| if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &EX(fbc))==FAILURE)) { |
| SAVE_OPLINE(); |
| zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv)); |
| } else { |
| CACHE_PTR(opline->op2.literal->cache_slot, EX(fbc)); |
} |
} |
|
} else { |
|
CACHE_PTR(opline->op2.literal->cache_slot, EX(fbc)); |
} |
} |
|
|
EX(object) = NULL; |
EX(object) = NULL; |
Line 2161 ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
|
Line 2503 ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
|
EG(current_execute_data) = EX(prev_execute_data); |
EG(current_execute_data) = EX(prev_execute_data); |
EG(opline_ptr) = NULL; |
EG(opline_ptr) = NULL; |
if (!EG(active_symbol_table)) { |
if (!EG(active_symbol_table)) { |
zval ***cv = EX(CVs); | zval ***cv = EX_CVs(); |
zval ***end = cv + EX(op_array)->last_var; | zval ***end = cv + op_array->last_var; |
while (cv != end) { |
while (cv != end) { |
if (*cv) { |
if (*cv) { |
zval_ptr_dtor(*cv); |
zval_ptr_dtor(*cv); |
Line 2170 ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
|
Line 2512 ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
|
cv++; |
cv++; |
} |
} |
} |
} |
| |
if ((op_array->fn_flags & ZEND_ACC_CLOSURE) && op_array->prototype) { |
if ((op_array->fn_flags & ZEND_ACC_CLOSURE) && op_array->prototype) { |
zval_ptr_dtor((zval**)&op_array->prototype); |
zval_ptr_dtor((zval**)&op_array->prototype); |
} |
} |
|
|
nested = EX(nested); |
nested = EX(nested); |
| |
zend_vm_stack_free(execute_data TSRMLS_CC); |
zend_vm_stack_free(execute_data TSRMLS_CC); |
|
|
if (nested) { |
if (nested) { |
execute_data = EG(current_execute_data); |
execute_data = EG(current_execute_data); |
|
} |
|
if (nested) { |
|
USE_OPLINE |
|
|
if (EX(call_opline)->opcode == ZEND_INCLUDE_OR_EVAL) { | LOAD_REGS(); |
| LOAD_OPLINE(); |
| if (UNEXPECTED(opline->opcode == ZEND_INCLUDE_OR_EVAL)) { |
|
|
EX(function_state).function = (zend_function *) EX(op_array); |
EX(function_state).function = (zend_function *) EX(op_array); |
EX(function_state).arguments = NULL; |
EX(function_state).arguments = NULL; |
EX(object) = EX(current_object); |
EX(object) = EX(current_object); |
|
|
if (RETURN_VALUE_USED(EX(call_opline))) { |
|
if (!EX_T(EX(call_opline)->result.u.var).var.ptr) { /* there was no return statement */ |
|
ALLOC_ZVAL(EX_T(EX(call_opline)->result.u.var).var.ptr); |
|
INIT_PZVAL(EX_T(EX(call_opline)->result.u.var).var.ptr); |
|
Z_LVAL_P(EX_T(EX(call_opline)->result.u.var).var.ptr) = 1; |
|
Z_TYPE_P(EX_T(EX(call_opline)->result.u.var).var.ptr) = IS_BOOL; |
|
} |
|
} |
|
|
|
EG(opline_ptr) = &EX(opline); |
EG(opline_ptr) = &EX(opline); |
EG(active_op_array) = EX(op_array); |
EG(active_op_array) = EX(op_array); |
EG(return_value_ptr_ptr) = EX(original_return_value); |
EG(return_value_ptr_ptr) = EX(original_return_value); |
destroy_op_array(op_array TSRMLS_CC); |
destroy_op_array(op_array TSRMLS_CC); |
efree(op_array); |
efree(op_array); |
if (EG(exception)) { | if (UNEXPECTED(EG(exception) != NULL)) { |
zend_throw_exception_internal(NULL TSRMLS_CC); |
zend_throw_exception_internal(NULL TSRMLS_CC); |
|
HANDLE_EXCEPTION_LEAVE(); |
|
} else if (RETURN_VALUE_USED(opline)) { |
|
if (!EX_T(opline->result.var).var.ptr) { /* there was no return statement */ |
|
zval *retval; |
|
|
|
ALLOC_ZVAL(retval); |
|
ZVAL_BOOL(retval, 1); |
|
INIT_PZVAL(retval); |
|
EX_T(opline->result.var).var.ptr = retval; |
|
} |
} |
} |
|
|
EX(opline)++; | ZEND_VM_INC_OPCODE(); |
ZEND_VM_LEAVE(); |
ZEND_VM_LEAVE(); |
} else { |
} else { |
|
|
Line 2230 ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
|
Line 2578 ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
|
EX(function_state).arguments = NULL; |
EX(function_state).arguments = NULL; |
|
|
if (EG(This)) { |
if (EG(This)) { |
if (EG(exception) && IS_CTOR_CALL(EX(called_scope))) { | if (UNEXPECTED(EG(exception) != NULL) && IS_CTOR_CALL(EX(called_scope))) { |
if (IS_CTOR_USED(EX(called_scope))) { |
if (IS_CTOR_USED(EX(called_scope))) { |
Z_DELREF_P(EG(This)); |
Z_DELREF_P(EG(This)); |
} |
} |
Line 2249 ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
|
Line 2597 ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
|
|
|
zend_vm_stack_clear_multiple(TSRMLS_C); |
zend_vm_stack_clear_multiple(TSRMLS_C); |
|
|
if (EG(exception)) { | if (UNEXPECTED(EG(exception) != NULL)) { |
zend_throw_exception_internal(NULL TSRMLS_CC); |
zend_throw_exception_internal(NULL TSRMLS_CC); |
if (RETURN_VALUE_USED(EX(call_opline)) && EX_T(EX(call_opline)->result.u.var).var.ptr) { | if (RETURN_VALUE_USED(opline) && EX_T(opline->result.var).var.ptr) { |
zval_ptr_dtor(&EX_T(EX(call_opline)->result.u.var).var.ptr); | zval_ptr_dtor(&EX_T(opline->result.var).var.ptr); |
} |
} |
|
HANDLE_EXCEPTION_LEAVE(); |
} |
} |
|
|
EX(opline)++; | ZEND_VM_INC_OPCODE(); |
ZEND_VM_LEAVE(); |
ZEND_VM_LEAVE(); |
} |
} |
} |
} |
Line 2265 ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
|
Line 2614 ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
|
|
|
ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) |
ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_bool should_change_scope = 0; |
zend_bool should_change_scope = 0; |
|
zend_function *fbc = EX(function_state).function; |
|
|
if (EX(function_state).function->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) { | SAVE_OPLINE(); |
if (EX(function_state).function->common.fn_flags & ZEND_ACC_ABSTRACT) { | if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) { |
zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name); | if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) { |
| zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", fbc->common.scope->name, fbc->common.function_name); |
| CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); /* Never reached */ |
ZEND_VM_NEXT_OPCODE(); /* Never reached */ |
} |
} |
if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) { | if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) { |
zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated", |
zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated", |
EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "", | fbc->common.scope ? fbc->common.scope->name : "", |
EX(function_state).function->common.scope ? "::" : "", | fbc->common.scope ? "::" : "", |
EX(function_state).function->common.function_name); | fbc->common.function_name); |
} |
} |
} |
} |
if (EX(function_state).function->common.scope && | if (fbc->common.scope && |
!(EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC) && | !(fbc->common.fn_flags & ZEND_ACC_STATIC) && |
!EX(object)) { |
!EX(object)) { |
|
|
if (EX(function_state).function->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { | if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { |
/* FIXME: output identifiers properly */ |
/* FIXME: output identifiers properly */ |
zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name); | zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically", fbc->common.scope->name, fbc->common.function_name); |
} else { |
} else { |
/* FIXME: output identifiers properly */ |
/* FIXME: output identifiers properly */ |
/* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ |
/* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ |
zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name); | zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically", fbc->common.scope->name, fbc->common.function_name); |
} |
} |
} |
} |
|
|
if (EX(function_state).function->type == ZEND_USER_FUNCTION || | if (fbc->type == ZEND_USER_FUNCTION || fbc->common.scope) { |
EX(function_state).function->common.scope) { | |
should_change_scope = 1; |
should_change_scope = 1; |
EX(current_this) = EG(This); |
EX(current_this) = EG(This); |
EX(current_scope) = EG(scope); |
EX(current_scope) = EG(scope); |
EX(current_called_scope) = EG(called_scope); |
EX(current_called_scope) = EG(called_scope); |
EG(This) = EX(object); |
EG(This) = EX(object); |
EG(scope) = (EX(function_state).function->type == ZEND_USER_FUNCTION || !EX(object)) ? EX(function_state).function->common.scope : NULL; | EG(scope) = (fbc->type == ZEND_USER_FUNCTION || !EX(object)) ? fbc->common.scope : NULL; |
EG(called_scope) = EX(called_scope); |
EG(called_scope) = EX(called_scope); |
} |
} |
|
|
zend_arg_types_stack_3_pop(&EG(arg_types_stack), &EX(called_scope), &EX(current_object), &EX(fbc)); |
zend_arg_types_stack_3_pop(&EG(arg_types_stack), &EX(called_scope), &EX(current_object), &EX(fbc)); |
EX(function_state).arguments = zend_vm_stack_push_args(opline->extended_value TSRMLS_CC); |
EX(function_state).arguments = zend_vm_stack_push_args(opline->extended_value TSRMLS_CC); |
|
LOAD_OPLINE(); |
|
|
if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION) { | if (fbc->type == ZEND_INTERNAL_FUNCTION) { |
ALLOC_INIT_ZVAL(EX_T(opline->result.u.var).var.ptr); | temp_variable *ret = &EX_T(opline->result.var); |
EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; | |
EX_T(opline->result.u.var).var.fcall_returned_reference = EX(function_state).function->common.return_reference; | |
|
|
if (EX(function_state).function->common.arg_info) { | if (fbc->common.arg_info) { |
zend_uint i=0; |
zend_uint i=0; |
zval **p = (zval**)EX(function_state).arguments; |
zval **p = (zval**)EX(function_state).arguments; |
ulong arg_count = opline->extended_value; |
ulong arg_count = opline->extended_value; |
|
|
while (arg_count>0) { |
while (arg_count>0) { |
zend_verify_arg_type(EX(function_state).function, ++i, *(p-arg_count), 0 TSRMLS_CC); | zend_verify_arg_type(fbc, ++i, *(p-arg_count), 0 TSRMLS_CC); |
arg_count--; |
arg_count--; |
} |
} |
} |
} |
if (!zend_execute_internal) { |
|
/* saves one function call if zend_execute_internal is not used */ |
|
((zend_internal_function *) EX(function_state).function)->handler(opline->extended_value, EX_T(opline->result.u.var).var.ptr, EX(function_state).function->common.return_reference?&EX_T(opline->result.u.var).var.ptr:NULL, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC); |
|
} else { |
|
zend_execute_internal(EXECUTE_DATA, RETURN_VALUE_USED(opline) TSRMLS_CC); |
|
} |
|
|
|
if (!RETURN_VALUE_USED(opline)) { | if (EXPECTED(EG(exception) == NULL)) { |
zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); | MAKE_STD_ZVAL(ret->var.ptr); |
| ZVAL_NULL(ret->var.ptr); |
| ret->var.ptr_ptr = &ret->var.ptr; |
| ret->var.fcall_returned_reference = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0; |
| |
| if (!zend_execute_internal) { |
| /* saves one function call if zend_execute_internal is not used */ |
| fbc->internal_function.handler(opline->extended_value, ret->var.ptr, (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) ? &ret->var.ptr : NULL, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC); |
| } else { |
| zend_execute_internal(EXECUTE_DATA, RETURN_VALUE_USED(opline) TSRMLS_CC); |
| } |
| |
| if (!RETURN_VALUE_USED(opline)) { |
| zval_ptr_dtor(&ret->var.ptr); |
| } |
| } else if (RETURN_VALUE_USED(opline)) { |
| EX_T(opline->result.var).var.ptr = NULL; |
} |
} |
} else if (EX(function_state).function->type == ZEND_USER_FUNCTION) { | } else if (fbc->type == ZEND_USER_FUNCTION) { |
EX(original_return_value) = EG(return_value_ptr_ptr); |
EX(original_return_value) = EG(return_value_ptr_ptr); |
EG(active_symbol_table) = NULL; |
EG(active_symbol_table) = NULL; |
EG(active_op_array) = &EX(function_state).function->op_array; | EG(active_op_array) = &fbc->op_array; |
EG(return_value_ptr_ptr) = NULL; |
EG(return_value_ptr_ptr) = NULL; |
if (RETURN_VALUE_USED(opline)) { | if (RETURN_VALUE_USED(opline)) { |
EG(return_value_ptr_ptr) = &EX_T(opline->result.u.var).var.ptr; | temp_variable *ret = &EX_T(opline->result.var); |
EX_T(opline->result.u.var).var.ptr = NULL; | |
EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; | ret->var.ptr = NULL; |
EX_T(opline->result.u.var).var.fcall_returned_reference = EX(function_state).function->common.return_reference; | EG(return_value_ptr_ptr) = &ret->var.ptr; |
| ret->var.ptr_ptr = &ret->var.ptr; |
| ret->var.fcall_returned_reference = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0; |
} |
} |
|
|
if (zend_execute == execute && !EG(exception)) { | if (EXPECTED(zend_execute == execute)) { |
EX(call_opline) = opline; | if (EXPECTED(EG(exception) == NULL)) { |
ZEND_VM_ENTER(); | ZEND_VM_ENTER(); |
| } |
} else { |
} else { |
zend_execute(EG(active_op_array) TSRMLS_CC); |
zend_execute(EG(active_op_array) TSRMLS_CC); |
} |
} |
Line 2368 ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
|
Line 2731 ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
|
} |
} |
EG(active_symbol_table) = EX(symbol_table); |
EG(active_symbol_table) = EX(symbol_table); |
} else { /* ZEND_OVERLOADED_FUNCTION */ |
} else { /* ZEND_OVERLOADED_FUNCTION */ |
ALLOC_INIT_ZVAL(EX_T(opline->result.u.var).var.ptr); | MAKE_STD_ZVAL(EX_T(opline->result.var).var.ptr); |
| ZVAL_NULL(EX_T(opline->result.var).var.ptr); |
|
|
/* Not sure what should be done here if it's a static method */ |
/* Not sure what should be done here if it's a static method */ |
if (EX(object)) { | if (EXPECTED(EX(object) != NULL)) { |
Z_OBJ_HT_P(EX(object))->call_method(EX(function_state).function->common.function_name, opline->extended_value, EX_T(opline->result.u.var).var.ptr, &EX_T(opline->result.u.var).var.ptr, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC); | Z_OBJ_HT_P(EX(object))->call_method(fbc->common.function_name, opline->extended_value, EX_T(opline->result.var).var.ptr, &EX_T(opline->result.var).var.ptr, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC); |
} else { |
} else { |
zend_error_noreturn(E_ERROR, "Cannot call overloaded function for non-object"); |
zend_error_noreturn(E_ERROR, "Cannot call overloaded function for non-object"); |
} |
} |
|
|
if (EX(function_state).function->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) { | if (fbc->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) { |
efree(EX(function_state).function->common.function_name); | efree((char*)fbc->common.function_name); |
} |
} |
efree(EX(function_state).function); | efree(fbc); |
|
|
if (!RETURN_VALUE_USED(opline)) { |
if (!RETURN_VALUE_USED(opline)) { |
zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); | zval_ptr_dtor(&EX_T(opline->result.var).var.ptr); |
} else { |
} else { |
Z_UNSET_ISREF_P(EX_T(opline->result.u.var).var.ptr); | Z_UNSET_ISREF_P(EX_T(opline->result.var).var.ptr); |
Z_SET_REFCOUNT_P(EX_T(opline->result.u.var).var.ptr, 1); | Z_SET_REFCOUNT_P(EX_T(opline->result.var).var.ptr, 1); |
EX_T(opline->result.u.var).var.fcall_returned_reference = 0; | EX_T(opline->result.var).var.fcall_returned_reference = 0; |
EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; | EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr; |
} |
} |
} |
} |
|
|
Line 2397 ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
|
Line 2761 ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
|
|
|
if (should_change_scope) { |
if (should_change_scope) { |
if (EG(This)) { |
if (EG(This)) { |
if (EG(exception) && IS_CTOR_CALL(EX(called_scope))) { | if (UNEXPECTED(EG(exception) != NULL) && IS_CTOR_CALL(EX(called_scope))) { |
if (IS_CTOR_USED(EX(called_scope))) { |
if (IS_CTOR_USED(EX(called_scope))) { |
Z_DELREF_P(EG(This)); |
Z_DELREF_P(EG(This)); |
} |
} |
Line 2417 ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
|
Line 2781 ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
|
|
|
zend_vm_stack_clear_multiple(TSRMLS_C); |
zend_vm_stack_clear_multiple(TSRMLS_C); |
|
|
if (EG(exception)) { | if (UNEXPECTED(EG(exception) != NULL)) { |
zend_throw_exception_internal(NULL TSRMLS_CC); |
zend_throw_exception_internal(NULL TSRMLS_CC); |
if (RETURN_VALUE_USED(opline) && EX_T(opline->result.u.var).var.ptr) { | if (RETURN_VALUE_USED(opline) && EX_T(opline->result.var).var.ptr) { |
zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); | zval_ptr_dtor(&EX_T(opline->result.var).var.ptr); |
} |
} |
|
HANDLE_EXCEPTION(); |
} |
} |
|
|
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
Line 2435 ZEND_VM_HANDLER(61, ZEND_DO_FCALL_BY_NAME, ANY, ANY)
|
Line 2800 ZEND_VM_HANDLER(61, ZEND_DO_FCALL_BY_NAME, ANY, ANY)
|
|
|
ZEND_VM_HANDLER(60, ZEND_DO_FCALL, CONST, ANY) |
ZEND_VM_HANDLER(60, ZEND_DO_FCALL, CONST, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval *fname = GET_OP1_ZVAL_PTR(BP_VAR_R); |
zval *fname = GET_OP1_ZVAL_PTR(BP_VAR_R); |
|
|
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); |
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope)); |
|
|
if (zend_hash_quick_find(EG(function_table), fname->value.str.val, fname->value.str.len+1, Z_LVAL(opline->op2.u.constant), (void **) &EX(function_state).function)==FAILURE) { | if (CACHED_PTR(opline->op1.literal->cache_slot)) { |
| EX(function_state).function = CACHED_PTR(opline->op1.literal->cache_slot); |
| } else if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(fname), Z_STRLEN_P(fname)+1, Z_HASH_P(fname), (void **) &EX(function_state).function)==FAILURE)) { |
| SAVE_OPLINE(); |
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", fname->value.str.val); |
zend_error_noreturn(E_ERROR, "Call to undefined function %s()", fname->value.str.val); |
|
} else { |
|
CACHE_PTR(opline->op1.literal->cache_slot, EX(function_state).function); |
} |
} |
EX(object) = NULL; |
EX(object) = NULL; |
|
|
Line 2453 ZEND_VM_HANDLER(60, ZEND_DO_FCALL, CONST, ANY)
|
Line 2823 ZEND_VM_HANDLER(60, ZEND_DO_FCALL, CONST, ANY)
|
|
|
ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY) |
ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zval *retval_ptr; |
zval *retval_ptr; |
|
zend_free_op free_op1; |
|
|
|
SAVE_OPLINE(); |
|
retval_ptr = GET_OP1_ZVAL_PTR(BP_VAR_R); |
|
|
|
if (!EG(return_value_ptr_ptr)) { |
|
if (OP1_TYPE == IS_TMP_VAR) { |
|
FREE_OP1(); |
|
} |
|
} else if (!IS_OP1_TMP_FREE()) { /* Not a temp var */ |
|
if (OP1_TYPE == IS_CONST || |
|
(PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { |
|
zval *ret; |
|
|
|
ALLOC_ZVAL(ret); |
|
INIT_PZVAL_COPY(ret, retval_ptr); |
|
zval_copy_ctor(ret); |
|
*EG(return_value_ptr_ptr) = ret; |
|
} else if ((OP1_TYPE == IS_CV || OP1_TYPE == IS_VAR) && |
|
retval_ptr == &EG(uninitialized_zval)) { |
|
zval *ret; |
|
|
|
ALLOC_INIT_ZVAL(ret); |
|
*EG(return_value_ptr_ptr) = ret; |
|
} else { |
|
*EG(return_value_ptr_ptr) = retval_ptr; |
|
Z_ADDREF_P(retval_ptr); |
|
} |
|
} else { |
|
zval *ret; |
|
|
|
ALLOC_ZVAL(ret); |
|
INIT_PZVAL_COPY(ret, retval_ptr); |
|
*EG(return_value_ptr_ptr) = ret; |
|
} |
|
FREE_OP1_IF_VAR(); |
|
ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); |
|
} |
|
|
|
ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY) |
|
{ |
|
USE_OPLINE |
|
zval *retval_ptr; |
zval **retval_ptr_ptr; |
zval **retval_ptr_ptr; |
zend_free_op free_op1; |
zend_free_op free_op1; |
|
|
if (EG(active_op_array)->return_reference == ZEND_RETURN_REF) { | SAVE_OPLINE(); |
|
|
|
do { |
if (OP1_TYPE == IS_CONST || OP1_TYPE == IS_TMP_VAR) { |
if (OP1_TYPE == IS_CONST || OP1_TYPE == IS_TMP_VAR) { |
/* Not supposed to happen, but we'll allow it */ |
/* Not supposed to happen, but we'll allow it */ |
zend_error(E_NOTICE, "Only variable references should be returned by reference"); |
zend_error(E_NOTICE, "Only variable references should be returned by reference"); |
ZEND_VM_C_GOTO(return_by_value); | |
| retval_ptr = GET_OP1_ZVAL_PTR(BP_VAR_R); |
| if (!EG(return_value_ptr_ptr)) { |
| if (OP1_TYPE == IS_TMP_VAR) { |
| FREE_OP1(); |
| } |
| } else if (!IS_OP1_TMP_FREE()) { /* Not a temp var */ |
| zval *ret; |
| |
| ALLOC_ZVAL(ret); |
| INIT_PZVAL_COPY(ret, retval_ptr); |
| zval_copy_ctor(ret); |
| *EG(return_value_ptr_ptr) = ret; |
| } else { |
| zval *ret; |
| |
| ALLOC_ZVAL(ret); |
| INIT_PZVAL_COPY(ret, retval_ptr); |
| *EG(return_value_ptr_ptr) = ret; |
| } |
| break; |
} |
} |
|
|
retval_ptr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); |
retval_ptr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); |
|
|
if (OP1_TYPE == IS_VAR && !retval_ptr_ptr) { | if (OP1_TYPE == IS_VAR && UNEXPECTED(retval_ptr_ptr == NULL)) { |
zend_error_noreturn(E_ERROR, "Cannot return string offsets by reference"); |
zend_error_noreturn(E_ERROR, "Cannot return string offsets by reference"); |
} |
} |
|
|
if (OP1_TYPE == IS_VAR && !Z_ISREF_PP(retval_ptr_ptr)) { |
if (OP1_TYPE == IS_VAR && !Z_ISREF_PP(retval_ptr_ptr)) { |
if (opline->extended_value == ZEND_RETURNS_FUNCTION && |
if (opline->extended_value == ZEND_RETURNS_FUNCTION && |
EX_T(opline->op1.u.var).var.fcall_returned_reference) { | EX_T(opline->op1.var).var.fcall_returned_reference) { |
} else if (EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr) { | } else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { |
if (OP1_TYPE == IS_VAR && !OP1_FREE) { | |
PZVAL_LOCK(*retval_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */ | |
} | |
zend_error(E_NOTICE, "Only variable references should be returned by reference"); |
zend_error(E_NOTICE, "Only variable references should be returned by reference"); |
ZEND_VM_C_GOTO(return_by_value); | if (EG(return_value_ptr_ptr)) { |
| zval *ret; |
| |
| ALLOC_ZVAL(ret); |
| INIT_PZVAL_COPY(ret, *retval_ptr_ptr); |
| zval_copy_ctor(ret); |
| *EG(return_value_ptr_ptr) = ret; |
| } |
| break; |
} |
} |
} |
} |
|
|
Line 2488 ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY
|
Line 2927 ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY
|
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr_ptr); |
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr_ptr); |
Z_ADDREF_PP(retval_ptr_ptr); |
Z_ADDREF_PP(retval_ptr_ptr); |
|
|
(*EG(return_value_ptr_ptr)) = (*retval_ptr_ptr); | *EG(return_value_ptr_ptr) = *retval_ptr_ptr; |
} |
} |
} else { | } while (0); |
ZEND_VM_C_LABEL(return_by_value): | |
|
|
retval_ptr = GET_OP1_ZVAL_PTR(BP_VAR_R); |
|
|
|
if (!EG(return_value_ptr_ptr)) { |
|
if (OP1_TYPE == IS_TMP_VAR) { |
|
FREE_OP1(); |
|
} |
|
} else if (!IS_OP1_TMP_FREE()) { /* Not a temp var */ |
|
if (OP1_TYPE == IS_CONST || |
|
EG(active_op_array)->return_reference == ZEND_RETURN_REF || |
|
(PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) { |
|
zval *ret; |
|
|
|
ALLOC_ZVAL(ret); |
|
INIT_PZVAL_COPY(ret, retval_ptr); |
|
zval_copy_ctor(ret); |
|
*EG(return_value_ptr_ptr) = ret; |
|
} else if ((OP1_TYPE == IS_CV || OP1_TYPE == IS_VAR) && |
|
retval_ptr == &EG(uninitialized_zval)) { |
|
zval *ret; |
|
|
|
ALLOC_INIT_ZVAL(ret); |
|
*EG(return_value_ptr_ptr) = ret; |
|
} else { |
|
*EG(return_value_ptr_ptr) = retval_ptr; |
|
Z_ADDREF_P(retval_ptr); |
|
} |
|
} else { |
|
zval *ret; |
|
|
|
ALLOC_ZVAL(ret); |
|
INIT_PZVAL_COPY(ret, retval_ptr); |
|
*EG(return_value_ptr_ptr) = ret; |
|
} |
|
} |
|
FREE_OP1_IF_VAR(); |
FREE_OP1_IF_VAR(); |
ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); |
ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper); |
} |
} |
|
|
ZEND_VM_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY) |
ZEND_VM_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zval *value; |
zval *value; |
zval *exception; |
zval *exception; |
zend_free_op free_op1; |
zend_free_op free_op1; |
|
|
|
SAVE_OPLINE(); |
value = GET_OP1_ZVAL_PTR(BP_VAR_R); |
value = GET_OP1_ZVAL_PTR(BP_VAR_R); |
|
|
if (OP1_TYPE == IS_CONST || Z_TYPE_P(value) != IS_OBJECT) { | if (OP1_TYPE == IS_CONST || UNEXPECTED(Z_TYPE_P(value) != IS_OBJECT)) { |
zend_error_noreturn(E_ERROR, "Can only throw objects"); |
zend_error_noreturn(E_ERROR, "Can only throw objects"); |
} |
} |
zend_exception_save(TSRMLS_C); |
zend_exception_save(TSRMLS_C); |
Line 2554 ZEND_VM_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY
|
Line 2959 ZEND_VM_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY
|
zend_throw_exception_object(exception TSRMLS_CC); |
zend_throw_exception_object(exception TSRMLS_CC); |
zend_exception_restore(TSRMLS_C); |
zend_exception_restore(TSRMLS_C); |
FREE_OP1_IF_VAR(); |
FREE_OP1_IF_VAR(); |
ZEND_VM_NEXT_OPCODE(); | HANDLE_EXCEPTION(); |
} |
} |
|
|
ZEND_VM_HANDLER(107, ZEND_CATCH, ANY, CV) | ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_class_entry *ce; | zend_class_entry *ce, *catch_ce; |
| zval *exception; |
|
|
|
SAVE_OPLINE(); |
/* Check whether an exception has been thrown, if not, jump over code */ |
/* Check whether an exception has been thrown, if not, jump over code */ |
zend_exception_restore(TSRMLS_C); |
zend_exception_restore(TSRMLS_C); |
if (EG(exception) == NULL) { |
if (EG(exception) == NULL) { |
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->extended_value]); |
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->extended_value]); |
ZEND_VM_CONTINUE(); /* CHECK_ME */ |
ZEND_VM_CONTINUE(); /* CHECK_ME */ |
} |
} |
|
if (CACHED_PTR(opline->op1.literal->cache_slot)) { |
|
catch_ce = CACHED_PTR(opline->op1.literal->cache_slot); |
|
} else { |
|
catch_ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD TSRMLS_CC); |
|
|
|
CACHE_PTR(opline->op1.literal->cache_slot, catch_ce); |
|
} |
ce = Z_OBJCE_P(EG(exception)); |
ce = Z_OBJCE_P(EG(exception)); |
if (ce != EX_T(opline->op1.u.var).class_entry) { | |
if (!instanceof_function(ce, EX_T(opline->op1.u.var).class_entry TSRMLS_CC)) { | #ifdef HAVE_DTRACE |
if (opline->op1.u.EA.type) { | if (DTRACE_EXCEPTION_CAUGHT_ENABLED()) { |
| DTRACE_EXCEPTION_CAUGHT((char *)ce->name); |
| } |
| #endif /* HAVE_DTRACE */ |
| |
| if (ce != catch_ce) { |
| if (!instanceof_function(ce, catch_ce TSRMLS_CC)) { |
| if (opline->result.num) { |
zend_throw_exception_internal(NULL TSRMLS_CC); |
zend_throw_exception_internal(NULL TSRMLS_CC); |
ZEND_VM_NEXT_OPCODE(); | HANDLE_EXCEPTION(); |
} |
} |
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->extended_value]); |
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->extended_value]); |
ZEND_VM_CONTINUE(); /* CHECK_ME */ |
ZEND_VM_CONTINUE(); /* CHECK_ME */ |
} |
} |
} |
} |
|
|
|
exception = EG(exception); |
if (!EG(active_symbol_table)) { |
if (!EG(active_symbol_table)) { |
if (EX(CVs)[opline->op2.u.var]) { | if (EX_CV(opline->op2.var)) { |
zval_ptr_dtor(EX(CVs)[opline->op2.u.var]); | zval_ptr_dtor(EX_CV(opline->op2.var)); |
} |
} |
EX(CVs)[opline->op2.u.var] = (zval**)EX(CVs) + (EX(op_array)->last_var + opline->op2.u.var); | EX_CV(opline->op2.var) = (zval**)EX_CVs() + (EX(op_array)->last_var + opline->op2.var); |
*EX(CVs)[opline->op2.u.var] = EG(exception); | *EX_CV(opline->op2.var) = EG(exception); |
} else { |
} else { |
zend_compiled_variable *cv = &CV_DEF_OF(opline->op2.u.var); | zend_compiled_variable *cv = &CV_DEF_OF(opline->op2.var); |
zend_hash_quick_update(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, |
zend_hash_quick_update(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, |
&EG(exception), sizeof(zval *), (void**)&EX(CVs)[opline->op2.u.var]); | &EG(exception), sizeof(zval *), (void**)&EX_CV(opline->op2.var)); |
} |
} |
EG(exception) = NULL; | if (UNEXPECTED(EG(exception) != exception)) { |
ZEND_VM_NEXT_OPCODE(); | Z_ADDREF_P(EG(exception)); |
| HANDLE_EXCEPTION(); |
| } else { |
| EG(exception) = NULL; |
| ZEND_VM_NEXT_OPCODE(); |
| } |
} |
} |
|
|
ZEND_VM_HANDLER(65, ZEND_SEND_VAL, CONST|TMP|VAR|CV, ANY) | ZEND_VM_HANDLER(65, ZEND_SEND_VAL, CONST|TMP, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
| |
| SAVE_OPLINE(); |
if (opline->extended_value==ZEND_DO_FCALL_BY_NAME |
if (opline->extended_value==ZEND_DO_FCALL_BY_NAME |
&& ARG_MUST_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) { | && ARG_MUST_BE_SENT_BY_REF(EX(fbc), opline->op2.opline_num)) { |
zend_error_noreturn(E_ERROR, "Cannot pass parameter %d by reference", opline->op2.u.opline_num); | zend_error_noreturn(E_ERROR, "Cannot pass parameter %d by reference", opline->op2.opline_num); |
} |
} |
{ |
{ |
zval *valptr; |
zval *valptr; |
Line 2617 ZEND_VM_HANDLER(65, ZEND_SEND_VAL, CONST|TMP|VAR|CV, A
|
Line 3046 ZEND_VM_HANDLER(65, ZEND_SEND_VAL, CONST|TMP|VAR|CV, A
|
zend_vm_stack_push(valptr TSRMLS_CC); |
zend_vm_stack_push(valptr TSRMLS_CC); |
FREE_OP1_IF_VAR(); |
FREE_OP1_IF_VAR(); |
} |
} |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HELPER(zend_send_by_var_helper, VAR|CV, ANY) |
ZEND_VM_HELPER(zend_send_by_var_helper, VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zval *varptr; |
zval *varptr; |
zend_free_op free_op1; |
zend_free_op free_op1; |
varptr = GET_OP1_ZVAL_PTR(BP_VAR_R); |
varptr = GET_OP1_ZVAL_PTR(BP_VAR_R); |
Line 2635 ZEND_VM_HELPER(zend_send_by_var_helper, VAR|CV, ANY)
|
Line 3065 ZEND_VM_HELPER(zend_send_by_var_helper, VAR|CV, ANY)
|
zval *original_var = varptr; |
zval *original_var = varptr; |
|
|
ALLOC_ZVAL(varptr); |
ALLOC_ZVAL(varptr); |
*varptr = *original_var; | ZVAL_COPY_VALUE(varptr, original_var); |
Z_UNSET_ISREF_P(varptr); |
Z_UNSET_ISREF_P(varptr); |
Z_SET_REFCOUNT_P(varptr, 0); |
Z_SET_REFCOUNT_P(varptr, 0); |
zval_copy_ctor(varptr); |
zval_copy_ctor(varptr); |
Line 2644 ZEND_VM_HELPER(zend_send_by_var_helper, VAR|CV, ANY)
|
Line 3074 ZEND_VM_HELPER(zend_send_by_var_helper, VAR|CV, ANY)
|
zend_vm_stack_push(varptr TSRMLS_CC); |
zend_vm_stack_push(varptr TSRMLS_CC); |
FREE_OP1(); /* for string offsets */ |
FREE_OP1(); /* for string offsets */ |
|
|
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY) |
ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval *varptr; |
zval *varptr; |
|
|
|
SAVE_OPLINE(); |
if (opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) { /* Had function_ptr at compile_time */ |
if (opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) { /* Had function_ptr at compile_time */ |
if (!(opline->extended_value & ZEND_ARG_SEND_BY_REF)) { |
if (!(opline->extended_value & ZEND_ARG_SEND_BY_REF)) { |
ZEND_VM_DISPATCH_TO_HELPER(zend_send_by_var_helper); |
ZEND_VM_DISPATCH_TO_HELPER(zend_send_by_var_helper); |
} |
} |
} else if (!ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) { | } else if (!ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->op2.opline_num)) { |
ZEND_VM_DISPATCH_TO_HELPER(zend_send_by_var_helper); |
ZEND_VM_DISPATCH_TO_HELPER(zend_send_by_var_helper); |
} |
} |
|
|
if (OP1_TYPE == IS_VAR && |
if (OP1_TYPE == IS_VAR && |
(opline->extended_value & ZEND_ARG_SEND_FUNCTION) && |
(opline->extended_value & ZEND_ARG_SEND_FUNCTION) && |
EX_T(opline->op1.u.var).var.fcall_returned_reference && | EX_T(opline->op1.var).var.fcall_returned_reference && |
EX_T(opline->op1.u.var).var.ptr) { | EX_T(opline->op1.var).var.ptr) { |
varptr = EX_T(opline->op1.u.var).var.ptr; | varptr = EX_T(opline->op1.var).var.ptr; |
PZVAL_UNLOCK_EX(varptr, &free_op1, 0); |
PZVAL_UNLOCK_EX(varptr, &free_op1, 0); |
} else { |
} else { |
varptr = GET_OP1_ZVAL_PTR(BP_VAR_R); |
varptr = GET_OP1_ZVAL_PTR(BP_VAR_R); |
} |
} |
if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) || |
if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) || |
EX_T(opline->op1.u.var).var.fcall_returned_reference) && | EX_T(opline->op1.var).var.fcall_returned_reference) && |
varptr != &EG(uninitialized_zval) && |
varptr != &EG(uninitialized_zval) && |
(PZVAL_IS_REF(varptr) || |
(PZVAL_IS_REF(varptr) || |
(Z_REFCOUNT_P(varptr) == 1 && (OP1_TYPE == IS_CV || free_op1.var)))) { |
(Z_REFCOUNT_P(varptr) == 1 && (OP1_TYPE == IS_CV || free_op1.var)))) { |
Line 2683 ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY
|
Line 3115 ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY
|
|
|
if ((opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) ? |
if ((opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) ? |
!(opline->extended_value & ZEND_ARG_SEND_SILENT) : |
!(opline->extended_value & ZEND_ARG_SEND_SILENT) : |
!ARG_MAY_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) { | !ARG_MAY_BE_SENT_BY_REF(EX(fbc), opline->op2.opline_num)) { |
zend_error(E_STRICT, "Only variables should be passed by reference"); |
zend_error(E_STRICT, "Only variables should be passed by reference"); |
} |
} |
ALLOC_ZVAL(valptr); |
ALLOC_ZVAL(valptr); |
Line 2694 ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY
|
Line 3126 ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY
|
zend_vm_stack_push(valptr TSRMLS_CC); |
zend_vm_stack_push(valptr TSRMLS_CC); |
} |
} |
FREE_OP1_IF_VAR(); |
FREE_OP1_IF_VAR(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(67, ZEND_SEND_REF, VAR|CV, ANY) |
ZEND_VM_HANDLER(67, ZEND_SEND_REF, VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval **varptr_ptr; |
zval **varptr_ptr; |
zval *varptr; |
zval *varptr; |
|
|
|
SAVE_OPLINE(); |
varptr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); |
varptr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); |
|
|
if (OP1_TYPE == IS_VAR && !varptr_ptr) { | if (OP1_TYPE == IS_VAR && UNEXPECTED(varptr_ptr == NULL)) { |
zend_error_noreturn(E_ERROR, "Only variables can be passed by reference"); |
zend_error_noreturn(E_ERROR, "Only variables can be passed by reference"); |
} |
} |
|
|
if (OP1_TYPE == IS_VAR && *varptr_ptr == EG(error_zval_ptr)) { | if (OP1_TYPE == IS_VAR && UNEXPECTED(*varptr_ptr == &EG(error_zval))) { |
ALLOC_INIT_ZVAL(varptr); |
ALLOC_INIT_ZVAL(varptr); |
zend_vm_stack_push(varptr TSRMLS_CC); |
zend_vm_stack_push(varptr TSRMLS_CC); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION && !ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) { | if (opline->extended_value == ZEND_DO_FCALL_BY_NAME && |
| EX(function_state).function->type == ZEND_INTERNAL_FUNCTION && |
| !ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->op2.opline_num)) { |
ZEND_VM_DISPATCH_TO_HELPER(zend_send_by_var_helper); |
ZEND_VM_DISPATCH_TO_HELPER(zend_send_by_var_helper); |
} |
} |
|
|
Line 2725 ZEND_VM_HANDLER(67, ZEND_SEND_REF, VAR|CV, ANY)
|
Line 3163 ZEND_VM_HANDLER(67, ZEND_SEND_REF, VAR|CV, ANY)
|
zend_vm_stack_push(varptr TSRMLS_CC); |
zend_vm_stack_push(varptr TSRMLS_CC); |
|
|
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(66, ZEND_SEND_VAR, VAR|CV, ANY) |
ZEND_VM_HANDLER(66, ZEND_SEND_VAR, VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
|
|
if ((opline->extended_value == ZEND_DO_FCALL_BY_NAME) |
if ((opline->extended_value == ZEND_DO_FCALL_BY_NAME) |
&& ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) { | && ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->op2.opline_num)) { |
ZEND_VM_DISPATCH_TO_HANDLER(ZEND_SEND_REF); |
ZEND_VM_DISPATCH_TO_HANDLER(ZEND_SEND_REF); |
} |
} |
|
SAVE_OPLINE(); |
ZEND_VM_DISPATCH_TO_HELPER(zend_send_by_var_helper); |
ZEND_VM_DISPATCH_TO_HELPER(zend_send_by_var_helper); |
} |
} |
|
|
ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY) |
ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_uint arg_num = Z_LVAL(opline->op1.u.constant); | zend_uint arg_num = opline->op1.num; |
zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC); |
zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC); |
|
|
if (param == NULL) { | SAVE_OPLINE(); |
char *space; | if (UNEXPECTED(param == NULL)) { |
char *class_name = get_active_class_name(&space TSRMLS_CC); | |
zend_execute_data *ptr = EX(prev_execute_data); | |
| |
if (zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL, opline->extended_value TSRMLS_CC)) { |
if (zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL, opline->extended_value TSRMLS_CC)) { |
|
const char *space; |
|
const char *class_name; |
|
zend_execute_data *ptr; |
|
|
|
if (EG(active_op_array)->scope) { |
|
class_name = EG(active_op_array)->scope->name; |
|
space = "::"; |
|
} else { |
|
class_name = space = ""; |
|
} |
|
ptr = EX(prev_execute_data); |
|
|
if(ptr && ptr->op_array) { |
if(ptr && ptr->op_array) { |
zend_error(E_WARNING, "Missing argument %ld for %s%s%s(), called in %s on line %d and defined", opline->op1.u.constant.value.lval, class_name, space, get_active_function_name(TSRMLS_C), ptr->op_array->filename, ptr->opline->lineno); | zend_error(E_WARNING, "Missing argument %u for %s%s%s(), called in %s on line %d and defined", opline->op1.num, class_name, space, get_active_function_name(TSRMLS_C), ptr->op_array->filename, ptr->opline->lineno); |
} else { |
} else { |
zend_error(E_WARNING, "Missing argument %ld for %s%s%s()", opline->op1.u.constant.value.lval, class_name, space, get_active_function_name(TSRMLS_C)); | zend_error(E_WARNING, "Missing argument %u for %s%s%s()", opline->op1.num, class_name, space, get_active_function_name(TSRMLS_C)); |
} |
} |
} |
} |
if (opline->result.op_type == IS_VAR) { |
|
PZVAL_UNLOCK_FREE(*EX_T(opline->result.u.var).var.ptr_ptr); |
|
} |
|
} else { |
} else { |
zend_free_op free_res; |
|
zval **var_ptr; |
zval **var_ptr; |
|
|
zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC); |
zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC); |
var_ptr = get_zval_ptr_ptr(&opline->result, EX(Ts), &free_res, BP_VAR_W); | var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->result.var TSRMLS_CC); |
Z_DELREF_PP(var_ptr); |
Z_DELREF_PP(var_ptr); |
*var_ptr = *param; |
*var_ptr = *param; |
Z_ADDREF_PP(var_ptr); |
Z_ADDREF_PP(var_ptr); |
} |
} |
|
|
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST) |
ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zval *assignment_value; |
zval *assignment_value; |
zend_uint arg_num = Z_LVAL(opline->op1.u.constant); | zend_uint arg_num = opline->op1.num; |
zend_free_op free_res; | |
zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC); |
zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC); |
zval **var_ptr; |
zval **var_ptr; |
|
|
|
SAVE_OPLINE(); |
if (param == NULL) { |
if (param == NULL) { |
ALLOC_ZVAL(assignment_value); |
ALLOC_ZVAL(assignment_value); |
*assignment_value = opline->op2.u.constant; | *assignment_value = *opline->op2.zv; |
if ((Z_TYPE(opline->op2.u.constant) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT || Z_TYPE(opline->op2.u.constant)==IS_CONSTANT_ARRAY) { | if ((Z_TYPE_P(assignment_value) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT || |
| Z_TYPE_P(assignment_value)==IS_CONSTANT_ARRAY) { |
Z_SET_REFCOUNT_P(assignment_value, 1); |
Z_SET_REFCOUNT_P(assignment_value, 1); |
zval_update_constant(&assignment_value, 0 TSRMLS_CC); |
zval_update_constant(&assignment_value, 0 TSRMLS_CC); |
} else { |
} else { |
Line 2799 ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST)
|
Line 3246 ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST)
|
} |
} |
|
|
zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC); |
zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC); |
var_ptr = get_zval_ptr_ptr(&opline->result, EX(Ts), &free_res, BP_VAR_W); | var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->result.var TSRMLS_CC); |
Z_DELREF_PP(var_ptr); | zval_ptr_dtor(var_ptr); |
*var_ptr = assignment_value; |
*var_ptr = assignment_value; |
|
|
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(52, ZEND_BOOL, CONST|TMP|VAR|CV, ANY) |
ZEND_VM_HANDLER(52, ZEND_BOOL, CONST|TMP|VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
|
zval *retval = &EX_T(opline->result.var).tmp_var; |
|
|
|
SAVE_OPLINE(); |
/* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */ |
/* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */ |
Z_LVAL(EX_T(opline->result.u.var).tmp_var) = i_zend_is_true(GET_OP1_ZVAL_PTR(BP_VAR_R)); | ZVAL_BOOL(retval, i_zend_is_true(GET_OP1_ZVAL_PTR(BP_VAR_R))); |
Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; | |
FREE_OP1(); |
FREE_OP1(); |
|
|
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(50, ZEND_BRK, ANY, CONST|TMP|VAR|CV) | ZEND_VM_HANDLER(50, ZEND_BRK, ANY, CONST) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op2; | |
zend_brk_cont_element *el; |
zend_brk_cont_element *el; |
|
|
el = zend_brk_cont(GET_OP2_ZVAL_PTR(BP_VAR_R), opline->op1.u.opline_num, | SAVE_OPLINE(); |
EX(op_array), EX(Ts) TSRMLS_CC); | el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num, |
FREE_OP2(); | EX(op_array), EX_Ts() TSRMLS_CC); |
ZEND_VM_JMP(EX(op_array)->opcodes + el->brk); |
ZEND_VM_JMP(EX(op_array)->opcodes + el->brk); |
} |
} |
|
|
ZEND_VM_HANDLER(51, ZEND_CONT, ANY, CONST|TMP|VAR|CV) | ZEND_VM_HANDLER(51, ZEND_CONT, ANY, CONST) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op2; | |
zend_brk_cont_element *el; |
zend_brk_cont_element *el; |
|
|
el = zend_brk_cont(GET_OP2_ZVAL_PTR(BP_VAR_R), opline->op1.u.opline_num, | SAVE_OPLINE(); |
EX(op_array), EX(Ts) TSRMLS_CC); | el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num, |
FREE_OP2(); | EX(op_array), EX_Ts() TSRMLS_CC); |
ZEND_VM_JMP(EX(op_array)->opcodes + el->cont); |
ZEND_VM_JMP(EX(op_array)->opcodes + el->cont); |
} |
} |
|
|
ZEND_VM_HANDLER(100, ZEND_GOTO, ANY, CONST) |
ZEND_VM_HANDLER(100, ZEND_GOTO, ANY, CONST) |
{ |
{ |
zend_op *brk_opline; |
zend_op *brk_opline; |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_brk_cont_element *el; |
zend_brk_cont_element *el; |
|
|
el = zend_brk_cont(&opline->op2.u.constant, opline->extended_value, | SAVE_OPLINE(); |
EX(op_array), EX(Ts) TSRMLS_CC); | el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->extended_value, |
| EX(op_array), EX_Ts() TSRMLS_CC); |
|
|
brk_opline = EX(op_array)->opcodes + el->brk; |
brk_opline = EX(op_array)->opcodes + el->brk; |
|
|
switch (brk_opline->opcode) { |
switch (brk_opline->opcode) { |
case ZEND_SWITCH_FREE: |
case ZEND_SWITCH_FREE: |
if (brk_opline->op1.u.EA.type != EXT_TYPE_FREE_ON_RETURN) { | if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { |
zend_switch_free(&EX_T(brk_opline->op1.u.var), brk_opline->extended_value TSRMLS_CC); | zval_ptr_dtor(&EX_T(brk_opline->op1.var).var.ptr); |
} |
} |
break; |
break; |
case ZEND_FREE: |
case ZEND_FREE: |
if (brk_opline->op1.u.EA.type != EXT_TYPE_FREE_ON_RETURN) { | if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { |
zendi_zval_dtor(EX_T(brk_opline->op1.u.var).tmp_var); | zendi_zval_dtor(EX_T(brk_opline->op1.var).tmp_var); |
} |
} |
break; |
break; |
} |
} |
ZEND_VM_JMP(opline->op1.u.jmp_addr); | ZEND_VM_JMP(opline->op1.jmp_addr); |
} |
} |
|
|
ZEND_VM_HANDLER(48, ZEND_CASE, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(48, ZEND_CASE, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
int switch_expr_is_overloaded=0; | |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
|
|
|
SAVE_OPLINE(); |
if (OP1_TYPE==IS_VAR) { |
if (OP1_TYPE==IS_VAR) { |
if (EX_T(opline->op1.u.var).var.ptr_ptr) { | PZVAL_LOCK(EX_T(opline->op1.var).var.ptr); |
PZVAL_LOCK(EX_T(opline->op1.u.var).var.ptr); | |
} else { | |
switch_expr_is_overloaded = 1; | |
Z_ADDREF_P(EX_T(opline->op1.u.var).str_offset.str); | |
} | |
} |
} |
is_equal_function(&EX_T(opline->result.u.var).tmp_var, | is_equal_function(&EX_T(opline->result.var).tmp_var, |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP1_ZVAL_PTR(BP_VAR_R), |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
GET_OP2_ZVAL_PTR(BP_VAR_R) TSRMLS_CC); |
|
|
FREE_OP2(); |
FREE_OP2(); |
if (switch_expr_is_overloaded) { | CHECK_EXCEPTION(); |
/* We only free op1 if this is a string offset, | |
* Since if it is a TMP_VAR, it'll be reused by | |
* other CASE opcodes (whereas string offsets | |
* are allocated at each get_zval_ptr()) | |
*/ | |
FREE_OP1(); | |
EX_T(opline->op1.u.var).var.ptr_ptr = NULL; | |
EX_T(opline->op1.u.var).var.ptr = NULL; | |
} | |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(49, ZEND_SWITCH_FREE, VAR, ANY) |
ZEND_VM_HANDLER(49, ZEND_SWITCH_FREE, VAR, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
|
|
zend_switch_free(&EX_T(opline->op1.u.var), opline->extended_value TSRMLS_CC); | SAVE_OPLINE(); |
| zval_ptr_dtor(&EX_T(opline->op1.var).var.ptr); |
| CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(68, ZEND_NEW, ANY, ANY) |
ZEND_VM_HANDLER(68, ZEND_NEW, ANY, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zval *object_zval; |
zval *object_zval; |
zend_function *constructor; |
zend_function *constructor; |
|
|
if (EX_T(opline->op1.u.var).class_entry->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) { | SAVE_OPLINE(); |
char *class_type; | if (UNEXPECTED((EX_T(opline->op1.var).class_entry->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) != 0)) { |
| if (EX_T(opline->op1.var).class_entry->ce_flags & ZEND_ACC_INTERFACE) { |
if (EX_T(opline->op1.u.var).class_entry->ce_flags & ZEND_ACC_INTERFACE) { | zend_error_noreturn(E_ERROR, "Cannot instantiate interface %s", EX_T(opline->op1.var).class_entry->name); |
class_type = "interface"; | } else if ((EX_T(opline->op1.var).class_entry->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) { |
| zend_error_noreturn(E_ERROR, "Cannot instantiate trait %s", EX_T(opline->op1.var).class_entry->name); |
} else { |
} else { |
class_type = "abstract class"; | zend_error_noreturn(E_ERROR, "Cannot instantiate abstract class %s", EX_T(opline->op1.var).class_entry->name); |
} |
} |
zend_error_noreturn(E_ERROR, "Cannot instantiate %s %s", class_type, EX_T(opline->op1.u.var).class_entry->name); |
|
} |
} |
ALLOC_ZVAL(object_zval); |
ALLOC_ZVAL(object_zval); |
object_init_ex(object_zval, EX_T(opline->op1.u.var).class_entry); | object_init_ex(object_zval, EX_T(opline->op1.var).class_entry); |
INIT_PZVAL(object_zval); |
INIT_PZVAL(object_zval); |
|
|
constructor = Z_OBJ_HT_P(object_zval)->get_constructor(object_zval TSRMLS_CC); |
constructor = Z_OBJ_HT_P(object_zval)->get_constructor(object_zval TSRMLS_CC); |
|
|
if (constructor == NULL) { |
if (constructor == NULL) { |
if (RETURN_VALUE_USED(opline)) { |
if (RETURN_VALUE_USED(opline)) { |
AI_SET_PTR(EX_T(opline->result.u.var).var, object_zval); | AI_SET_PTR(&EX_T(opline->result.var), object_zval); |
} else { |
} else { |
zval_ptr_dtor(&object_zval); |
zval_ptr_dtor(&object_zval); |
} |
} |
ZEND_VM_JMP(EX(op_array)->opcodes + opline->op2.u.opline_num); | ZEND_VM_JMP(EX(op_array)->opcodes + opline->op2.opline_num); |
} else { |
} else { |
if (RETURN_VALUE_USED(opline)) { |
if (RETURN_VALUE_USED(opline)) { |
AI_SET_PTR(EX_T(opline->result.u.var).var, object_zval); |
|
PZVAL_LOCK(object_zval); |
PZVAL_LOCK(object_zval); |
|
AI_SET_PTR(&EX_T(opline->result.var), object_zval); |
} |
} |
|
|
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), ENCODE_CTOR(EX(called_scope), RETURN_VALUE_USED(opline))); |
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), ENCODE_CTOR(EX(called_scope), RETURN_VALUE_USED(opline))); |
Line 2949 ZEND_VM_HANDLER(68, ZEND_NEW, ANY, ANY)
|
Line 3386 ZEND_VM_HANDLER(68, ZEND_NEW, ANY, ANY)
|
/* We are not handling overloaded classes right now */ |
/* We are not handling overloaded classes right now */ |
EX(object) = object_zval; |
EX(object) = object_zval; |
EX(fbc) = constructor; |
EX(fbc) = constructor; |
EX(called_scope) = EX_T(opline->op1.u.var).class_entry; | EX(called_scope) = EX_T(opline->op1.var).class_entry; |
|
|
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
} |
} |
|
|
ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMP|VAR|UNUSED|CV, ANY) |
ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMP|VAR|UNUSED|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval *obj = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_R); | zval *obj; |
zend_class_entry *ce; |
zend_class_entry *ce; |
zend_function *clone; |
zend_function *clone; |
zend_object_clone_obj_t clone_call; |
zend_object_clone_obj_t clone_call; |
|
|
|
SAVE_OPLINE(); |
|
obj = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_R); |
|
|
if (OP1_TYPE == IS_CONST || |
if (OP1_TYPE == IS_CONST || |
(OP1_TYPE == IS_VAR && !obj) || | UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT)) { |
Z_TYPE_P(obj) != IS_OBJECT) { | |
zend_error_noreturn(E_ERROR, "__clone method called on non-object"); |
zend_error_noreturn(E_ERROR, "__clone method called on non-object"); |
} |
} |
|
|
ce = Z_OBJCE_P(obj); |
ce = Z_OBJCE_P(obj); |
clone = ce ? ce->clone : NULL; |
clone = ce ? ce->clone : NULL; |
clone_call = Z_OBJ_HT_P(obj)->clone_obj; |
clone_call = Z_OBJ_HT_P(obj)->clone_obj; |
if (!clone_call) { | if (UNEXPECTED(clone_call == NULL)) { |
if (ce) { |
if (ce) { |
zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %s", ce->name); |
zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %s", ce->name); |
} else { |
} else { |
Line 2985 ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMP|VAR|UNUSED|
|
Line 3425 ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMP|VAR|UNUSED|
|
if (clone->op_array.fn_flags & ZEND_ACC_PRIVATE) { |
if (clone->op_array.fn_flags & ZEND_ACC_PRIVATE) { |
/* Ensure that if we're calling a private function, we're allowed to do so. |
/* Ensure that if we're calling a private function, we're allowed to do so. |
*/ |
*/ |
if (ce != EG(scope)) { | if (UNEXPECTED(ce != EG(scope))) { |
zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : ""); |
zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : ""); |
} |
} |
} else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) { |
} else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) { |
/* Ensure that if we're calling a protected function, we're allowed to do so. |
/* Ensure that if we're calling a protected function, we're allowed to do so. |
*/ |
*/ |
if (!zend_check_protected(clone->common.scope, EG(scope))) { | if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) { |
zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : ""); |
zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : ""); |
} |
} |
} |
} |
} |
} |
|
|
EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; | if (EXPECTED(EG(exception) == NULL)) { |
if (!EG(exception)) { | zval *retval; |
ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); | |
Z_OBJVAL_P(EX_T(opline->result.u.var).var.ptr) = clone_call(obj TSRMLS_CC); | ALLOC_ZVAL(retval); |
Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_OBJECT; | Z_OBJVAL_P(retval) = clone_call(obj TSRMLS_CC); |
Z_SET_REFCOUNT_P(EX_T(opline->result.u.var).var.ptr, 1); | Z_TYPE_P(retval) = IS_OBJECT; |
Z_SET_ISREF_P(EX_T(opline->result.u.var).var.ptr); | Z_SET_REFCOUNT_P(retval, 1); |
if (!RETURN_VALUE_USED(opline) || EG(exception)) { | Z_SET_ISREF_P(retval); |
zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr); | if (!RETURN_VALUE_USED(opline) || UNEXPECTED(EG(exception) != NULL)) { |
| zval_ptr_dtor(&retval); |
| } else { |
| AI_SET_PTR(&EX_T(opline->result.var), retval); |
} |
} |
} |
} |
FREE_OP1_IF_VAR(); |
FREE_OP1_IF_VAR(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST) |
ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
|
|
|
SAVE_OPLINE(); |
if (OP1_TYPE == IS_UNUSED) { |
if (OP1_TYPE == IS_UNUSED) { |
/* namespaced constant */ | zend_constant *c; |
if (!zend_get_constant_ex(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var, NULL, opline->extended_value TSRMLS_CC)) { | zval *retval; |
| |
| if (CACHED_PTR(opline->op2.literal->cache_slot)) { |
| c = CACHED_PTR(opline->op2.literal->cache_slot); |
| } else if ((c = zend_quick_get_constant(opline->op2.literal + 1, opline->extended_value TSRMLS_CC)) == NULL) { |
if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) { |
if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) { |
char *actual = (char *)zend_memrchr(Z_STRVAL(opline->op2.u.constant), '\\', Z_STRLEN(opline->op2.u.constant)); | char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv)); |
if(!actual) { |
if(!actual) { |
actual = Z_STRVAL(opline->op2.u.constant); | actual = Z_STRVAL_P(opline->op2.zv); |
} else { |
} else { |
actual++; |
actual++; |
} |
} |
/* non-qualified constant - allow text substitution */ |
/* non-qualified constant - allow text substitution */ |
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); |
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); |
ZVAL_STRINGL(&EX_T(opline->result.u.var).tmp_var, actual, Z_STRLEN(opline->op2.u.constant)-(actual - Z_STRVAL(opline->op2.u.constant)), 1); | ZVAL_STRINGL(&EX_T(opline->result.var).tmp_var, actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)), 1); |
| CHECK_EXCEPTION(); |
| ZEND_VM_NEXT_OPCODE(); |
} else { |
} else { |
zend_error_noreturn(E_ERROR, "Undefined constant '%s'", | zend_error_noreturn(E_ERROR, "Undefined constant '%s'", Z_STRVAL_P(opline->op2.zv)); |
Z_STRVAL(opline->op2.u.constant), Z_STRVAL(opline->op2.u.constant)); | |
} |
} |
|
} else { |
|
CACHE_PTR(opline->op2.literal->cache_slot, c); |
} |
} |
|
retval = &EX_T(opline->result.var).tmp_var; |
|
ZVAL_COPY_VALUE(retval, &c->value); |
|
zval_copy_ctor(retval); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} else { |
} else { |
/* class constant */ |
/* class constant */ |
Line 3041 ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNU
|
Line 3497 ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNU
|
zval **value; |
zval **value; |
|
|
if (OP1_TYPE == IS_CONST) { |
if (OP1_TYPE == IS_CONST) { |
| if (CACHED_PTR(opline->op2.literal->cache_slot)) { |
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC); | value = CACHED_PTR(opline->op2.literal->cache_slot); |
if (!ce) { | ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value); |
zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL(opline->op2.u.constant)); | zval_copy_ctor(&EX_T(opline->result.var).tmp_var); |
| CHECK_EXCEPTION(); |
| ZEND_VM_NEXT_OPCODE(); |
| } else if (CACHED_PTR(opline->op1.literal->cache_slot)) { |
| ce = CACHED_PTR(opline->op1.literal->cache_slot); |
| } else { |
| ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), opline->op1.literal + 1, opline->extended_value TSRMLS_CC); |
| if (UNEXPECTED(EG(exception) != NULL)) { |
| HANDLE_EXCEPTION(); |
| } |
| if (UNEXPECTED(ce == NULL)) { |
| zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv)); |
| } |
| CACHE_PTR(opline->op1.literal->cache_slot, ce); |
} |
} |
} else { |
} else { |
ce = EX_T(opline->op1.u.var).class_entry; | ce = EX_T(opline->op1.var).class_entry; |
| if ((value = CACHED_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce)) != NULL) { |
| ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value); |
| zval_copy_ctor(&EX_T(opline->result.var).tmp_var); |
| CHECK_EXCEPTION(); |
| ZEND_VM_NEXT_OPCODE(); |
| } |
} |
} |
|
|
if (zend_hash_find(&ce->constants_table, Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)+1, (void **) &value) == SUCCESS) { | if (EXPECTED(zend_hash_quick_find(&ce->constants_table, Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void **) &value) == SUCCESS)) { |
if (Z_TYPE_PP(value) == IS_CONSTANT_ARRAY || |
if (Z_TYPE_PP(value) == IS_CONSTANT_ARRAY || |
(Z_TYPE_PP(value) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { |
(Z_TYPE_PP(value) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) { |
zend_class_entry *old_scope = EG(scope); |
zend_class_entry *old_scope = EG(scope); |
Line 3059 ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNU
|
Line 3534 ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNU
|
zval_update_constant(value, (void *) 1 TSRMLS_CC); |
zval_update_constant(value, (void *) 1 TSRMLS_CC); |
EG(scope) = old_scope; |
EG(scope) = old_scope; |
} |
} |
EX_T(opline->result.u.var).tmp_var = **value; | if (OP1_TYPE == IS_CONST) { |
zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); | CACHE_PTR(opline->op2.literal->cache_slot, value); |
| } else { |
| CACHE_POLYMORPHIC_PTR(opline->op2.literal->cache_slot, ce, value); |
| } |
| ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, *value); |
| zval_copy_ctor(&EX_T(opline->result.var).tmp_var); |
} else { |
} else { |
zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL(opline->op2.u.constant)); | zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv)); |
} |
} |
|
|
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
} |
} |
|
|
ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMP|VAR|UNUSED|CV) |
ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMP|VAR|UNUSED|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; | zend_free_op free_op1; |
zval *array_ptr = &EX_T(opline->result.u.var).tmp_var; | |
zval *expr_ptr; |
zval *expr_ptr; |
zval *offset=GET_OP2_ZVAL_PTR(BP_VAR_R); |
|
|
|
#if !defined(ZEND_VM_SPEC) || OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV | SAVE_OPLINE(); |
zval **expr_ptr_ptr = NULL; | if ((OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) && opline->extended_value) { |
| zval **expr_ptr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); |
|
|
if (opline->extended_value) { | if (OP1_TYPE == IS_VAR && UNEXPECTED(expr_ptr_ptr == NULL)) { |
expr_ptr_ptr=GET_OP1_ZVAL_PTR_PTR(BP_VAR_W); | zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets"); |
| } |
| SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); |
expr_ptr = *expr_ptr_ptr; |
expr_ptr = *expr_ptr_ptr; |
|
Z_ADDREF_P(expr_ptr); |
} else { |
} else { |
expr_ptr=GET_OP1_ZVAL_PTR(BP_VAR_R); |
expr_ptr=GET_OP1_ZVAL_PTR(BP_VAR_R); |
} | if (IS_OP1_TMP_FREE()) { /* temporary variable */ |
#else | zval *new_expr; |
expr_ptr=GET_OP1_ZVAL_PTR(BP_VAR_R); | |
#endif | |
|
|
if (IS_OP1_TMP_FREE()) { /* temporary variable */ | ALLOC_ZVAL(new_expr); |
zval *new_expr; | INIT_PZVAL_COPY(new_expr, expr_ptr); |
| expr_ptr = new_expr; |
ALLOC_ZVAL(new_expr); | } else if (OP1_TYPE == IS_CONST || PZVAL_IS_REF(expr_ptr)) { |
INIT_PZVAL_COPY(new_expr, expr_ptr); | |
expr_ptr = new_expr; | |
} else { | |
#if !defined(ZEND_VM_SPEC) || OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV | |
if (opline->extended_value) { | |
SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); | |
expr_ptr = *expr_ptr_ptr; | |
Z_ADDREF_P(expr_ptr); | |
} else | |
#endif | |
if (OP1_TYPE == IS_CONST || PZVAL_IS_REF(expr_ptr)) { | |
zval *new_expr; |
zval *new_expr; |
|
|
ALLOC_ZVAL(new_expr); |
ALLOC_ZVAL(new_expr); |
Line 3115 ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|
|
Line 3585 ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|
|
Z_ADDREF_P(expr_ptr); |
Z_ADDREF_P(expr_ptr); |
} |
} |
} |
} |
if (offset) { | |
| if (OP2_TYPE != IS_UNUSED) { |
| zend_free_op free_op2; |
| zval *offset = GET_OP2_ZVAL_PTR(BP_VAR_R); |
| ulong hval; |
| |
switch (Z_TYPE_P(offset)) { |
switch (Z_TYPE_P(offset)) { |
case IS_DOUBLE: |
case IS_DOUBLE: |
zend_hash_index_update(Z_ARRVAL_P(array_ptr), zend_dval_to_lval(Z_DVAL_P(offset)), &expr_ptr, sizeof(zval *), NULL); | hval = zend_dval_to_lval(Z_DVAL_P(offset)); |
break; | ZEND_VM_C_GOTO(num_index); |
case IS_LONG: |
case IS_LONG: |
case IS_BOOL: |
case IS_BOOL: |
zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); | hval = Z_LVAL_P(offset); |
| ZEND_VM_C_LABEL(num_index): |
| zend_hash_index_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), hval, &expr_ptr, sizeof(zval *), NULL); |
break; |
break; |
case IS_STRING: |
case IS_STRING: |
zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); | if (OP2_TYPE == IS_CONST) { |
| hval = Z_HASH_P(offset); |
| } else { |
| ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index)); |
| if (IS_INTERNED(Z_STRVAL_P(offset))) { |
| hval = INTERNED_HASH(Z_STRVAL_P(offset)); |
| } else { |
| hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); |
| } |
| } |
| zend_hash_quick_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, &expr_ptr, sizeof(zval *), NULL); |
break; |
break; |
case IS_NULL: |
case IS_NULL: |
zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); | zend_hash_update(Z_ARRVAL(EX_T(opline->result.var).tmp_var), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); |
break; |
break; |
default: |
default: |
zend_error(E_WARNING, "Illegal offset type"); |
zend_error(E_WARNING, "Illegal offset type"); |
Line 3138 ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|
|
Line 3625 ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|
|
} |
} |
FREE_OP2(); |
FREE_OP2(); |
} else { |
} else { |
zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); | zend_hash_next_index_insert(Z_ARRVAL(EX_T(opline->result.var).tmp_var), &expr_ptr, sizeof(zval *), NULL); |
} |
} |
if (opline->extended_value) { | if ((OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) && opline->extended_value) { |
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
} else { |
} else { |
FREE_OP1_IF_VAR(); |
FREE_OP1_IF_VAR(); |
} |
} |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(71, ZEND_INIT_ARRAY, CONST|TMP|VAR|UNUSED|CV, CONST|TMP|VAR|UNUSED|CV) |
ZEND_VM_HANDLER(71, ZEND_INIT_ARRAY, CONST|TMP|VAR|UNUSED|CV, CONST|TMP|VAR|UNUSED|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
|
|
array_init(&EX_T(opline->result.u.var).tmp_var); | array_init(&EX_T(opline->result.var).tmp_var); |
if (OP1_TYPE == IS_UNUSED) { |
if (OP1_TYPE == IS_UNUSED) { |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
#if !defined(ZEND_VM_SPEC) || OP1_TYPE != IS_UNUSED |
#if !defined(ZEND_VM_SPEC) || OP1_TYPE != IS_UNUSED |
Line 3164 ZEND_VM_HANDLER(71, ZEND_INIT_ARRAY, CONST|TMP|VAR|UNU
|
Line 3652 ZEND_VM_HANDLER(71, ZEND_INIT_ARRAY, CONST|TMP|VAR|UNU
|
|
|
ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY) |
ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval *expr = GET_OP1_ZVAL_PTR(BP_VAR_R); | zval *expr; |
zval *result = &EX_T(opline->result.u.var).tmp_var; | zval *result = &EX_T(opline->result.var).tmp_var; |
|
|
|
SAVE_OPLINE(); |
|
expr = GET_OP1_ZVAL_PTR(BP_VAR_R); |
|
|
if (opline->extended_value != IS_STRING) { |
if (opline->extended_value != IS_STRING) { |
*result = *expr; | ZVAL_COPY_VALUE(result, expr); |
if (!IS_OP1_TMP_FREE()) { |
if (!IS_OP1_TMP_FREE()) { |
zendi_zval_copy_ctor(*result); |
zendi_zval_copy_ctor(*result); |
} |
} |
Line 3194 ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY)
|
Line 3685 ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY)
|
|
|
zend_make_printable_zval(expr, &var_copy, &use_copy); |
zend_make_printable_zval(expr, &var_copy, &use_copy); |
if (use_copy) { |
if (use_copy) { |
*result = var_copy; | ZVAL_COPY_VALUE(result, &var_copy); |
if (IS_OP1_TMP_FREE()) { |
if (IS_OP1_TMP_FREE()) { |
FREE_OP1(); |
FREE_OP1(); |
} |
} |
} else { |
} else { |
*result = *expr; | ZVAL_COPY_VALUE(result, expr); |
if (!IS_OP1_TMP_FREE()) { |
if (!IS_OP1_TMP_FREE()) { |
zendi_zval_copy_ctor(*result); |
zendi_zval_copy_ctor(*result); |
} |
} |
Line 3214 ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY)
|
Line 3705 ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY)
|
break; |
break; |
} |
} |
FREE_OP1_IF_VAR(); |
FREE_OP1_IF_VAR(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY) |
ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_op_array *new_op_array=NULL; |
zend_op_array *new_op_array=NULL; |
int return_value_used; |
|
zend_free_op free_op1; |
zend_free_op free_op1; |
zval *inc_filename = GET_OP1_ZVAL_PTR(BP_VAR_R); | zval *inc_filename; |
zval tmp_inc_filename; | zval *tmp_inc_filename = NULL; |
zend_bool failure_retval=0; |
zend_bool failure_retval=0; |
|
|
|
SAVE_OPLINE(); |
|
inc_filename = GET_OP1_ZVAL_PTR(BP_VAR_R); |
|
|
if (inc_filename->type!=IS_STRING) { |
if (inc_filename->type!=IS_STRING) { |
tmp_inc_filename = *inc_filename; | MAKE_STD_ZVAL(tmp_inc_filename); |
zval_copy_ctor(&tmp_inc_filename); | ZVAL_COPY_VALUE(tmp_inc_filename, inc_filename); |
convert_to_string(&tmp_inc_filename); | zval_copy_ctor(tmp_inc_filename); |
inc_filename = &tmp_inc_filename; | convert_to_string(tmp_inc_filename); |
| inc_filename = tmp_inc_filename; |
} |
} |
|
|
return_value_used = RETURN_VALUE_USED(opline); | if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) { |
| if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) { |
if (Z_LVAL(opline->op2.u.constant) != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) { | |
if (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE || Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE) { | |
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); |
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); |
} else { |
} else { |
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); |
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); |
} |
} |
} else { |
} else { |
switch (Z_LVAL(opline->op2.u.constant)) { | switch (opline->extended_value) { |
case ZEND_INCLUDE_ONCE: |
case ZEND_INCLUDE_ONCE: |
case ZEND_REQUIRE_ONCE: { |
case ZEND_REQUIRE_ONCE: { |
zend_file_handle file_handle; |
zend_file_handle file_handle; |
Line 3265 ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VA
|
Line 3758 ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VA
|
} |
} |
|
|
if (zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1)==SUCCESS) { |
if (zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1)==SUCCESS) { |
new_op_array = zend_compile_file(&file_handle, (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); | new_op_array = zend_compile_file(&file_handle, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC); |
zend_destroy_file_handle(&file_handle TSRMLS_CC); |
zend_destroy_file_handle(&file_handle TSRMLS_CC); |
} else { |
} else { |
zend_file_handle_dtor(&file_handle TSRMLS_CC); |
zend_file_handle_dtor(&file_handle TSRMLS_CC); |
failure_retval=1; |
failure_retval=1; |
} |
} |
} else { |
} else { |
if (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE) { | if (opline->extended_value == ZEND_INCLUDE_ONCE) { |
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); |
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); |
} else { |
} else { |
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); |
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC); |
Line 3285 ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VA
|
Line 3778 ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VA
|
break; |
break; |
case ZEND_INCLUDE: |
case ZEND_INCLUDE: |
case ZEND_REQUIRE: |
case ZEND_REQUIRE: |
new_op_array = compile_filename(Z_LVAL(opline->op2.u.constant), inc_filename TSRMLS_CC); | new_op_array = compile_filename(opline->extended_value, inc_filename TSRMLS_CC); |
break; |
break; |
case ZEND_EVAL: { |
case ZEND_EVAL: { |
char *eval_desc = zend_make_compiled_string_description("eval()'d code" TSRMLS_CC); |
char *eval_desc = zend_make_compiled_string_description("eval()'d code" TSRMLS_CC); |
Line 3297 ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VA
|
Line 3790 ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VA
|
EMPTY_SWITCH_DEFAULT_CASE() |
EMPTY_SWITCH_DEFAULT_CASE() |
} |
} |
} |
} |
if (inc_filename==&tmp_inc_filename) { | if (tmp_inc_filename) { |
zval_dtor(&tmp_inc_filename); | zval_ptr_dtor(&tmp_inc_filename); |
} |
} |
FREE_OP1(); |
FREE_OP1(); |
EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr; | if (UNEXPECTED(EG(exception) != NULL)) { |
if (new_op_array && !EG(exception)) { | HANDLE_EXCEPTION(); |
| } else if (EXPECTED(new_op_array != NULL)) { |
EX(original_return_value) = EG(return_value_ptr_ptr); |
EX(original_return_value) = EG(return_value_ptr_ptr); |
EG(return_value_ptr_ptr) = return_value_used ? EX_T(opline->result.u.var).var.ptr_ptr : NULL; |
|
EG(active_op_array) = new_op_array; |
EG(active_op_array) = new_op_array; |
EX_T(opline->result.u.var).var.ptr = NULL; | if (RETURN_VALUE_USED(opline)) { |
| EX_T(opline->result.var).var.ptr = NULL; |
| EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr; |
| EG(return_value_ptr_ptr) = EX_T(opline->result.var).var.ptr_ptr; |
| } else { |
| EG(return_value_ptr_ptr) = NULL; |
| } |
|
|
EX(current_object) = EX(object); |
EX(current_object) = EX(object); |
|
|
Line 3317 ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VA
|
Line 3816 ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VA
|
zend_rebuild_symbol_table(TSRMLS_C); |
zend_rebuild_symbol_table(TSRMLS_C); |
} |
} |
|
|
if (zend_execute == execute) { | if (EXPECTED(zend_execute == execute)) { |
EX(call_opline) = opline; | |
ZEND_VM_ENTER(); |
ZEND_VM_ENTER(); |
} else { |
} else { |
zend_execute(new_op_array TSRMLS_CC); |
zend_execute(new_op_array TSRMLS_CC); |
Line 3327 ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VA
|
Line 3825 ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VA
|
EX(function_state).function = (zend_function *) EX(op_array); |
EX(function_state).function = (zend_function *) EX(op_array); |
EX(object) = EX(current_object); |
EX(object) = EX(current_object); |
|
|
if (return_value_used) { |
|
if (!EX_T(opline->result.u.var).var.ptr) { /* there was no return statement */ |
|
ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); |
|
INIT_PZVAL(EX_T(opline->result.u.var).var.ptr); |
|
Z_LVAL_P(EX_T(opline->result.u.var).var.ptr) = 1; |
|
Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; |
|
} |
|
} |
|
|
|
EG(opline_ptr) = &EX(opline); |
EG(opline_ptr) = &EX(opline); |
EG(active_op_array) = EX(op_array); |
EG(active_op_array) = EX(op_array); |
EG(return_value_ptr_ptr) = EX(original_return_value); |
EG(return_value_ptr_ptr) = EX(original_return_value); |
destroy_op_array(new_op_array TSRMLS_CC); |
destroy_op_array(new_op_array TSRMLS_CC); |
efree(new_op_array); |
efree(new_op_array); |
if (EG(exception)) { | if (UNEXPECTED(EG(exception) != NULL)) { |
zend_throw_exception_internal(NULL TSRMLS_CC); |
zend_throw_exception_internal(NULL TSRMLS_CC); |
|
HANDLE_EXCEPTION(); |
|
} else if (RETURN_VALUE_USED(opline)) { |
|
if (!EX_T(opline->result.var).var.ptr) { /* there was no return statement */ |
|
zval *retval; |
|
|
|
ALLOC_ZVAL(retval); |
|
ZVAL_BOOL(retval, 1); |
|
INIT_PZVAL(retval); |
|
EX_T(opline->result.var).var.ptr = retval; |
|
} |
} |
} |
} else { | |
if (return_value_used) { | } else if (RETURN_VALUE_USED(opline)) { |
ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr); | zval *retval; |
INIT_ZVAL(*EX_T(opline->result.u.var).var.ptr); | |
Z_LVAL_P(EX_T(opline->result.u.var).var.ptr) = failure_retval; | ALLOC_ZVAL(retval); |
Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL; | ZVAL_BOOL(retval, failure_retval); |
} | INIT_PZVAL(retval); |
| AI_SET_PTR(&EX_T(opline->result.var), retval); |
} |
} |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, ANY) | ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zval tmp, *varname; |
zval tmp, *varname; |
HashTable *target_symbol_table; |
HashTable *target_symbol_table; |
zend_free_op free_op1; |
zend_free_op free_op1; |
|
|
if (OP1_TYPE == IS_CV && (opline->extended_value & ZEND_QUICK_SET)) { | SAVE_OPLINE(); |
| if (OP1_TYPE == IS_CV && |
| OP2_TYPE == IS_UNUSED && |
| (opline->extended_value & ZEND_QUICK_SET)) { |
if (EG(active_symbol_table)) { |
if (EG(active_symbol_table)) { |
zend_execute_data *ex = EX(prev_execute_data); | zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var); |
zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.u.var); | |
|
|
if (zend_hash_quick_del(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value) == SUCCESS) { | zend_delete_variable(EX(prev_execute_data), EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value TSRMLS_CC); |
while (ex && ex->symbol_table == EG(active_symbol_table)) { | EX_CV(opline->op1.var) = NULL; |
int i; | } else if (EX_CV(opline->op1.var)) { |
| zval_ptr_dtor(EX_CV(opline->op1.var)); |
if (ex->op_array) { | EX_CV(opline->op1.var) = NULL; |
for (i = 0; i < ex->op_array->last_var; i++) { | |
if (ex->op_array->vars[i].hash_value == cv->hash_value && | |
ex->op_array->vars[i].name_len == cv->name_len && | |
!memcmp(ex->op_array->vars[i].name, cv->name, cv->name_len)) { | |
ex->CVs[i] = NULL; | |
break; | |
} | |
} | |
} | |
ex = ex->prev_execute_data; | |
} | |
} | |
EX(CVs)[opline->op1.u.var] = NULL; | |
} else if (EX(CVs)[opline->op1.u.var]) { | |
zval_ptr_dtor(EX(CVs)[opline->op1.u.var]); | |
EX(CVs)[opline->op1.u.var] = NULL; | |
} |
} |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
varname = GET_OP1_ZVAL_PTR(BP_VAR_R); |
varname = GET_OP1_ZVAL_PTR(BP_VAR_R); |
|
|
if (Z_TYPE_P(varname) != IS_STRING) { | if (OP1_TYPE != IS_CONST && Z_TYPE_P(varname) != IS_STRING) { |
tmp = *varname; | ZVAL_COPY_VALUE(&tmp, varname); |
zval_copy_ctor(&tmp); |
zval_copy_ctor(&tmp); |
convert_to_string(&tmp); |
convert_to_string(&tmp); |
varname = &tmp; |
varname = &tmp; |
Line 3403 ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV,
|
Line 3890 ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV,
|
Z_ADDREF_P(varname); |
Z_ADDREF_P(varname); |
} |
} |
|
|
if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { | if (OP2_TYPE != IS_UNUSED) { |
zend_std_unset_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname) TSRMLS_CC); | zend_class_entry *ce; |
} else { | |
ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); | |
|
|
target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC); | if (OP2_TYPE == IS_CONST) { |
if (zend_hash_quick_del(target_symbol_table, varname->value.str.val, varname->value.str.len+1, hash_value) == SUCCESS) { | if (CACHED_PTR(opline->op2.literal->cache_slot)) { |
zend_execute_data *ex = EXECUTE_DATA; | ce = CACHED_PTR(opline->op2.literal->cache_slot); |
| } else { |
do { | ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); |
int i; | if (UNEXPECTED(EG(exception) != NULL)) { |
| if (OP1_TYPE != IS_CONST && varname == &tmp) { |
if (ex->op_array) { | zval_dtor(&tmp); |
for (i = 0; i < ex->op_array->last_var; i++) { | } else if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) { |
if (ex->op_array->vars[i].hash_value == hash_value && | zval_ptr_dtor(&varname); |
ex->op_array->vars[i].name_len == varname->value.str.len && | |
!memcmp(ex->op_array->vars[i].name, varname->value.str.val, varname->value.str.len)) { | |
ex->CVs[i] = NULL; | |
break; | |
} | |
} |
} |
|
FREE_OP1(); |
|
HANDLE_EXCEPTION(); |
} |
} |
ex = ex->prev_execute_data; | if (UNEXPECTED(ce == NULL)) { |
} while (ex && ex->symbol_table == target_symbol_table); | zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv)); |
| } |
| CACHE_PTR(opline->op2.literal->cache_slot, ce); |
| } |
| } else { |
| ce = EX_T(opline->op2.var).class_entry; |
} |
} |
|
zend_std_unset_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); |
|
} else { |
|
ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1); |
|
|
|
target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); |
|
zend_delete_variable(EXECUTE_DATA, target_symbol_table, varname->value.str.val, varname->value.str.len+1, hash_value TSRMLS_CC); |
} |
} |
|
|
if (varname == &tmp) { | if (OP1_TYPE != IS_CONST && varname == &tmp) { |
zval_dtor(&tmp); |
zval_dtor(&tmp); |
} else if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) { |
} else if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) { |
zval_ptr_dtor(&varname); |
zval_ptr_dtor(&varname); |
} |
} |
FREE_OP1(); |
FREE_OP1(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
zval **container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_UNSET); | zval **container; |
zval *offset; |
zval *offset; |
|
ulong hval; |
|
|
|
SAVE_OPLINE(); |
|
container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_UNSET); |
if (OP1_TYPE == IS_CV && container != &EG(uninitialized_zval_ptr)) { |
if (OP1_TYPE == IS_CV && container != &EG(uninitialized_zval_ptr)) { |
SEPARATE_ZVAL_IF_NOT_REF(container); |
SEPARATE_ZVAL_IF_NOT_REF(container); |
} |
} |
Line 3458 ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CON
|
Line 3955 ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CON
|
|
|
switch (Z_TYPE_P(offset)) { |
switch (Z_TYPE_P(offset)) { |
case IS_DOUBLE: |
case IS_DOUBLE: |
zend_hash_index_del(ht, zend_dval_to_lval(Z_DVAL_P(offset))); | hval = zend_dval_to_lval(Z_DVAL_P(offset)); |
| zend_hash_index_del(ht, hval); |
break; |
break; |
case IS_RESOURCE: |
case IS_RESOURCE: |
case IS_BOOL: |
case IS_BOOL: |
case IS_LONG: |
case IS_LONG: |
zend_hash_index_del(ht, Z_LVAL_P(offset)); | hval = Z_LVAL_P(offset); |
| zend_hash_index_del(ht, hval); |
break; |
break; |
case IS_STRING: |
case IS_STRING: |
if (OP2_TYPE == IS_CV || OP2_TYPE == IS_VAR) { |
if (OP2_TYPE == IS_CV || OP2_TYPE == IS_VAR) { |
Z_ADDREF_P(offset); |
Z_ADDREF_P(offset); |
} |
} |
if (zend_symtable_del(ht, offset->value.str.val, offset->value.str.len+1) == SUCCESS && | if (OP2_TYPE == IS_CONST) { |
ht == &EG(symbol_table)) { | hval = Z_HASH_P(offset); |
zend_execute_data *ex; | } else { |
ulong hash_value = zend_inline_hash_func(offset->value.str.val, offset->value.str.len+1); | ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_dim)); |
| if (IS_INTERNED(Z_STRVAL_P(offset))) { |
for (ex = EXECUTE_DATA; ex; ex = ex->prev_execute_data) { | hval = INTERNED_HASH(Z_STRVAL_P(offset)); |
if (ex->op_array && ex->symbol_table == ht) { | } else { |
int i; | hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); |
| |
for (i = 0; i < ex->op_array->last_var; i++) { | |
if (ex->op_array->vars[i].hash_value == hash_value && | |
ex->op_array->vars[i].name_len == offset->value.str.len && | |
!memcmp(ex->op_array->vars[i].name, offset->value.str.val, offset->value.str.len)) { | |
ex->CVs[i] = NULL; | |
break; | |
} | |
} | |
} | |
} |
} |
} |
} |
|
if (ht == &EG(symbol_table)) { |
|
zend_delete_global_variable_ex(offset->value.str.val, offset->value.str.len, hval TSRMLS_CC); |
|
} else { |
|
zend_hash_quick_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval); |
|
} |
if (OP2_TYPE == IS_CV || OP2_TYPE == IS_VAR) { |
if (OP2_TYPE == IS_CV || OP2_TYPE == IS_VAR) { |
zval_ptr_dtor(&offset); |
zval_ptr_dtor(&offset); |
} |
} |
break; |
break; |
|
ZEND_VM_C_LABEL(num_index_dim): |
|
zend_hash_index_del(ht, hval); |
|
if (OP2_TYPE == IS_CV || OP2_TYPE == IS_VAR) { |
|
zval_ptr_dtor(&offset); |
|
} |
|
break; |
case IS_NULL: |
case IS_NULL: |
zend_hash_del(ht, "", sizeof("")); |
zend_hash_del(ht, "", sizeof("")); |
break; |
break; |
Line 3504 ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CON
|
Line 4004 ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CON
|
break; |
break; |
} |
} |
case IS_OBJECT: |
case IS_OBJECT: |
if (!Z_OBJ_HT_P(*container)->unset_dimension) { | if (UNEXPECTED(Z_OBJ_HT_P(*container)->unset_dimension == NULL)) { |
zend_error_noreturn(E_ERROR, "Cannot use object as array"); |
zend_error_noreturn(E_ERROR, "Cannot use object as array"); |
} |
} |
if (IS_OP2_TMP_FREE()) { |
if (IS_OP2_TMP_FREE()) { |
Line 3529 ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CON
|
Line 4029 ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CON
|
} |
} |
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
|
|
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(76, ZEND_UNSET_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|CV) |
ZEND_VM_HANDLER(76, ZEND_UNSET_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|CV) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
zval **container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_UNSET); | zval **container; |
zval *offset = GET_OP2_ZVAL_PTR(BP_VAR_R); | zval *offset; |
|
|
|
SAVE_OPLINE(); |
|
container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_UNSET); |
|
offset = GET_OP2_ZVAL_PTR(BP_VAR_R); |
|
|
if (OP1_TYPE != IS_VAR || container) { |
if (OP1_TYPE != IS_VAR || container) { |
if (OP1_TYPE == IS_CV && container != &EG(uninitialized_zval_ptr)) { |
if (OP1_TYPE == IS_CV && container != &EG(uninitialized_zval_ptr)) { |
SEPARATE_ZVAL_IF_NOT_REF(container); |
SEPARATE_ZVAL_IF_NOT_REF(container); |
Line 3548 ZEND_VM_HANDLER(76, ZEND_UNSET_OBJ, VAR|UNUSED|CV, CON
|
Line 4053 ZEND_VM_HANDLER(76, ZEND_UNSET_OBJ, VAR|UNUSED|CV, CON
|
MAKE_REAL_ZVAL_PTR(offset); |
MAKE_REAL_ZVAL_PTR(offset); |
} |
} |
if (Z_OBJ_HT_P(*container)->unset_property) { |
if (Z_OBJ_HT_P(*container)->unset_property) { |
Z_OBJ_HT_P(*container)->unset_property(*container, offset TSRMLS_CC); | Z_OBJ_HT_P(*container)->unset_property(*container, offset, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); |
} else { |
} else { |
zend_error(E_NOTICE, "Trying to unset property of non-object"); |
zend_error(E_NOTICE, "Trying to unset property of non-object"); |
} |
} |
Line 3565 ZEND_VM_HANDLER(76, ZEND_UNSET_OBJ, VAR|UNUSED|CV, CON
|
Line 4070 ZEND_VM_HANDLER(76, ZEND_UNSET_OBJ, VAR|UNUSED|CV, CON
|
} |
} |
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
|
|
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY) |
ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval *array_ptr, **array_ptr_ptr; |
zval *array_ptr, **array_ptr_ptr; |
HashTable *fe_ht; |
HashTable *fe_ht; |
Line 3578 ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, A
|
Line 4084 ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, A
|
zend_class_entry *ce = NULL; |
zend_class_entry *ce = NULL; |
zend_bool is_empty = 0; |
zend_bool is_empty = 0; |
|
|
if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { | SAVE_OPLINE(); |
| |
| if ((OP1_TYPE == IS_CV || OP1_TYPE == IS_VAR) && |
| (opline->extended_value & ZEND_FE_RESET_VARIABLE)) { |
array_ptr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_R); |
array_ptr_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_R); |
if (array_ptr_ptr == NULL || array_ptr_ptr == &EG(uninitialized_zval_ptr)) { |
if (array_ptr_ptr == NULL || array_ptr_ptr == &EG(uninitialized_zval_ptr)) { |
ALLOC_INIT_ZVAL(array_ptr); | MAKE_STD_ZVAL(array_ptr); |
| ZVAL_NULL(array_ptr); |
} else if (Z_TYPE_PP(array_ptr_ptr) == IS_OBJECT) { |
} else if (Z_TYPE_PP(array_ptr_ptr) == IS_OBJECT) { |
if(Z_OBJ_HT_PP(array_ptr_ptr)->get_class_entry == NULL) { |
if(Z_OBJ_HT_PP(array_ptr_ptr)->get_class_entry == NULL) { |
zend_error(E_WARNING, "foreach() cannot iterate over objects without PHP class"); |
zend_error(E_WARNING, "foreach() cannot iterate over objects without PHP class"); |
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.u.opline_num); | ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.opline_num); |
} |
} |
|
|
ce = Z_OBJCE_PP(array_ptr_ptr); |
ce = Z_OBJCE_PP(array_ptr_ptr); |
Line 3623 ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, A
|
Line 4133 ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, A
|
if (!ce || !ce->get_iterator) { |
if (!ce || !ce->get_iterator) { |
Z_ADDREF_P(array_ptr); |
Z_ADDREF_P(array_ptr); |
} |
} |
} else if (OP1_TYPE == IS_CONST || | } else if (OP1_TYPE == IS_CONST || |
((OP1_TYPE == IS_CV || OP1_TYPE == IS_VAR) && |
((OP1_TYPE == IS_CV || OP1_TYPE == IS_VAR) && |
!Z_ISREF_P(array_ptr) && |
!Z_ISREF_P(array_ptr) && |
Z_REFCOUNT_P(array_ptr) > 1)) { |
Z_REFCOUNT_P(array_ptr) > 1)) { |
Line 3641 ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, A
|
Line 4151 ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, A
|
if (ce && ce->get_iterator) { |
if (ce && ce->get_iterator) { |
iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_RESET_REFERENCE TSRMLS_CC); |
iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_RESET_REFERENCE TSRMLS_CC); |
|
|
if (iter && !EG(exception)) { | if (iter && EXPECTED(EG(exception) == NULL)) { |
array_ptr = zend_iterator_wrap(iter TSRMLS_CC); |
array_ptr = zend_iterator_wrap(iter TSRMLS_CC); |
} else { |
} else { |
if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { | FREE_OP1_IF_VAR(); |
FREE_OP1_VAR_PTR(); | |
} else { | |
FREE_OP1_IF_VAR(); | |
} | |
if (!EG(exception)) { |
if (!EG(exception)) { |
zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Object of type %s did not create an Iterator", ce->name); |
zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Object of type %s did not create an Iterator", ce->name); |
} |
} |
zend_throw_exception_internal(NULL TSRMLS_CC); |
zend_throw_exception_internal(NULL TSRMLS_CC); |
ZEND_VM_NEXT_OPCODE(); | HANDLE_EXCEPTION(); |
} |
} |
} |
} |
|
|
AI_SET_PTR(EX_T(opline->result.u.var).var, array_ptr); | EX_T(opline->result.var).fe.ptr = array_ptr; |
PZVAL_LOCK(array_ptr); | |
|
|
if (iter) { |
if (iter) { |
iter->index = 0; |
iter->index = 0; |
if (iter->funcs->rewind) { |
if (iter->funcs->rewind) { |
iter->funcs->rewind(iter TSRMLS_CC); |
iter->funcs->rewind(iter TSRMLS_CC); |
if (EG(exception)) { | if (UNEXPECTED(EG(exception) != NULL)) { |
Z_DELREF_P(array_ptr); | |
zval_ptr_dtor(&array_ptr); |
zval_ptr_dtor(&array_ptr); |
if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { | FREE_OP1_IF_VAR(); |
FREE_OP1_VAR_PTR(); | HANDLE_EXCEPTION(); |
} else { | |
FREE_OP1_IF_VAR(); | |
} | |
ZEND_VM_NEXT_OPCODE(); | |
} |
} |
} |
} |
is_empty = iter->funcs->valid(iter TSRMLS_CC) != SUCCESS; |
is_empty = iter->funcs->valid(iter TSRMLS_CC) != SUCCESS; |
if (EG(exception)) { | if (UNEXPECTED(EG(exception) != NULL)) { |
Z_DELREF_P(array_ptr); | |
zval_ptr_dtor(&array_ptr); |
zval_ptr_dtor(&array_ptr); |
if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { | FREE_OP1_IF_VAR(); |
FREE_OP1_VAR_PTR(); | HANDLE_EXCEPTION(); |
} else { | |
FREE_OP1_IF_VAR(); | |
} | |
ZEND_VM_NEXT_OPCODE(); | |
} |
} |
iter->index = -1; /* will be set to 0 before using next handler */ |
iter->index = -1; /* will be set to 0 before using next handler */ |
} else if ((fe_ht = HASH_OF(array_ptr)) != NULL) { |
} else if ((fe_ht = HASH_OF(array_ptr)) != NULL) { |
Line 3707 ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, A
|
Line 4202 ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, A
|
} |
} |
} |
} |
is_empty = zend_hash_has_more_elements(fe_ht) != SUCCESS; |
is_empty = zend_hash_has_more_elements(fe_ht) != SUCCESS; |
zend_hash_get_pointer(fe_ht, &EX_T(opline->result.u.var).fe.fe_pos); | zend_hash_get_pointer(fe_ht, &EX_T(opline->result.var).fe.fe_pos); |
} else { |
} else { |
zend_error(E_WARNING, "Invalid argument supplied for foreach()"); |
zend_error(E_WARNING, "Invalid argument supplied for foreach()"); |
is_empty = 1; |
is_empty = 1; |
} |
} |
|
|
if (opline->extended_value & ZEND_FE_RESET_VARIABLE) { | FREE_OP1_IF_VAR(); |
FREE_OP1_VAR_PTR(); | |
} else { | |
FREE_OP1_IF_VAR(); | |
} | |
if (is_empty) { |
if (is_empty) { |
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.u.opline_num); | ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.opline_num); |
} else { |
} else { |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
} |
} |
|
|
ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY) |
ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval *array = EX_T(opline->op1.u.var).var.ptr; | zval *array = EX_T(opline->op1.var).fe.ptr; |
zval **value; |
zval **value; |
char *str_key; |
char *str_key; |
uint str_key_len; |
uint str_key_len; |
Line 3739 ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
|
Line 4231 ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
|
int key_type = 0; |
int key_type = 0; |
zend_bool use_key = (zend_bool)(opline->extended_value & ZEND_FE_FETCH_WITH_KEY); |
zend_bool use_key = (zend_bool)(opline->extended_value & ZEND_FE_FETCH_WITH_KEY); |
|
|
|
SAVE_OPLINE(); |
|
|
switch (zend_iterator_unwrap(array, &iter TSRMLS_CC)) { |
switch (zend_iterator_unwrap(array, &iter TSRMLS_CC)) { |
default: |
default: |
case ZEND_ITER_INVALID: |
case ZEND_ITER_INVALID: |
zend_error(E_WARNING, "Invalid argument supplied for foreach()"); |
zend_error(E_WARNING, "Invalid argument supplied for foreach()"); |
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.u.opline_num); | ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.opline_num); |
|
|
case ZEND_ITER_PLAIN_OBJECT: { |
case ZEND_ITER_PLAIN_OBJECT: { |
char *class_name, *prop_name; | const char *class_name, *prop_name; |
zend_object *zobj = zend_objects_get_address(array TSRMLS_CC); |
zend_object *zobj = zend_objects_get_address(array TSRMLS_CC); |
|
|
fe_ht = HASH_OF(array); | fe_ht = Z_OBJPROP_P(array); |
zend_hash_set_pointer(fe_ht, &EX_T(opline->op1.u.var).fe.fe_pos); | zend_hash_set_pointer(fe_ht, &EX_T(opline->op1.var).fe.fe_pos); |
do { |
do { |
if (zend_hash_get_current_data(fe_ht, (void **) &value)==FAILURE) { |
if (zend_hash_get_current_data(fe_ht, (void **) &value)==FAILURE) { |
/* reached end of iteration */ |
/* reached end of iteration */ |
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.u.opline_num); | ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.opline_num); |
} |
} |
key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); |
key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); |
|
|
Line 3762 ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
|
Line 4256 ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
|
} while (key_type == HASH_KEY_NON_EXISTANT || |
} while (key_type == HASH_KEY_NON_EXISTANT || |
(key_type != HASH_KEY_IS_LONG && |
(key_type != HASH_KEY_IS_LONG && |
zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) != SUCCESS)); |
zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) != SUCCESS)); |
zend_hash_get_pointer(fe_ht, &EX_T(opline->op1.u.var).fe.fe_pos); | zend_hash_get_pointer(fe_ht, &EX_T(opline->op1.var).fe.fe_pos); |
if (use_key && key_type != HASH_KEY_IS_LONG) { |
if (use_key && key_type != HASH_KEY_IS_LONG) { |
zend_unmangle_property_name(str_key, str_key_len-1, &class_name, &prop_name); |
zend_unmangle_property_name(str_key, str_key_len-1, &class_name, &prop_name); |
str_key_len = strlen(prop_name); |
str_key_len = strlen(prop_name); |
Line 3773 ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
|
Line 4267 ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
|
} |
} |
|
|
case ZEND_ITER_PLAIN_ARRAY: |
case ZEND_ITER_PLAIN_ARRAY: |
fe_ht = HASH_OF(array); | fe_ht = Z_ARRVAL_P(array); |
zend_hash_set_pointer(fe_ht, &EX_T(opline->op1.u.var).fe.fe_pos); | zend_hash_set_pointer(fe_ht, &EX_T(opline->op1.var).fe.fe_pos); |
if (zend_hash_get_current_data(fe_ht, (void **) &value)==FAILURE) { |
if (zend_hash_get_current_data(fe_ht, (void **) &value)==FAILURE) { |
/* reached end of iteration */ |
/* reached end of iteration */ |
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.u.opline_num); | ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.opline_num); |
} |
} |
if (use_key) { |
if (use_key) { |
key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 1, NULL); |
key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 1, NULL); |
} |
} |
zend_hash_move_forward(fe_ht); |
zend_hash_move_forward(fe_ht); |
zend_hash_get_pointer(fe_ht, &EX_T(opline->op1.u.var).fe.fe_pos); | zend_hash_get_pointer(fe_ht, &EX_T(opline->op1.var).fe.fe_pos); |
break; |
break; |
|
|
case ZEND_ITER_OBJECT: |
case ZEND_ITER_OBJECT: |
Line 3792 ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
|
Line 4286 ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
|
/* This could cause an endless loop if index becomes zero again. |
/* This could cause an endless loop if index becomes zero again. |
* In case that ever happens we need an additional flag. */ |
* In case that ever happens we need an additional flag. */ |
iter->funcs->move_forward(iter TSRMLS_CC); |
iter->funcs->move_forward(iter TSRMLS_CC); |
if (EG(exception)) { | if (UNEXPECTED(EG(exception) != NULL)) { |
Z_DELREF_P(array); | |
zval_ptr_dtor(&array); |
zval_ptr_dtor(&array); |
ZEND_VM_NEXT_OPCODE(); | HANDLE_EXCEPTION(); |
} |
} |
} |
} |
/* If index is zero we come from FE_RESET and checked valid() already. */ |
/* If index is zero we come from FE_RESET and checked valid() already. */ |
if (!iter || (iter->index > 0 && iter->funcs->valid(iter TSRMLS_CC) == FAILURE)) { |
if (!iter || (iter->index > 0 && iter->funcs->valid(iter TSRMLS_CC) == FAILURE)) { |
/* reached end of iteration */ |
/* reached end of iteration */ |
if (EG(exception)) { | if (UNEXPECTED(EG(exception) != NULL)) { |
Z_DELREF_P(array); | |
zval_ptr_dtor(&array); |
zval_ptr_dtor(&array); |
ZEND_VM_NEXT_OPCODE(); | HANDLE_EXCEPTION(); |
} |
} |
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.u.opline_num); | ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.opline_num); |
} |
} |
iter->funcs->get_current_data(iter, &value TSRMLS_CC); |
iter->funcs->get_current_data(iter, &value TSRMLS_CC); |
if (EG(exception)) { | if (UNEXPECTED(EG(exception) != NULL)) { |
Z_DELREF_P(array); | |
zval_ptr_dtor(&array); |
zval_ptr_dtor(&array); |
ZEND_VM_NEXT_OPCODE(); | HANDLE_EXCEPTION(); |
} |
} |
if (!value) { |
if (!value) { |
/* failure in get_current_data */ |
/* failure in get_current_data */ |
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.u.opline_num); | ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.opline_num); |
} |
} |
if (use_key) { |
if (use_key) { |
if (iter->funcs->get_current_key) { |
if (iter->funcs->get_current_key) { |
key_type = iter->funcs->get_current_key(iter, &str_key, &str_key_len, &int_key TSRMLS_CC); |
key_type = iter->funcs->get_current_key(iter, &str_key, &str_key_len, &int_key TSRMLS_CC); |
if (EG(exception)) { | if (UNEXPECTED(EG(exception) != NULL)) { |
Z_DELREF_P(array); | |
zval_ptr_dtor(&array); |
zval_ptr_dtor(&array); |
ZEND_VM_NEXT_OPCODE(); | HANDLE_EXCEPTION(); |
} |
} |
} else { |
} else { |
key_type = HASH_KEY_IS_LONG; |
key_type = HASH_KEY_IS_LONG; |
Line 3837 ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
|
Line 4327 ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
|
if (opline->extended_value & ZEND_FE_FETCH_BYREF) { |
if (opline->extended_value & ZEND_FE_FETCH_BYREF) { |
SEPARATE_ZVAL_IF_NOT_REF(value); |
SEPARATE_ZVAL_IF_NOT_REF(value); |
Z_SET_ISREF_PP(value); |
Z_SET_ISREF_PP(value); |
EX_T(opline->result.u.var).var.ptr_ptr = value; | EX_T(opline->result.var).var.ptr_ptr = value; |
Z_ADDREF_PP(value); |
Z_ADDREF_PP(value); |
} else { |
} else { |
AI_SET_PTR(EX_T(opline->result.u.var).var, *value); |
|
PZVAL_LOCK(*value); |
PZVAL_LOCK(*value); |
|
AI_SET_PTR(&EX_T(opline->result.var), *value); |
} |
} |
|
|
if (use_key) { |
if (use_key) { |
zend_op *op_data = opline+1; | zval *key = &EX_T((opline+1)->result.var).tmp_var; |
zval *key = &EX_T(op_data->result.u.var).tmp_var; | |
|
|
switch (key_type) { |
switch (key_type) { |
case HASH_KEY_IS_STRING: |
case HASH_KEY_IS_STRING: |
Z_STRVAL_P(key) = str_key; | Z_STRVAL_P(key) = (char*)str_key; |
Z_STRLEN_P(key) = str_key_len-1; |
Z_STRLEN_P(key) = str_key_len-1; |
Z_TYPE_P(key) = IS_STRING; |
Z_TYPE_P(key) = IS_STRING; |
break; |
break; |
Line 3865 ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
|
Line 4354 ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
|
} |
} |
} |
} |
|
|
|
CHECK_EXCEPTION(); |
ZEND_VM_INC_OPCODE(); |
ZEND_VM_INC_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, ANY) | ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zval **value; |
zval **value; |
zend_bool isset = 1; |
zend_bool isset = 1; |
|
|
if (OP1_TYPE == IS_CV && (opline->extended_value & ZEND_QUICK_SET)) { | SAVE_OPLINE(); |
if (EX(CVs)[opline->op1.u.var]) { | if (OP1_TYPE == IS_CV && |
value = EX(CVs)[opline->op1.u.var]; | OP2_TYPE == IS_UNUSED && |
| (opline->extended_value & ZEND_QUICK_SET)) { |
| if (EX_CV(opline->op1.var)) { |
| value = EX_CV(opline->op1.var); |
} else if (EG(active_symbol_table)) { |
} else if (EG(active_symbol_table)) { |
zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.u.var); | zend_compiled_variable *cv = &CV_DEF_OF(opline->op1.var); |
|
|
if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) { |
if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **) &value) == FAILURE) { |
isset = 0; |
isset = 0; |
} |
} |
} else { | } else { |
isset = 0; |
isset = 0; |
} |
} |
} else { |
} else { |
Line 3892 ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP
|
Line 4385 ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP
|
zend_free_op free_op1; |
zend_free_op free_op1; |
zval tmp, *varname = GET_OP1_ZVAL_PTR(BP_VAR_IS); |
zval tmp, *varname = GET_OP1_ZVAL_PTR(BP_VAR_IS); |
|
|
if (Z_TYPE_P(varname) != IS_STRING) { | if (OP1_TYPE != IS_CONST && Z_TYPE_P(varname) != IS_STRING) { |
tmp = *varname; | ZVAL_COPY_VALUE(&tmp, varname); |
zval_copy_ctor(&tmp); |
zval_copy_ctor(&tmp); |
convert_to_string(&tmp); |
convert_to_string(&tmp); |
varname = &tmp; |
varname = &tmp; |
} |
} |
|
|
if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { | if (OP2_TYPE != IS_UNUSED) { |
value = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1 TSRMLS_CC); | zend_class_entry *ce; |
| |
| if (OP2_TYPE == IS_CONST) { |
| if (CACHED_PTR(opline->op2.literal->cache_slot)) { |
| ce = CACHED_PTR(opline->op2.literal->cache_slot); |
| } else { |
| ce = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, 0 TSRMLS_CC); |
| if (UNEXPECTED(ce == NULL)) { |
| CHECK_EXCEPTION(); |
| ZEND_VM_NEXT_OPCODE(); |
| } |
| CACHE_PTR(opline->op2.literal->cache_slot, ce); |
| } |
| } else { |
| ce = EX_T(opline->op2.var).class_entry; |
| } |
| value = zend_std_get_static_property(ce, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1, ((OP1_TYPE == IS_CONST) ? opline->op1.literal : NULL) TSRMLS_CC); |
if (!value) { |
if (!value) { |
isset = 0; |
isset = 0; |
} |
} |
} else { |
} else { |
target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC); | target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC); |
if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) { |
if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) { |
isset = 0; |
isset = 0; |
} |
} |
} |
} |
|
|
if (varname == &tmp) { | if (OP1_TYPE != IS_CONST && varname == &tmp) { |
zval_dtor(&tmp); |
zval_dtor(&tmp); |
} |
} |
FREE_OP1(); |
FREE_OP1(); |
} |
} |
|
|
Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; | if (opline->extended_value & ZEND_ISSET) { |
| if (isset && Z_TYPE_PP(value) != IS_NULL) { |
switch (opline->extended_value & ZEND_ISSET_ISEMPTY_MASK) { | ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1); |
case ZEND_ISSET: | } else { |
if (isset && Z_TYPE_PP(value) == IS_NULL) { | ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0); |
Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; | } |
} else { | } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { |
Z_LVAL(EX_T(opline->result.u.var).tmp_var) = isset; | if (!isset || !i_zend_is_true(*value)) { |
} | ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 1); |
break; | } else { |
case ZEND_ISEMPTY: | ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, 0); |
if (!isset || !i_zend_is_true(*value)) { | } |
Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 1; | |
} else { | |
Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0; | |
} | |
break; | |
} |
} |
|
|
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST|TMP|VAR|CV, int prop_dim) |
ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST|TMP|VAR|CV, int prop_dim) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; | zend_free_op free_op1, free_op2; |
zval **container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_IS); | zval **container; |
zval **value = NULL; |
zval **value = NULL; |
int result = 0; |
int result = 0; |
|
ulong hval; |
|
zval *offset; |
|
|
if (OP1_TYPE != IS_VAR || container) { | SAVE_OPLINE(); |
zend_free_op free_op2; | container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_IS); |
zval *offset = GET_OP2_ZVAL_PTR(BP_VAR_R); | |
|
|
if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) { | offset = GET_OP2_ZVAL_PTR(BP_VAR_R); |
HashTable *ht; | |
int isset = 0; | |
|
|
ht = Z_ARRVAL_PP(container); | if (Z_TYPE_PP(container) == IS_ARRAY && !prop_dim) { |
| HashTable *ht; |
| int isset = 0; |
|
|
switch (Z_TYPE_P(offset)) { | ht = Z_ARRVAL_PP(container); |
case IS_DOUBLE: | |
if (zend_hash_index_find(ht, zend_dval_to_lval(Z_DVAL_P(offset)), (void **) &value) == SUCCESS) { | |
isset = 1; | |
} | |
break; | |
case IS_RESOURCE: | |
case IS_BOOL: | |
case IS_LONG: | |
if (zend_hash_index_find(ht, Z_LVAL_P(offset), (void **) &value) == SUCCESS) { | |
isset = 1; | |
} | |
break; | |
case IS_STRING: | |
if (zend_symtable_find(ht, offset->value.str.val, offset->value.str.len+1, (void **) &value) == SUCCESS) { | |
isset = 1; | |
} | |
break; | |
case IS_NULL: | |
if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) { | |
isset = 1; | |
} | |
break; | |
default: | |
zend_error(E_WARNING, "Illegal offset type in isset or empty"); | |
|
|
break; | switch (Z_TYPE_P(offset)) { |
} | case IS_DOUBLE: |
| hval = zend_dval_to_lval(Z_DVAL_P(offset)); |
switch (opline->extended_value) { | ZEND_VM_C_GOTO(num_index_prop); |
case ZEND_ISSET: | case IS_RESOURCE: |
if (isset && Z_TYPE_PP(value) == IS_NULL) { | case IS_BOOL: |
result = 0; | case IS_LONG: |
} else { | hval = Z_LVAL_P(offset); |
result = isset; | ZEND_VM_C_LABEL(num_index_prop): |
| if (zend_hash_index_find(ht, hval, (void **) &value) == SUCCESS) { |
| isset = 1; |
| } |
| break; |
| case IS_STRING: |
| if (OP2_TYPE == IS_CONST) { |
| hval = Z_HASH_P(offset); |
| } else { |
| if (!prop_dim) { |
| ZEND_HANDLE_NUMERIC_EX(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, ZEND_VM_C_GOTO(num_index_prop)); |
} |
} |
break; | if (IS_INTERNED(Z_STRVAL_P(offset))) { |
case ZEND_ISEMPTY: | hval = INTERNED_HASH(Z_STRVAL_P(offset)); |
if (!isset || !i_zend_is_true(*value)) { | |
result = 0; | |
} else { |
} else { |
result = 1; | hval = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); |
} |
} |
break; | } |
| if (zend_hash_quick_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hval, (void **) &value) == SUCCESS) { |
| isset = 1; |
| } |
| break; |
| case IS_NULL: |
| if (zend_hash_find(ht, "", sizeof(""), (void **) &value) == SUCCESS) { |
| isset = 1; |
| } |
| break; |
| default: |
| zend_error(E_WARNING, "Illegal offset type in isset or empty"); |
| break; |
| } |
| |
| if (opline->extended_value & ZEND_ISSET) { |
| if (isset && Z_TYPE_PP(value) == IS_NULL) { |
| result = 0; |
| } else { |
| result = isset; |
} |
} |
FREE_OP2(); | } else /* if (opline->extended_value & ZEND_ISEMPTY) */ { |
} else if (Z_TYPE_PP(container) == IS_OBJECT) { | if (!isset || !i_zend_is_true(*value)) { |
if (IS_OP2_TMP_FREE()) { | result = 0; |
MAKE_REAL_ZVAL_PTR(offset); | } else { |
| result = 1; |
} |
} |
if (prop_dim) { | } |
if (Z_OBJ_HT_P(*container)->has_property) { | FREE_OP2(); |
result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); | } else if (Z_TYPE_PP(container) == IS_OBJECT) { |
} else { | if (IS_OP2_TMP_FREE()) { |
zend_error(E_NOTICE, "Trying to check property of non-object"); | MAKE_REAL_ZVAL_PTR(offset); |
result = 0; | } |
} | if (prop_dim) { |
| if (Z_OBJ_HT_P(*container)->has_property) { |
| result = Z_OBJ_HT_P(*container)->has_property(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0, ((OP2_TYPE == IS_CONST) ? opline->op2.literal : NULL) TSRMLS_CC); |
} else { |
} else { |
if (Z_OBJ_HT_P(*container)->has_dimension) { | zend_error(E_NOTICE, "Trying to check property of non-object"); |
result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC); | result = 0; |
} else { | |
zend_error(E_NOTICE, "Trying to check element of non-array"); | |
result = 0; | |
} | |
} |
} |
if (IS_OP2_TMP_FREE()) { | } else { |
zval_ptr_dtor(&offset); | if (Z_OBJ_HT_P(*container)->has_dimension) { |
| result = Z_OBJ_HT_P(*container)->has_dimension(*container, offset, (opline->extended_value & ZEND_ISEMPTY) != 0 TSRMLS_CC); |
} else { |
} else { |
FREE_OP2(); | zend_error(E_NOTICE, "Trying to check element of non-array"); |
| result = 0; |
} |
} |
} else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ | } |
zval tmp; | if (IS_OP2_TMP_FREE()) { |
| zval_ptr_dtor(&offset); |
| } else { |
| FREE_OP2(); |
| } |
| } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */ |
| zval tmp; |
|
|
if (Z_TYPE_P(offset) != IS_LONG) { | if (Z_TYPE_P(offset) != IS_LONG) { |
tmp = *offset; | if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */ |
| || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */ |
| && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) { |
| ZVAL_COPY_VALUE(&tmp, offset); |
zval_copy_ctor(&tmp); |
zval_copy_ctor(&tmp); |
convert_to_long(&tmp); |
convert_to_long(&tmp); |
offset = &tmp; |
offset = &tmp; |
|
} else { |
|
/* can not be converted to proper offset, return "not set" */ |
|
result = 0; |
} |
} |
if (Z_TYPE_P(offset) == IS_LONG) { | } |
switch (opline->extended_value) { | if (Z_TYPE_P(offset) == IS_LONG) { |
case ZEND_ISSET: | if (opline->extended_value & ZEND_ISSET) { |
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { | if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container)) { |
result = 1; | result = 1; |
} | |
break; | |
case ZEND_ISEMPTY: | |
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { | |
result = 1; | |
} | |
break; | |
} |
} |
|
} else /* if (opline->extended_value & ZEND_ISEMPTY) */ { |
|
if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] != '0') { |
|
result = 1; |
|
} |
} |
} |
FREE_OP2(); |
|
} else { |
|
FREE_OP2(); |
|
} |
} |
|
FREE_OP2(); |
|
} else { |
|
FREE_OP2(); |
} |
} |
|
|
Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL; | Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_BOOL; |
| if (opline->extended_value & ZEND_ISSET) { |
switch (opline->extended_value) { | Z_LVAL(EX_T(opline->result.var).tmp_var) = result; |
case ZEND_ISSET: | } else { |
Z_LVAL(EX_T(opline->result.u.var).tmp_var) = result; | Z_LVAL(EX_T(opline->result.var).tmp_var) = !result; |
break; | |
case ZEND_ISEMPTY: | |
Z_LVAL(EX_T(opline->result.u.var).tmp_var) = !result; | |
break; | |
} |
} |
|
|
FREE_OP1_VAR_PTR(); |
FREE_OP1_VAR_PTR(); |
|
|
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
Line 4085 ZEND_VM_HANDLER(148, ZEND_ISSET_ISEMPTY_PROP_OBJ, VAR|
|
Line 4601 ZEND_VM_HANDLER(148, ZEND_ISSET_ISEMPTY_PROP_OBJ, VAR|
|
ZEND_VM_HANDLER(79, ZEND_EXIT, CONST|TMP|VAR|UNUSED|CV, ANY) |
ZEND_VM_HANDLER(79, ZEND_EXIT, CONST|TMP|VAR|UNUSED|CV, ANY) |
{ |
{ |
#if !defined(ZEND_VM_SPEC) || (OP1_TYPE != IS_UNUSED) |
#if !defined(ZEND_VM_SPEC) || (OP1_TYPE != IS_UNUSED) |
zend_op *opline = EX(opline); | USE_OPLINE |
| |
| SAVE_OPLINE(); |
if (OP1_TYPE != IS_UNUSED) { |
if (OP1_TYPE != IS_UNUSED) { |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval *ptr = GET_OP1_ZVAL_PTR(BP_VAR_R); |
zval *ptr = GET_OP1_ZVAL_PTR(BP_VAR_R); |
Line 4099 ZEND_VM_HANDLER(79, ZEND_EXIT, CONST|TMP|VAR|UNUSED|CV
|
Line 4617 ZEND_VM_HANDLER(79, ZEND_EXIT, CONST|TMP|VAR|UNUSED|CV
|
} |
} |
#endif |
#endif |
zend_bailout(); |
zend_bailout(); |
ZEND_VM_NEXT_OPCODE(); | ZEND_VM_NEXT_OPCODE(); /* Never reached */ |
} |
} |
|
|
ZEND_VM_HANDLER(57, ZEND_BEGIN_SILENCE, ANY, ANY) |
ZEND_VM_HANDLER(57, ZEND_BEGIN_SILENCE, ANY, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
|
|
Z_LVAL(EX_T(opline->result.u.var).tmp_var) = EG(error_reporting); | SAVE_OPLINE(); |
Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_LONG; /* shouldn't be necessary */ | Z_LVAL(EX_T(opline->result.var).tmp_var) = EG(error_reporting); |
| Z_TYPE(EX_T(opline->result.var).tmp_var) = IS_LONG; /* shouldn't be necessary */ |
if (EX(old_error_reporting) == NULL) { |
if (EX(old_error_reporting) == NULL) { |
EX(old_error_reporting) = &EX_T(opline->result.u.var).tmp_var; | EX(old_error_reporting) = &EX_T(opline->result.var).tmp_var; |
} |
} |
|
|
if (EG(error_reporting)) { |
if (EG(error_reporting)) { |
zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC); | do { |
| EG(error_reporting) = 0; |
| if (!EG(error_reporting_ini_entry)) { |
| if (UNEXPECTED(zend_hash_find(EG(ini_directives), "error_reporting", sizeof("error_reporting"), (void **) &EG(error_reporting_ini_entry)) == FAILURE)) { |
| break; |
| } |
| } |
| if (!EG(error_reporting_ini_entry)->modified) { |
| if (!EG(modified_ini_directives)) { |
| ALLOC_HASHTABLE(EG(modified_ini_directives)); |
| zend_hash_init(EG(modified_ini_directives), 8, NULL, NULL, 0); |
| } |
| if (EXPECTED(zend_hash_add(EG(modified_ini_directives), "error_reporting", sizeof("error_reporting"), &EG(error_reporting_ini_entry), sizeof(zend_ini_entry*), NULL) == SUCCESS)) { |
| EG(error_reporting_ini_entry)->orig_value = EG(error_reporting_ini_entry)->value; |
| EG(error_reporting_ini_entry)->orig_value_length = EG(error_reporting_ini_entry)->value_length; |
| EG(error_reporting_ini_entry)->orig_modifiable = EG(error_reporting_ini_entry)->modifiable; |
| EG(error_reporting_ini_entry)->modified = 1; |
| } |
| } else if (EG(error_reporting_ini_entry)->value != EG(error_reporting_ini_entry)->orig_value) { |
| efree(EG(error_reporting_ini_entry)->value); |
| } |
| EG(error_reporting_ini_entry)->value = estrndup("0", sizeof("0")-1); |
| EG(error_reporting_ini_entry)->value_length = sizeof("0")-1; |
| } while (0); |
} |
} |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(142, ZEND_RAISE_ABSTRACT_ERROR, ANY, ANY) |
ZEND_VM_HANDLER(142, ZEND_RAISE_ABSTRACT_ERROR, ANY, ANY) |
{ |
{ |
|
SAVE_OPLINE(); |
zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EG(scope)->name, EX(op_array)->function_name); |
zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EG(scope)->name, EX(op_array)->function_name); |
ZEND_VM_NEXT_OPCODE(); /* Never reached */ |
ZEND_VM_NEXT_OPCODE(); /* Never reached */ |
} |
} |
|
|
ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY) |
ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zval restored_error_reporting; |
zval restored_error_reporting; |
|
|
if (!EG(error_reporting) && Z_LVAL(EX_T(opline->op1.u.var).tmp_var) != 0) { | SAVE_OPLINE(); |
| if (!EG(error_reporting) && Z_LVAL(EX_T(opline->op1.var).tmp_var) != 0) { |
Z_TYPE(restored_error_reporting) = IS_LONG; |
Z_TYPE(restored_error_reporting) = IS_LONG; |
Z_LVAL(restored_error_reporting) = Z_LVAL(EX_T(opline->op1.u.var).tmp_var); | Z_LVAL(restored_error_reporting) = Z_LVAL(EX_T(opline->op1.var).tmp_var); |
| EG(error_reporting) = Z_LVAL(restored_error_reporting); |
convert_to_string(&restored_error_reporting); |
convert_to_string(&restored_error_reporting); |
zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC); | if (EXPECTED(EG(error_reporting_ini_entry) != NULL)) { |
zendi_zval_dtor(restored_error_reporting); | if (EXPECTED(EG(error_reporting_ini_entry)->modified && |
| EG(error_reporting_ini_entry)->value != EG(error_reporting_ini_entry)->orig_value)) { |
| efree(EG(error_reporting_ini_entry)->value); |
| } |
| EG(error_reporting_ini_entry)->value = Z_STRVAL(restored_error_reporting); |
| EG(error_reporting_ini_entry)->value_length = Z_STRLEN(restored_error_reporting); |
| } else { |
| zendi_zval_dtor(restored_error_reporting); |
| } |
} |
} |
if (EX(old_error_reporting) == &EX_T(opline->op1.u.var).tmp_var) { | if (EX(old_error_reporting) == &EX_T(opline->op1.var).tmp_var) { |
EX(old_error_reporting) = NULL; |
EX(old_error_reporting) = NULL; |
} |
} |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(152, ZEND_JMP_SET, CONST|TMP|VAR|CV, ANY) |
ZEND_VM_HANDLER(152, ZEND_JMP_SET, CONST|TMP|VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval *value = GET_OP1_ZVAL_PTR(BP_VAR_R); | zval *value; |
|
|
|
SAVE_OPLINE(); |
|
value = GET_OP1_ZVAL_PTR(BP_VAR_R); |
|
|
if (i_zend_is_true(value)) { |
if (i_zend_is_true(value)) { |
EX_T(opline->result.u.var).tmp_var = *value; | ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, value); |
zendi_zval_copy_ctor(EX_T(opline->result.u.var).tmp_var); | if (!IS_OP1_TMP_FREE()) { |
FREE_OP1(); | zendi_zval_copy_ctor(EX_T(opline->result.var).tmp_var); |
| } |
| FREE_OP1_IF_VAR(); |
#if DEBUG_ZEND>=2 |
#if DEBUG_ZEND>=2 |
printf("Conditional jmp to %d\n", opline->op2.u.opline_num); | printf("Conditional jmp to %d\n", opline->op2.opline_num); |
#endif |
#endif |
ZEND_VM_JMP(opline->op2.u.jmp_addr); | ZEND_VM_JMP(opline->op2.jmp_addr); |
} |
} |
|
|
FREE_OP1(); |
FREE_OP1(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
|
ZEND_VM_HANDLER(158, ZEND_JMP_SET_VAR, CONST|TMP|VAR|CV, ANY) |
|
{ |
|
USE_OPLINE |
|
zend_free_op free_op1; |
|
zval *value, *ret; |
|
|
|
SAVE_OPLINE(); |
|
value = GET_OP1_ZVAL_PTR(BP_VAR_R); |
|
|
|
if (i_zend_is_true(value)) { |
|
if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) { |
|
Z_ADDREF_P(value); |
|
EX_T(opline->result.var).var.ptr = value; |
|
EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr; |
|
} else { |
|
ALLOC_ZVAL(ret); |
|
INIT_PZVAL_COPY(ret, value); |
|
EX_T(opline->result.var).var.ptr = ret; |
|
EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr; |
|
if (!IS_OP1_TMP_FREE()) { |
|
zval_copy_ctor(EX_T(opline->result.var).var.ptr); |
|
} |
|
} |
|
FREE_OP1_IF_VAR(); |
|
#if DEBUG_ZEND>=2 |
|
printf("Conditional jmp to %d\n", opline->op2.opline_num); |
|
#endif |
|
ZEND_VM_JMP(opline->op2.jmp_addr); |
|
} |
|
|
|
FREE_OP1(); |
|
CHECK_EXCEPTION(); |
|
ZEND_VM_NEXT_OPCODE(); |
|
} |
|
|
ZEND_VM_HANDLER(22, ZEND_QM_ASSIGN, CONST|TMP|VAR|CV, ANY) |
ZEND_VM_HANDLER(22, ZEND_QM_ASSIGN, CONST|TMP|VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval *value = GET_OP1_ZVAL_PTR(BP_VAR_R); | zval *value; |
|
|
EX_T(opline->result.u.var).tmp_var = *value; | SAVE_OPLINE(); |
| value = GET_OP1_ZVAL_PTR(BP_VAR_R); |
| |
| ZVAL_COPY_VALUE(&EX_T(opline->result.var).tmp_var, value); |
if (!IS_OP1_TMP_FREE()) { |
if (!IS_OP1_TMP_FREE()) { |
zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); | zval_copy_ctor(&EX_T(opline->result.var).tmp_var); |
} |
} |
FREE_OP1_IF_VAR(); |
FREE_OP1_IF_VAR(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
|
ZEND_VM_HANDLER(157, ZEND_QM_ASSIGN_VAR, CONST|TMP|VAR|CV, ANY) |
|
{ |
|
USE_OPLINE |
|
zend_free_op free_op1; |
|
zval *value, *ret; |
|
|
|
SAVE_OPLINE(); |
|
value = GET_OP1_ZVAL_PTR(BP_VAR_R); |
|
|
|
if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) { |
|
Z_ADDREF_P(value); |
|
EX_T(opline->result.var).var.ptr = value; |
|
EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr; |
|
} else { |
|
ALLOC_ZVAL(ret); |
|
INIT_PZVAL_COPY(ret, value); |
|
EX_T(opline->result.var).var.ptr = ret; |
|
EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr; |
|
if (!IS_OP1_TMP_FREE()) { |
|
zval_copy_ctor(EX_T(opline->result.var).var.ptr); |
|
} |
|
} |
|
|
|
FREE_OP1_IF_VAR(); |
|
CHECK_EXCEPTION(); |
|
ZEND_VM_NEXT_OPCODE(); |
|
} |
|
|
ZEND_VM_HANDLER(101, ZEND_EXT_STMT, ANY, ANY) |
ZEND_VM_HANDLER(101, ZEND_EXT_STMT, ANY, ANY) |
{ |
{ |
|
SAVE_OPLINE(); |
if (!EG(no_extensions)) { |
if (!EG(no_extensions)) { |
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_statement_handler, EX(op_array) TSRMLS_CC); |
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_statement_handler, EX(op_array) TSRMLS_CC); |
} |
} |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(102, ZEND_EXT_FCALL_BEGIN, ANY, ANY) |
ZEND_VM_HANDLER(102, ZEND_EXT_FCALL_BEGIN, ANY, ANY) |
{ |
{ |
|
SAVE_OPLINE(); |
if (!EG(no_extensions)) { |
if (!EG(no_extensions)) { |
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_begin_handler, EX(op_array) TSRMLS_CC); |
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_begin_handler, EX(op_array) TSRMLS_CC); |
} |
} |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(103, ZEND_EXT_FCALL_END, ANY, ANY) |
ZEND_VM_HANDLER(103, ZEND_EXT_FCALL_END, ANY, ANY) |
{ |
{ |
|
SAVE_OPLINE(); |
if (!EG(no_extensions)) { |
if (!EG(no_extensions)) { |
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_end_handler, EX(op_array) TSRMLS_CC); |
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_end_handler, EX(op_array) TSRMLS_CC); |
} |
} |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(139, ZEND_DECLARE_CLASS, ANY, ANY) |
ZEND_VM_HANDLER(139, ZEND_DECLARE_CLASS, ANY, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
|
|
EX_T(opline->result.u.var).class_entry = do_bind_class(opline, EG(class_table), 0 TSRMLS_CC); | SAVE_OPLINE(); |
| EX_T(opline->result.var).class_entry = do_bind_class(EX(op_array), opline, EG(class_table), 0 TSRMLS_CC); |
| CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(140, ZEND_DECLARE_INHERITED_CLASS, ANY, ANY) |
ZEND_VM_HANDLER(140, ZEND_DECLARE_INHERITED_CLASS, ANY, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
|
|
EX_T(opline->result.u.var).class_entry = do_bind_inherited_class(opline, EG(class_table), EX_T(opline->extended_value).class_entry, 0 TSRMLS_CC); | SAVE_OPLINE(); |
| EX_T(opline->result.var).class_entry = do_bind_inherited_class(EX(op_array), opline, EG(class_table), EX_T(opline->extended_value).class_entry, 0 TSRMLS_CC); |
| CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(145, ZEND_DECLARE_INHERITED_CLASS_DELAYED, ANY, ANY) |
ZEND_VM_HANDLER(145, ZEND_DECLARE_INHERITED_CLASS_DELAYED, ANY, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_class_entry **pce, **pce_orig; |
zend_class_entry **pce, **pce_orig; |
|
|
if (zend_hash_find(EG(class_table), Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)+1, (void**)&pce) == FAILURE || | SAVE_OPLINE(); |
(zend_hash_find(EG(class_table), Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), (void**)&pce_orig) == SUCCESS && | if (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv)+1, Z_HASH_P(opline->op2.zv), (void**)&pce) == FAILURE || |
| (zend_hash_quick_find(EG(class_table), Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void**)&pce_orig) == SUCCESS && |
*pce != *pce_orig)) { |
*pce != *pce_orig)) { |
do_bind_inherited_class(opline, EG(class_table), EX_T(opline->extended_value).class_entry, 0 TSRMLS_CC); | do_bind_inherited_class(EX(op_array), opline, EG(class_table), EX_T(opline->extended_value).class_entry, 0 TSRMLS_CC); |
} |
} |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(141, ZEND_DECLARE_FUNCTION, ANY, ANY) |
ZEND_VM_HANDLER(141, ZEND_DECLARE_FUNCTION, ANY, ANY) |
{ |
{ |
do_bind_function(EX(opline), EG(function_table), 0); | USE_OPLINE |
| |
| SAVE_OPLINE(); |
| do_bind_function(EX(op_array), opline, EG(function_table), 0); |
| CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(105, ZEND_TICKS, CONST, ANY) | ZEND_VM_HANDLER(105, ZEND_TICKS, ANY, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
|
|
if (++EG(ticks_count)>=Z_LVAL(opline->op1.u.constant)) { | SAVE_OPLINE(); |
| if (++EG(ticks_count)>=opline->extended_value) { |
EG(ticks_count)=0; |
EG(ticks_count)=0; |
if (zend_ticks_function) { |
if (zend_ticks_function) { |
zend_ticks_function(Z_LVAL(opline->op1.u.constant)); | zend_ticks_function(opline->extended_value); |
} |
} |
} |
} |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(138, ZEND_INSTANCEOF, TMP|VAR|CV, ANY) |
ZEND_VM_HANDLER(138, ZEND_INSTANCEOF, TMP|VAR|CV, ANY) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1; |
zend_free_op free_op1; |
zval *expr = GET_OP1_ZVAL_PTR(BP_VAR_R); | zval *expr; |
zend_bool result; |
zend_bool result; |
|
|
|
SAVE_OPLINE(); |
|
expr = GET_OP1_ZVAL_PTR(BP_VAR_R); |
|
|
if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->get_class_entry) { |
if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->get_class_entry) { |
result = instanceof_function(Z_OBJCE_P(expr), EX_T(opline->op2.u.var).class_entry TSRMLS_CC); | result = instanceof_function(Z_OBJCE_P(expr), EX_T(opline->op2.var).class_entry TSRMLS_CC); |
} else { |
} else { |
result = 0; |
result = 0; |
} |
} |
ZVAL_BOOL(&EX_T(opline->result.u.var).tmp_var, result); | ZVAL_BOOL(&EX_T(opline->result.var).tmp_var, result); |
FREE_OP1(); |
FREE_OP1(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
Line 4277 ZEND_VM_HANDLER(0, ZEND_NOP, ANY, ANY)
|
Line 4927 ZEND_VM_HANDLER(0, ZEND_NOP, ANY, ANY)
|
|
|
ZEND_VM_HANDLER(144, ZEND_ADD_INTERFACE, ANY, CONST) |
ZEND_VM_HANDLER(144, ZEND_ADD_INTERFACE, ANY, CONST) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_class_entry *ce = EX_T(opline->op1.u.var).class_entry; | zend_class_entry *ce = EX_T(opline->op1.var).class_entry; |
zend_class_entry *iface = zend_fetch_class(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant), opline->extended_value TSRMLS_CC); | zend_class_entry *iface; |
|
|
if (iface) { | SAVE_OPLINE(); |
if (!(iface->ce_flags & ZEND_ACC_INTERFACE)) { | if (CACHED_PTR(opline->op2.literal->cache_slot)) { |
zend_error_noreturn(E_ERROR, "%s cannot implement %s - it is not an interface", ce->name, iface->name); | iface = CACHED_PTR(opline->op2.literal->cache_slot); |
| } else { |
| iface = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), Z_STRLEN_P(opline->op2.zv), opline->op2.literal + 1, opline->extended_value TSRMLS_CC); |
| if (UNEXPECTED(iface == NULL)) { |
| CHECK_EXCEPTION(); |
| ZEND_VM_NEXT_OPCODE(); |
} |
} |
zend_do_implement_interface(ce, iface TSRMLS_CC); | CACHE_PTR(opline->op2.literal->cache_slot, iface); |
} |
} |
|
|
|
if (UNEXPECTED((iface->ce_flags & ZEND_ACC_INTERFACE) == 0)) { |
|
zend_error_noreturn(E_ERROR, "%s cannot implement %s - it is not an interface", ce->name, iface->name); |
|
} |
|
zend_do_implement_interface(ce, iface TSRMLS_CC); |
|
|
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
|
ZEND_VM_HANDLER(154, ZEND_ADD_TRAIT, ANY, ANY) |
|
{ |
|
USE_OPLINE |
|
zend_class_entry *ce = EX_T(opline->op1.var).class_entry; |
|
zend_class_entry *trait; |
|
|
|
SAVE_OPLINE(); |
|
if (CACHED_PTR(opline->op2.literal->cache_slot)) { |
|
trait = CACHED_PTR(opline->op2.literal->cache_slot); |
|
} else { |
|
trait = zend_fetch_class_by_name(Z_STRVAL_P(opline->op2.zv), |
|
Z_STRLEN_P(opline->op2.zv), |
|
opline->op2.literal + 1, |
|
opline->extended_value TSRMLS_CC); |
|
if (UNEXPECTED(trait == NULL)) { |
|
CHECK_EXCEPTION(); |
|
ZEND_VM_NEXT_OPCODE(); |
|
} |
|
if (!((trait->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT)) { |
|
zend_error_noreturn(E_ERROR, "%s cannot use %s - it is not a trait", ce->name, trait->name); |
|
} |
|
CACHE_PTR(opline->op2.literal->cache_slot, trait); |
|
} |
|
|
|
zend_do_implement_trait(ce, trait TSRMLS_CC); |
|
|
|
CHECK_EXCEPTION(); |
|
ZEND_VM_NEXT_OPCODE(); |
|
} |
|
|
|
ZEND_VM_HANDLER(155, ZEND_BIND_TRAITS, ANY, ANY) |
|
{ |
|
USE_OPLINE |
|
zend_class_entry *ce = EX_T(opline->op1.var).class_entry; |
|
|
|
SAVE_OPLINE(); |
|
zend_do_bind_traits(ce TSRMLS_CC); |
|
CHECK_EXCEPTION(); |
|
ZEND_VM_NEXT_OPCODE(); |
|
} |
|
|
ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) |
ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) |
{ |
{ |
zend_uint op_num = EG(opline_before_exception)-EG(active_op_array)->opcodes; |
zend_uint op_num = EG(opline_before_exception)-EG(active_op_array)->opcodes; |
int i; |
int i; |
zend_uint catch_op_num; | zend_uint catch_op_num = 0; |
int catched = 0; |
int catched = 0; |
zval restored_error_reporting; |
zval restored_error_reporting; |
| |
void **stack_frame = (void**)(((char*)EX(Ts)) + | void **stack_frame = (void**)(((char*)EX_Ts()) + |
(ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * EX(op_array)->T)); |
(ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * EX(op_array)->T)); |
|
|
while (zend_vm_stack_top(TSRMLS_C) != stack_frame) { |
while (zend_vm_stack_top(TSRMLS_C) != stack_frame) { |
Line 4311 ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
|
Line 5013 ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
|
if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { |
if (EG(active_op_array)->try_catch_array[i].try_op > op_num) { |
/* further blocks will not be relevant... */ |
/* further blocks will not be relevant... */ |
break; |
break; |
} | } else if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) { |
if (op_num >= EG(active_op_array)->try_catch_array[i].try_op | |
&& op_num < EG(active_op_array)->try_catch_array[i].catch_op) { | |
catch_op_num = EX(op_array)->try_catch_array[i].catch_op; |
catch_op_num = EX(op_array)->try_catch_array[i].catch_op; |
catched = 1; |
catched = 1; |
} |
} |
Line 4349 ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
|
Line 5049 ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
|
|
|
switch (brk_opline->opcode) { |
switch (brk_opline->opcode) { |
case ZEND_SWITCH_FREE: |
case ZEND_SWITCH_FREE: |
if (brk_opline->op1.u.EA.type != EXT_TYPE_FREE_ON_RETURN) { | if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { |
zend_switch_free(&EX_T(brk_opline->op1.u.var), brk_opline->extended_value TSRMLS_CC); | zval_ptr_dtor(&EX_T(brk_opline->op1.var).var.ptr); |
} |
} |
break; |
break; |
case ZEND_FREE: |
case ZEND_FREE: |
if (brk_opline->op1.u.EA.type != EXT_TYPE_FREE_ON_RETURN) { | if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { |
zendi_zval_dtor(EX_T(brk_opline->op1.u.var).tmp_var); | zendi_zval_dtor(EX_T(brk_opline->op1.var).tmp_var); |
} |
} |
break; |
break; |
} |
} |
Line 4383 ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
|
Line 5083 ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
|
|
|
ZEND_VM_HANDLER(146, ZEND_VERIFY_ABSTRACT_CLASS, ANY, ANY) |
ZEND_VM_HANDLER(146, ZEND_VERIFY_ABSTRACT_CLASS, ANY, ANY) |
{ |
{ |
zend_verify_abstract_class(EX_T(EX(opline)->op1.u.var).class_entry TSRMLS_CC); | USE_OPLINE |
| |
| SAVE_OPLINE(); |
| zend_verify_abstract_class(EX_T(opline->op1.var).class_entry TSRMLS_CC); |
| CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(150, ZEND_USER_OPCODE, ANY, ANY) |
ZEND_VM_HANDLER(150, ZEND_USER_OPCODE, ANY, ANY) |
{ |
{ |
int ret = zend_user_opcode_handlers[EX(opline)->opcode](ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL); | USE_OPLINE |
| int ret; |
|
|
|
SAVE_OPLINE(); |
|
ret = zend_user_opcode_handlers[opline->opcode](ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL); |
|
LOAD_OPLINE(); |
|
|
switch (ret) { |
switch (ret) { |
case ZEND_USER_OPCODE_CONTINUE: |
case ZEND_USER_OPCODE_CONTINUE: |
ZEND_VM_CONTINUE(); |
ZEND_VM_CONTINUE(); |
Line 4401 ZEND_VM_HANDLER(150, ZEND_USER_OPCODE, ANY, ANY)
|
Line 5110 ZEND_VM_HANDLER(150, ZEND_USER_OPCODE, ANY, ANY)
|
case ZEND_USER_OPCODE_LEAVE: |
case ZEND_USER_OPCODE_LEAVE: |
ZEND_VM_LEAVE(); |
ZEND_VM_LEAVE(); |
case ZEND_USER_OPCODE_DISPATCH: |
case ZEND_USER_OPCODE_DISPATCH: |
ZEND_VM_DISPATCH(EX(opline)->opcode, EX(opline)); | ZEND_VM_DISPATCH(opline->opcode, opline); |
default: |
default: |
ZEND_VM_DISPATCH((zend_uchar)(ret & 0xff), EX(opline)); | ZEND_VM_DISPATCH((zend_uchar)(ret & 0xff), opline); |
} |
} |
} |
} |
|
|
ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST) |
ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_free_op free_op1, free_op2; |
zend_free_op free_op1, free_op2; |
zval *name = GET_OP1_ZVAL_PTR(BP_VAR_R); | zval *name; |
zval *val = GET_OP2_ZVAL_PTR(BP_VAR_R); | zval *val; |
zend_constant c; |
zend_constant c; |
|
|
|
SAVE_OPLINE(); |
|
name = GET_OP1_ZVAL_PTR(BP_VAR_R); |
|
val = GET_OP2_ZVAL_PTR(BP_VAR_R); |
|
|
if ((Z_TYPE_P(val) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT || Z_TYPE_P(val) == IS_CONSTANT_ARRAY) { |
if ((Z_TYPE_P(val) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT || Z_TYPE_P(val) == IS_CONSTANT_ARRAY) { |
zval tmp = *val; | zval tmp; |
zval *tmp_ptr = &tmp; |
zval *tmp_ptr = &tmp; |
|
|
|
ZVAL_COPY_VALUE(&tmp, val); |
if (Z_TYPE_P(val) == IS_CONSTANT_ARRAY) { |
if (Z_TYPE_P(val) == IS_CONSTANT_ARRAY) { |
zval_copy_ctor(&tmp); |
zval_copy_ctor(&tmp); |
} |
} |
Line 4426 ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST)
|
Line 5140 ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST)
|
zval_update_constant(&tmp_ptr, NULL TSRMLS_CC); |
zval_update_constant(&tmp_ptr, NULL TSRMLS_CC); |
c.value = *tmp_ptr; |
c.value = *tmp_ptr; |
} else { |
} else { |
c.value = *val; | INIT_PZVAL_COPY(&c.value, val); |
zval_copy_ctor(&c.value); |
zval_copy_ctor(&c.value); |
} |
} |
c.flags = CONST_CS; /* non persistent, case sensetive */ |
c.flags = CONST_CS; /* non persistent, case sensetive */ |
c.name = zend_strndup(Z_STRVAL_P(name), Z_STRLEN_P(name)); | c.name = IS_INTERNED(Z_STRVAL_P(name)) ? Z_STRVAL_P(name) : zend_strndup(Z_STRVAL_P(name), Z_STRLEN_P(name)); |
c.name_len = Z_STRLEN_P(name)+1; |
c.name_len = Z_STRLEN_P(name)+1; |
c.module_number = PHP_USER_CONSTANT; |
c.module_number = PHP_USER_CONSTANT; |
|
|
Line 4439 ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST)
|
Line 5153 ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST)
|
|
|
FREE_OP1(); |
FREE_OP1(); |
FREE_OP2(); |
FREE_OP2(); |
|
CHECK_EXCEPTION(); |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|
ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, CONST) | ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED) |
{ |
{ |
zend_op *opline = EX(opline); | USE_OPLINE |
zend_function *op_array; |
zend_function *op_array; |
|
|
if (zend_hash_quick_find(EG(function_table), Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), Z_LVAL(opline->op2.u.constant), (void *) &op_array) == FAILURE || | SAVE_OPLINE(); |
op_array->type != ZEND_USER_FUNCTION) { | |
| if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL_P(opline->op1.zv), Z_STRLEN_P(opline->op1.zv), Z_HASH_P(opline->op1.zv), (void *) &op_array) == FAILURE) || |
| UNEXPECTED(op_array->type != ZEND_USER_FUNCTION)) { |
zend_error_noreturn(E_ERROR, "Base lambda function for closure not found"); |
zend_error_noreturn(E_ERROR, "Base lambda function for closure not found"); |
} |
} |
|
|
zend_create_closure(&EX_T(opline->result.u.var).tmp_var, op_array TSRMLS_CC); | zend_create_closure(&EX_T(opline->result.var).tmp_var, op_array, EG(scope), EG(This) TSRMLS_CC); |
|
|
|
CHECK_EXCEPTION(); |
|
ZEND_VM_NEXT_OPCODE(); |
|
} |
|
|
|
ZEND_VM_HANDLER(156, ZEND_SEPARATE, VAR, UNUSED) |
|
{ |
|
USE_OPLINE |
|
zval *var_ptr, *new_zv; |
|
|
|
SAVE_OPLINE(); |
|
var_ptr = EX_T(opline->op1.var).var.ptr; |
|
if (Z_TYPE_P(var_ptr) != IS_OBJECT && |
|
!PZVAL_IS_REF(var_ptr) && |
|
Z_REFCOUNT_P(var_ptr) > 1) { |
|
|
|
Z_DELREF_P(var_ptr); |
|
ALLOC_ZVAL(new_zv); |
|
INIT_PZVAL_COPY(new_zv, var_ptr); |
|
var_ptr = new_zv; |
|
zval_copy_ctor(var_ptr); |
|
EX_T(opline->op1.var).var.ptr = var_ptr; |
|
} |
ZEND_VM_NEXT_OPCODE(); |
ZEND_VM_NEXT_OPCODE(); |
} |
} |
|
|