2005-01-10 22:57:36 +08:00
/*
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
| Zend Engine |
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
2018-01-02 12:57:58 +08:00
| Copyright ( c ) 1998 - 2018 Zend Technologies Ltd . ( http : //www.zend.com) |
2005-01-10 22:57:36 +08:00
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
| 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 |
| available through the world - wide - web at the following url : |
| http : //www.zend.com/license/2_00.txt. |
| If you did not receive a copy of the Zend license and are unable to |
| obtain it through the world - wide - web , please send a note to |
| license @ zend . com so we can mail you a copy immediately . |
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
| Authors : Andi Gutmans < andi @ zend . com > |
2005-10-28 14:05:57 +08:00
| Zeev Suraski < zeev @ zend . com > |
| Dmitry Stogov < dmitry @ zend . com > |
2005-01-10 22:57:36 +08:00
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
*/
/* $Id$ */
2005-06-06 23:17:20 +08:00
/* If you change this file, please regenerate the zend_vm_execute.h and
* zend_vm_opcodes . h files by running :
* php zend_vm_gen . php
*/
2017-12-15 19:40:19 +08:00
ZEND_VM_HANDLER ( 1 , ZEND_ADD , CONST | TMPVAR | CV , CONST | TMPVAR | CV )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2015-03-17 23:53:19 +08:00
zval * op1 , * op2 , * result ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2015-04-14 18:09:31 +08:00
if ( EXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_LONG ) ) {
if ( EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_LONG ) ) {
2015-03-17 23:53:19 +08:00
result = EX_VAR ( opline - > result . var ) ;
fast_long_add_function ( result , op1 , op2 ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
2015-04-14 18:09:31 +08:00
} else if ( EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_DOUBLE ) ) {
2015-03-17 23:53:19 +08:00
result = EX_VAR ( opline - > result . var ) ;
ZVAL_DOUBLE ( result , ( ( double ) Z_LVAL_P ( op1 ) ) + Z_DVAL_P ( op2 ) ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2015-04-14 18:09:31 +08:00
} else if ( EXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_DOUBLE ) ) {
if ( EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_DOUBLE ) ) {
2015-03-17 23:53:19 +08:00
result = EX_VAR ( opline - > result . var ) ;
ZVAL_DOUBLE ( result , Z_DVAL_P ( op1 ) + Z_DVAL_P ( op2 ) ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
2015-04-14 18:09:31 +08:00
} else if ( EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_LONG ) ) {
2015-03-17 23:53:19 +08:00
result = EX_VAR ( opline - > result . var ) ;
ZVAL_DOUBLE ( result , Z_DVAL_P ( op1 ) + ( ( double ) Z_LVAL_P ( op2 ) ) ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
}
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2015-04-14 18:09:31 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_UNDEF ) ) {
2015-03-17 23:53:19 +08:00
op1 = GET_OP1_UNDEF_CV ( op1 , BP_VAR_R ) ;
}
2015-04-14 18:09:31 +08:00
if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_UNDEF ) ) {
2015-03-17 23:53:19 +08:00
op2 = GET_OP2_UNDEF_CV ( op2 , BP_VAR_R ) ;
}
add_function ( EX_VAR ( opline - > result . var ) , op1 , op2 ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1 ( ) ;
FREE_OP2 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2014-12-03 23:02:02 +08:00
ZEND_VM_HANDLER ( 2 , ZEND_SUB , CONST | TMPVAR | CV , CONST | TMPVAR | CV )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2015-03-17 23:53:19 +08:00
zval * op1 , * op2 , * result ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2015-04-14 18:09:31 +08:00
if ( EXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_LONG ) ) {
if ( EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_LONG ) ) {
2015-03-17 23:53:19 +08:00
result = EX_VAR ( opline - > result . var ) ;
fast_long_sub_function ( result , op1 , op2 ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
2015-04-14 18:09:31 +08:00
} else if ( EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_DOUBLE ) ) {
2015-03-17 23:53:19 +08:00
result = EX_VAR ( opline - > result . var ) ;
ZVAL_DOUBLE ( result , ( ( double ) Z_LVAL_P ( op1 ) ) - Z_DVAL_P ( op2 ) ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2015-04-14 18:09:31 +08:00
} else if ( EXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_DOUBLE ) ) {
if ( EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_DOUBLE ) ) {
2015-03-17 23:53:19 +08:00
result = EX_VAR ( opline - > result . var ) ;
ZVAL_DOUBLE ( result , Z_DVAL_P ( op1 ) - Z_DVAL_P ( op2 ) ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
2015-04-14 18:09:31 +08:00
} else if ( EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_LONG ) ) {
2015-03-17 23:53:19 +08:00
result = EX_VAR ( opline - > result . var ) ;
ZVAL_DOUBLE ( result , Z_DVAL_P ( op1 ) - ( ( double ) Z_LVAL_P ( op2 ) ) ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
}
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2015-04-14 18:09:31 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_UNDEF ) ) {
2015-03-17 23:53:19 +08:00
op1 = GET_OP1_UNDEF_CV ( op1 , BP_VAR_R ) ;
}
2015-04-14 18:09:31 +08:00
if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_UNDEF ) ) {
2015-03-17 23:53:19 +08:00
op2 = GET_OP2_UNDEF_CV ( op2 , BP_VAR_R ) ;
}
sub_function ( EX_VAR ( opline - > result . var ) , op1 , op2 ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1 ( ) ;
FREE_OP2 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2017-12-15 18:42:54 +08:00
ZEND_VM_HANDLER ( 3 , ZEND_MUL , CONST | TMPVAR | CV , CONST | TMPVAR | CV , SPEC ( COMMUTATIVE ) )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2015-03-17 23:53:19 +08:00
zval * op1 , * op2 , * result ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2015-04-14 18:09:31 +08:00
if ( EXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_LONG ) ) {
if ( EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_LONG ) ) {
2015-03-17 23:53:19 +08:00
zend_long overflow ;
result = EX_VAR ( opline - > result . var ) ;
ZEND_SIGNED_MULTIPLY_LONG ( Z_LVAL_P ( op1 ) , Z_LVAL_P ( op2 ) , Z_LVAL_P ( result ) , Z_DVAL_P ( result ) , overflow ) ;
Z_TYPE_INFO_P ( result ) = overflow ? IS_DOUBLE : IS_LONG ;
ZEND_VM_NEXT_OPCODE ( ) ;
2015-04-14 18:09:31 +08:00
} else if ( EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_DOUBLE ) ) {
2015-03-17 23:53:19 +08:00
result = EX_VAR ( opline - > result . var ) ;
ZVAL_DOUBLE ( result , ( ( double ) Z_LVAL_P ( op1 ) ) * Z_DVAL_P ( op2 ) ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2015-04-14 18:09:31 +08:00
} else if ( EXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_DOUBLE ) ) {
if ( EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_DOUBLE ) ) {
2015-03-17 23:53:19 +08:00
result = EX_VAR ( opline - > result . var ) ;
ZVAL_DOUBLE ( result , Z_DVAL_P ( op1 ) * Z_DVAL_P ( op2 ) ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
2015-04-14 18:09:31 +08:00
} else if ( EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_LONG ) ) {
2015-03-17 23:53:19 +08:00
result = EX_VAR ( opline - > result . var ) ;
ZVAL_DOUBLE ( result , Z_DVAL_P ( op1 ) * ( ( double ) Z_LVAL_P ( op2 ) ) ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
}
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2015-04-14 18:09:31 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_UNDEF ) ) {
2015-03-17 23:53:19 +08:00
op1 = GET_OP1_UNDEF_CV ( op1 , BP_VAR_R ) ;
}
2015-04-14 18:09:31 +08:00
if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_UNDEF ) ) {
2015-03-17 23:53:19 +08:00
op2 = GET_OP2_UNDEF_CV ( op2 , BP_VAR_R ) ;
}
mul_function ( EX_VAR ( opline - > result . var ) , op1 , op2 ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1 ( ) ;
FREE_OP2 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2014-12-03 23:02:02 +08:00
ZEND_VM_HANDLER ( 4 , ZEND_DIV , CONST | TMPVAR | CV , CONST | TMPVAR | CV )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2015-06-11 03:25:24 +08:00
zval * op1 , * op2 ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2015-06-11 03:25:24 +08:00
op1 = GET_OP1_ZVAL_PTR ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
fast_div_function ( EX_VAR ( opline - > result . var ) , op1 , op2 ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1 ( ) ;
FREE_OP2 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-21 17:07:29 +08:00
ZEND_VM_COLD_HELPER ( zend_mod_by_zero_helper , ANY , ANY )
2018-02-16 07:45:31 +08:00
{
USE_OPLINE
SAVE_OPLINE ( ) ;
zend_throw_exception_ex ( zend_ce_division_by_zero_error , 0 , " Modulo by zero " ) ;
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
HANDLE_EXCEPTION ( ) ;
}
2014-12-06 07:14:45 +08:00
ZEND_VM_HANDLER ( 5 , ZEND_MOD , CONST | TMPVAR | CV , CONST | TMPVAR | CV )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2015-03-17 23:53:19 +08:00
zval * op1 , * op2 , * result ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2015-04-14 18:09:31 +08:00
if ( EXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_LONG ) ) {
if ( EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_LONG ) ) {
2015-03-17 23:53:19 +08:00
result = EX_VAR ( opline - > result . var ) ;
if ( UNEXPECTED ( Z_LVAL_P ( op2 ) = = 0 ) ) {
2018-02-16 07:45:31 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_mod_by_zero_helper ) ;
2015-03-17 23:53:19 +08:00
} else if ( UNEXPECTED ( Z_LVAL_P ( op2 ) = = - 1 ) ) {
/* Prevent overflow error/crash if op1==ZEND_LONG_MIN */
ZVAL_LONG ( result , 0 ) ;
} else {
ZVAL_LONG ( result , Z_LVAL_P ( op1 ) % Z_LVAL_P ( op2 ) ) ;
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
}
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2015-04-14 18:09:31 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_UNDEF ) ) {
2015-03-17 23:53:19 +08:00
op1 = GET_OP1_UNDEF_CV ( op1 , BP_VAR_R ) ;
}
2015-04-14 18:09:31 +08:00
if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_UNDEF ) ) {
2015-03-17 23:53:19 +08:00
op2 = GET_OP2_UNDEF_CV ( op2 , BP_VAR_R ) ;
}
mod_function ( EX_VAR ( opline - > result . var ) , op1 , op2 ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1 ( ) ;
FREE_OP2 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2014-12-06 07:14:45 +08:00
ZEND_VM_HANDLER ( 6 , ZEND_SL , CONST | TMPVAR | CV , CONST | TMPVAR | CV )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2015-06-11 03:25:24 +08:00
zval * op1 , * op2 ;
2004-10-23 05:42:14 +08:00
2016-09-09 05:08:57 +08:00
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
if ( EXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_LONG )
& & EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_LONG )
& & EXPECTED ( ( zend_ulong ) Z_LVAL_P ( op2 ) < SIZEOF_ZEND_LONG * 8 ) ) {
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , Z_LVAL_P ( op1 ) < < Z_LVAL_P ( op2 ) ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2016-09-09 05:08:57 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_UNDEF ) ) {
op1 = GET_OP1_UNDEF_CV ( op1 , BP_VAR_R ) ;
}
if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_UNDEF ) ) {
op2 = GET_OP2_UNDEF_CV ( op2 , BP_VAR_R ) ;
}
2015-06-11 03:25:24 +08:00
shift_left_function ( EX_VAR ( opline - > result . var ) , op1 , op2 ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1 ( ) ;
FREE_OP2 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2014-12-06 07:14:45 +08:00
ZEND_VM_HANDLER ( 7 , ZEND_SR , CONST | TMPVAR | CV , CONST | TMPVAR | CV )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2015-06-11 03:25:24 +08:00
zval * op1 , * op2 ;
2004-10-23 05:42:14 +08:00
2016-09-09 05:08:57 +08:00
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
if ( EXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_LONG )
& & EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_LONG )
& & EXPECTED ( ( zend_ulong ) Z_LVAL_P ( op2 ) < SIZEOF_ZEND_LONG * 8 ) ) {
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , Z_LVAL_P ( op1 ) > > Z_LVAL_P ( op2 ) ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2016-09-09 05:08:57 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_UNDEF ) ) {
op1 = GET_OP1_UNDEF_CV ( op1 , BP_VAR_R ) ;
}
if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_UNDEF ) ) {
op2 = GET_OP2_UNDEF_CV ( op2 , BP_VAR_R ) ;
}
2015-06-11 03:25:24 +08:00
shift_right_function ( EX_VAR ( opline - > result . var ) , op1 , op2 ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1 ( ) ;
FREE_OP2 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2015-09-12 06:54:48 +08:00
ZEND_VM_HANDLER ( 166 , ZEND_POW , CONST | TMPVAR | CV , CONST | TMPVAR | CV )
{
USE_OPLINE
zend_free_op free_op1 , free_op2 ;
zval * op1 , * op2 ;
SAVE_OPLINE ( ) ;
op1 = GET_OP1_ZVAL_PTR ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
pow_function ( EX_VAR ( opline - > result . var ) , op1 , op2 ) ;
FREE_OP1 ( ) ;
FREE_OP2 ( ) ;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
}
2017-12-29 18:54:18 +08:00
ZEND_VM_HANDLER ( 8 , ZEND_CONCAT , CONST | TMPVAR | CV , CONST | TMPVAR | CV , SPEC ( NO_CONST_CONST ) )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2015-06-03 16:15:28 +08:00
zval * op1 , * op2 ;
2004-10-23 05:42:14 +08:00
2015-06-05 06:53:32 +08:00
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2015-06-03 16:15:28 +08:00
2016-12-19 20:36:37 +08:00
if ( ( OP1_TYPE = = IS_CONST | | EXPECTED ( Z_TYPE_P ( op1 ) = = IS_STRING ) ) & &
( OP2_TYPE = = IS_CONST | | EXPECTED ( Z_TYPE_P ( op2 ) = = IS_STRING ) ) ) {
zend_string * op1_str = Z_STR_P ( op1 ) ;
zend_string * op2_str = Z_STR_P ( op2 ) ;
zend_string * str ;
2015-06-03 16:15:28 +08:00
2017-11-28 19:11:40 +08:00
if ( OP1_TYPE ! = IS_CONST & & UNEXPECTED ( ZSTR_LEN ( op1_str ) = = 0 ) ) {
if ( OP2_TYPE = = IS_CONST | | OP2_TYPE = = IS_CV ) {
ZVAL_STR_COPY ( EX_VAR ( opline - > result . var ) , op2_str ) ;
} else {
ZVAL_STR ( EX_VAR ( opline - > result . var ) , op2_str ) ;
2015-06-03 16:15:28 +08:00
}
2017-11-28 19:11:40 +08:00
FREE_OP1 ( ) ;
} else if ( OP2_TYPE ! = IS_CONST & & UNEXPECTED ( ZSTR_LEN ( op2_str ) = = 0 ) ) {
if ( OP1_TYPE = = IS_CONST | | OP1_TYPE = = IS_CV ) {
ZVAL_STR_COPY ( EX_VAR ( opline - > result . var ) , op1_str ) ;
2015-06-03 16:15:28 +08:00
} else {
2017-11-28 19:11:40 +08:00
ZVAL_STR ( EX_VAR ( opline - > result . var ) , op1_str ) ;
2015-06-03 16:15:28 +08:00
}
2017-11-28 19:11:40 +08:00
FREE_OP2 ( ) ;
} else if ( OP1_TYPE ! = IS_CONST & & OP1_TYPE ! = IS_CV & &
! ZSTR_IS_INTERNED ( op1_str ) & & GC_REFCOUNT ( op1_str ) = = 1 ) {
size_t len = ZSTR_LEN ( op1_str ) ;
str = zend_string_extend ( op1_str , len + ZSTR_LEN ( op2_str ) , 0 ) ;
memcpy ( ZSTR_VAL ( str ) + len , ZSTR_VAL ( op2_str ) , ZSTR_LEN ( op2_str ) + 1 ) ;
ZVAL_NEW_STR ( EX_VAR ( opline - > result . var ) , str ) ;
FREE_OP2 ( ) ;
} else {
str = zend_string_alloc ( ZSTR_LEN ( op1_str ) + ZSTR_LEN ( op2_str ) , 0 ) ;
memcpy ( ZSTR_VAL ( str ) , ZSTR_VAL ( op1_str ) , ZSTR_LEN ( op1_str ) ) ;
memcpy ( ZSTR_VAL ( str ) + ZSTR_LEN ( op1_str ) , ZSTR_VAL ( op2_str ) , ZSTR_LEN ( op2_str ) + 1 ) ;
ZVAL_NEW_STR ( EX_VAR ( opline - > result . var ) , str ) ;
2016-12-19 20:36:37 +08:00
FREE_OP1 ( ) ;
2017-11-28 19:11:40 +08:00
FREE_OP2 ( ) ;
}
2016-12-19 20:36:37 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
} else {
SAVE_OPLINE ( ) ;
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( op1 ) = = IS_UNDEF ) ) {
op1 = GET_OP1_UNDEF_CV ( op1 , BP_VAR_R ) ;
2015-06-03 16:15:28 +08:00
}
2016-12-19 20:36:37 +08:00
if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( op2 ) = = IS_UNDEF ) ) {
op2 = GET_OP2_UNDEF_CV ( op2 , BP_VAR_R ) ;
}
concat_function ( EX_VAR ( opline - > result . var ) , op1 , op2 ) ;
2015-06-03 16:15:28 +08:00
FREE_OP1 ( ) ;
2016-12-19 20:36:37 +08:00
FREE_OP2 ( ) ;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
}
2004-10-23 05:42:14 +08:00
}
2017-12-15 18:42:54 +08:00
ZEND_VM_HANDLER ( 15 , ZEND_IS_IDENTICAL , CONST | TMP | VAR | CV , CONST | TMP | VAR | CV , SPEC ( COMMUTATIVE ) )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2015-06-11 03:25:24 +08:00
zval * op1 , * op2 ;
2015-04-29 21:43:23 +08:00
int result ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2015-10-07 04:48:12 +08:00
op1 = GET_OP1_ZVAL_PTR_DEREF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_DEREF ( BP_VAR_R ) ;
2015-06-11 03:25:24 +08:00
result = fast_is_identical_function ( op1 , op2 ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1 ( ) ;
FREE_OP2 ( ) ;
2015-10-26 11:15:17 +08:00
ZEND_VM_SMART_BRANCH ( result , 1 ) ;
2015-04-29 21:43:23 +08:00
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
2015-10-26 11:15:17 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2017-12-15 18:42:54 +08:00
ZEND_VM_HANDLER ( 16 , ZEND_IS_NOT_IDENTICAL , CONST | TMP | VAR | CV , CONST | TMP | VAR | CV , SPEC ( COMMUTATIVE ) )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2015-06-11 03:25:24 +08:00
zval * op1 , * op2 ;
2015-04-29 21:43:23 +08:00
int result ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2015-10-07 04:48:12 +08:00
op1 = GET_OP1_ZVAL_PTR_DEREF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_DEREF ( BP_VAR_R ) ;
2015-06-11 03:25:24 +08:00
result = fast_is_not_identical_function ( op1 , op2 ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1 ( ) ;
FREE_OP2 ( ) ;
2015-10-26 11:15:17 +08:00
ZEND_VM_SMART_BRANCH ( result , 1 ) ;
2015-04-29 21:43:23 +08:00
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
2015-10-26 11:15:17 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2017-12-15 18:42:54 +08:00
ZEND_VM_HANDLER ( 17 , ZEND_IS_EQUAL , CONST | TMPVAR | CV , CONST | TMPVAR | CV , SPEC ( COMMUTATIVE ) )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2015-03-17 23:53:19 +08:00
zval * op1 , * op2 , * result ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2015-04-29 09:17:59 +08:00
do {
int result ;
2015-06-05 06:53:32 +08:00
if ( EXPECTED ( Z_TYPE_P ( op1 ) = = IS_LONG ) ) {
if ( EXPECTED ( Z_TYPE_P ( op2 ) = = IS_LONG ) ) {
2015-04-29 09:17:59 +08:00
result = ( Z_LVAL_P ( op1 ) = = Z_LVAL_P ( op2 ) ) ;
2015-06-05 06:53:32 +08:00
} else if ( EXPECTED ( Z_TYPE_P ( op2 ) = = IS_DOUBLE ) ) {
2015-04-29 09:17:59 +08:00
result = ( ( double ) Z_LVAL_P ( op1 ) = = Z_DVAL_P ( op2 ) ) ;
} else {
break ;
}
2015-06-05 06:53:32 +08:00
} else if ( EXPECTED ( Z_TYPE_P ( op1 ) = = IS_DOUBLE ) ) {
if ( EXPECTED ( Z_TYPE_P ( op2 ) = = IS_DOUBLE ) ) {
2015-04-29 09:17:59 +08:00
result = ( Z_DVAL_P ( op1 ) = = Z_DVAL_P ( op2 ) ) ;
2015-06-05 06:53:32 +08:00
} else if ( EXPECTED ( Z_TYPE_P ( op2 ) = = IS_LONG ) ) {
2015-04-29 09:17:59 +08:00
result = ( Z_DVAL_P ( op1 ) = = ( ( double ) Z_LVAL_P ( op2 ) ) ) ;
} else {
break ;
}
} else if ( EXPECTED ( Z_TYPE_P ( op1 ) = = IS_STRING ) ) {
if ( EXPECTED ( Z_TYPE_P ( op2 ) = = IS_STRING ) ) {
2017-12-04 22:17:02 +08:00
result = zend_fast_equal_strings ( Z_STR_P ( op1 ) , Z_STR_P ( op2 ) ) ;
2015-03-17 23:53:19 +08:00
FREE_OP1 ( ) ;
FREE_OP2 ( ) ;
2015-04-29 09:17:59 +08:00
} else {
break ;
2015-03-17 23:53:19 +08:00
}
2015-04-29 09:17:59 +08:00
} else {
break ;
2015-03-17 23:53:19 +08:00
}
2015-04-29 09:17:59 +08:00
ZEND_VM_SMART_BRANCH ( result , 0 ) ;
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
} while ( 0 ) ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2015-06-05 06:53:32 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( op1 ) = = IS_UNDEF ) ) {
2015-03-17 23:53:19 +08:00
op1 = GET_OP1_UNDEF_CV ( op1 , BP_VAR_R ) ;
}
2015-06-05 06:53:32 +08:00
if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( op2 ) = = IS_UNDEF ) ) {
2015-03-17 23:53:19 +08:00
op2 = GET_OP2_UNDEF_CV ( op2 , BP_VAR_R ) ;
}
result = EX_VAR ( opline - > result . var ) ;
compare_function ( result , op1 , op2 ) ;
ZVAL_BOOL ( result , Z_LVAL_P ( result ) = = 0 ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1 ( ) ;
FREE_OP2 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2017-12-15 18:42:54 +08:00
ZEND_VM_HANDLER ( 18 , ZEND_IS_NOT_EQUAL , CONST | TMPVAR | CV , CONST | TMPVAR | CV , SPEC ( COMMUTATIVE ) )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2015-03-17 23:53:19 +08:00
zval * op1 , * op2 , * result ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2015-04-29 09:17:59 +08:00
do {
int result ;
2015-06-05 06:53:32 +08:00
if ( EXPECTED ( Z_TYPE_P ( op1 ) = = IS_LONG ) ) {
if ( EXPECTED ( Z_TYPE_P ( op2 ) = = IS_LONG ) ) {
2015-04-29 09:17:59 +08:00
result = ( Z_LVAL_P ( op1 ) ! = Z_LVAL_P ( op2 ) ) ;
2015-06-05 06:53:32 +08:00
} else if ( EXPECTED ( Z_TYPE_P ( op2 ) = = IS_DOUBLE ) ) {
2015-04-29 09:17:59 +08:00
result = ( ( double ) Z_LVAL_P ( op1 ) ! = Z_DVAL_P ( op2 ) ) ;
} else {
break ;
}
2015-06-05 06:53:32 +08:00
} else if ( EXPECTED ( Z_TYPE_P ( op1 ) = = IS_DOUBLE ) ) {
if ( EXPECTED ( Z_TYPE_P ( op2 ) = = IS_DOUBLE ) ) {
2015-04-29 09:17:59 +08:00
result = ( Z_DVAL_P ( op1 ) ! = Z_DVAL_P ( op2 ) ) ;
2015-06-05 06:53:32 +08:00
} else if ( EXPECTED ( Z_TYPE_P ( op2 ) = = IS_LONG ) ) {
2015-04-29 09:17:59 +08:00
result = ( Z_DVAL_P ( op1 ) ! = ( ( double ) Z_LVAL_P ( op2 ) ) ) ;
} else {
break ;
}
} else if ( EXPECTED ( Z_TYPE_P ( op1 ) = = IS_STRING ) ) {
if ( EXPECTED ( Z_TYPE_P ( op2 ) = = IS_STRING ) ) {
2017-12-04 22:17:02 +08:00
result = ! zend_fast_equal_strings ( Z_STR_P ( op1 ) , Z_STR_P ( op2 ) ) ;
2015-03-17 23:53:19 +08:00
FREE_OP1 ( ) ;
FREE_OP2 ( ) ;
2015-04-29 09:17:59 +08:00
} else {
break ;
2015-03-17 23:53:19 +08:00
}
2015-04-29 09:17:59 +08:00
} else {
break ;
2015-03-17 23:53:19 +08:00
}
2015-04-29 09:17:59 +08:00
ZEND_VM_SMART_BRANCH ( result , 0 ) ;
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
} while ( 0 ) ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2015-06-05 06:53:32 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( op1 ) = = IS_UNDEF ) ) {
2015-03-17 23:53:19 +08:00
op1 = GET_OP1_UNDEF_CV ( op1 , BP_VAR_R ) ;
}
2015-06-05 06:53:32 +08:00
if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( op2 ) = = IS_UNDEF ) ) {
2015-03-17 23:53:19 +08:00
op2 = GET_OP2_UNDEF_CV ( op2 , BP_VAR_R ) ;
}
result = EX_VAR ( opline - > result . var ) ;
compare_function ( result , op1 , op2 ) ;
ZVAL_BOOL ( result , Z_LVAL_P ( result ) ! = 0 ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1 ( ) ;
FREE_OP2 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2014-12-03 23:02:02 +08:00
ZEND_VM_HANDLER ( 19 , ZEND_IS_SMALLER , CONST | TMPVAR | CV , CONST | TMPVAR | CV )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2015-03-17 23:53:19 +08:00
zval * op1 , * op2 , * result ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2015-04-29 09:17:59 +08:00
do {
int result ;
if ( EXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_LONG ) ) {
if ( EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_LONG ) ) {
result = ( Z_LVAL_P ( op1 ) < Z_LVAL_P ( op2 ) ) ;
} else if ( EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_DOUBLE ) ) {
result = ( ( double ) Z_LVAL_P ( op1 ) < Z_DVAL_P ( op2 ) ) ;
} else {
break ;
}
} else if ( EXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_DOUBLE ) ) {
if ( EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_DOUBLE ) ) {
result = ( Z_DVAL_P ( op1 ) < Z_DVAL_P ( op2 ) ) ;
} else if ( EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_LONG ) ) {
result = ( Z_DVAL_P ( op1 ) < ( ( double ) Z_LVAL_P ( op2 ) ) ) ;
} else {
break ;
}
} else {
break ;
2015-03-17 23:53:19 +08:00
}
2015-04-29 09:17:59 +08:00
ZEND_VM_SMART_BRANCH ( result , 0 ) ;
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
} while ( 0 ) ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2015-04-14 18:09:31 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_UNDEF ) ) {
2015-03-17 23:53:19 +08:00
op1 = GET_OP1_UNDEF_CV ( op1 , BP_VAR_R ) ;
}
2015-04-14 18:09:31 +08:00
if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_UNDEF ) ) {
2015-03-17 23:53:19 +08:00
op2 = GET_OP2_UNDEF_CV ( op2 , BP_VAR_R ) ;
}
result = EX_VAR ( opline - > result . var ) ;
compare_function ( result , op1 , op2 ) ;
ZVAL_BOOL ( result , Z_LVAL_P ( result ) < 0 ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1 ( ) ;
FREE_OP2 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2014-12-03 23:02:02 +08:00
ZEND_VM_HANDLER ( 20 , ZEND_IS_SMALLER_OR_EQUAL , CONST | TMPVAR | CV , CONST | TMPVAR | CV )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2015-03-17 23:53:19 +08:00
zval * op1 , * op2 , * result ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2015-04-29 09:17:59 +08:00
do {
int result ;
if ( EXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_LONG ) ) {
if ( EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_LONG ) ) {
result = ( Z_LVAL_P ( op1 ) < = Z_LVAL_P ( op2 ) ) ;
} else if ( EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_DOUBLE ) ) {
result = ( ( double ) Z_LVAL_P ( op1 ) < = Z_DVAL_P ( op2 ) ) ;
} else {
break ;
}
} else if ( EXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_DOUBLE ) ) {
if ( EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_DOUBLE ) ) {
result = ( Z_DVAL_P ( op1 ) < = Z_DVAL_P ( op2 ) ) ;
} else if ( EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_LONG ) ) {
result = ( Z_DVAL_P ( op1 ) < = ( ( double ) Z_LVAL_P ( op2 ) ) ) ;
} else {
break ;
}
} else {
break ;
2015-03-17 23:53:19 +08:00
}
2015-04-29 09:17:59 +08:00
ZEND_VM_SMART_BRANCH ( result , 0 ) ;
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
} while ( 0 ) ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2015-04-14 18:09:31 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_UNDEF ) ) {
2015-03-17 23:53:19 +08:00
op1 = GET_OP1_UNDEF_CV ( op1 , BP_VAR_R ) ;
}
2015-04-14 18:09:31 +08:00
if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_UNDEF ) ) {
2015-03-17 23:53:19 +08:00
op2 = GET_OP2_UNDEF_CV ( op2 , BP_VAR_R ) ;
}
result = EX_VAR ( opline - > result . var ) ;
compare_function ( result , op1 , op2 ) ;
ZVAL_BOOL ( result , Z_LVAL_P ( result ) < = 0 ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1 ( ) ;
FREE_OP2 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2015-01-19 15:12:39 +08:00
ZEND_VM_HANDLER ( 170 , ZEND_SPACESHIP , CONST | TMPVAR | CV , CONST | TMPVAR | CV )
{
USE_OPLINE
zend_free_op free_op1 , free_op2 ;
2015-06-11 03:25:24 +08:00
zval * op1 , * op2 ;
2015-01-19 15:12:39 +08:00
SAVE_OPLINE ( ) ;
2015-06-11 03:25:24 +08:00
op1 = GET_OP1_ZVAL_PTR ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
compare_function ( EX_VAR ( opline - > result . var ) , op1 , op2 ) ;
2015-01-19 15:12:39 +08:00
FREE_OP1 ( ) ;
FREE_OP2 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2015-01-19 15:12:39 +08:00
}
2017-12-15 18:42:54 +08:00
ZEND_VM_HANDLER ( 9 , ZEND_BW_OR , CONST | TMPVAR | CV , CONST | TMPVAR | CV , SPEC ( COMMUTATIVE ) )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2015-06-11 03:25:24 +08:00
zval * op1 , * op2 ;
2004-10-23 05:42:14 +08:00
2016-09-09 05:08:57 +08:00
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
if ( EXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_LONG )
& & EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_LONG ) ) {
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , Z_LVAL_P ( op1 ) | Z_LVAL_P ( op2 ) ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2016-09-09 05:08:57 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_UNDEF ) ) {
op1 = GET_OP1_UNDEF_CV ( op1 , BP_VAR_R ) ;
}
if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_UNDEF ) ) {
op2 = GET_OP2_UNDEF_CV ( op2 , BP_VAR_R ) ;
}
2015-06-11 03:25:24 +08:00
bitwise_or_function ( EX_VAR ( opline - > result . var ) , op1 , op2 ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1 ( ) ;
FREE_OP2 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2017-12-15 18:42:54 +08:00
ZEND_VM_HANDLER ( 10 , ZEND_BW_AND , CONST | TMPVAR | CV , CONST | TMPVAR | CV , SPEC ( COMMUTATIVE ) )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2015-06-11 03:25:24 +08:00
zval * op1 , * op2 ;
2004-10-23 05:42:14 +08:00
2016-09-09 05:08:57 +08:00
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
if ( EXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_LONG )
& & EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_LONG ) ) {
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , Z_LVAL_P ( op1 ) & Z_LVAL_P ( op2 ) ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2016-09-09 05:08:57 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_UNDEF ) ) {
op1 = GET_OP1_UNDEF_CV ( op1 , BP_VAR_R ) ;
}
if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_UNDEF ) ) {
op2 = GET_OP2_UNDEF_CV ( op2 , BP_VAR_R ) ;
}
2015-06-11 03:25:24 +08:00
bitwise_and_function ( EX_VAR ( opline - > result . var ) , op1 , op2 ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1 ( ) ;
FREE_OP2 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2017-12-15 18:42:54 +08:00
ZEND_VM_HANDLER ( 11 , ZEND_BW_XOR , CONST | TMPVAR | CV , CONST | TMPVAR | CV , SPEC ( COMMUTATIVE ) )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2015-06-11 03:25:24 +08:00
zval * op1 , * op2 ;
2004-10-23 05:42:14 +08:00
2016-09-09 05:08:57 +08:00
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
if ( EXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_LONG )
& & EXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_LONG ) ) {
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , Z_LVAL_P ( op1 ) ^ Z_LVAL_P ( op2 ) ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2016-09-09 05:08:57 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_UNDEF ) ) {
op1 = GET_OP1_UNDEF_CV ( op1 , BP_VAR_R ) ;
}
if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( op2 ) = = IS_UNDEF ) ) {
op2 = GET_OP2_UNDEF_CV ( op2 , BP_VAR_R ) ;
}
2015-06-11 03:25:24 +08:00
bitwise_xor_function ( EX_VAR ( opline - > result . var ) , op1 , op2 ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1 ( ) ;
FREE_OP2 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2017-12-15 18:42:54 +08:00
ZEND_VM_HANDLER ( 14 , ZEND_BOOL_XOR , CONST | TMPVAR | CV , CONST | TMPVAR | CV , SPEC ( COMMUTATIVE ) )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2015-06-11 03:25:24 +08:00
zval * op1 , * op2 ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2015-06-11 03:25:24 +08:00
op1 = GET_OP1_ZVAL_PTR ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
boolean_xor_function ( EX_VAR ( opline - > result . var ) , op1 , op2 ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1 ( ) ;
FREE_OP2 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2014-12-06 07:14:45 +08:00
ZEND_VM_HANDLER ( 12 , ZEND_BW_NOT , CONST | TMPVAR | CV , ANY )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 ;
2016-12-19 20:36:37 +08:00
zval * op1 ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
if ( EXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_LONG ) ) {
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , ~ Z_LVAL_P ( op1 ) ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2014-02-10 14:04:30 +08:00
bitwise_not_function ( EX_VAR ( opline - > result . var ) ,
2014-12-14 06:06:14 +08:00
GET_OP1_ZVAL_PTR ( BP_VAR_R ) ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2014-12-05 22:04:15 +08:00
ZEND_VM_HANDLER ( 13 , ZEND_BOOL_NOT , CONST | TMPVAR | CV , ANY )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2014-12-05 22:04:15 +08:00
zval * val ;
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 ;
2015-04-16 01:53:27 +08:00
val = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
if ( Z_TYPE_INFO_P ( val ) = = IS_TRUE ) {
2014-12-05 22:04:15 +08:00
ZVAL_FALSE ( EX_VAR ( opline - > result . var ) ) ;
2015-04-16 01:53:27 +08:00
} else if ( EXPECTED ( Z_TYPE_INFO_P ( val ) < = IS_TRUE ) ) {
2015-07-08 23:33:58 +08:00
ZVAL_TRUE ( EX_VAR ( opline - > result . var ) ) ;
2015-12-14 07:32:40 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( val ) = = IS_UNDEF ) ) {
2015-04-16 01:53:27 +08:00
SAVE_OPLINE ( ) ;
GET_OP1_UNDEF_CV ( val , BP_VAR_R ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2015-04-16 01:53:27 +08:00
}
2014-12-05 22:04:15 +08:00
} else {
2015-04-16 01:53:27 +08:00
SAVE_OPLINE ( ) ;
2014-12-14 06:06:14 +08:00
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , ! i_zend_is_true ( val ) ) ;
2014-12-05 22:04:15 +08:00
FREE_OP1 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2014-12-05 22:04:15 +08:00
}
2004-10-23 05:42:14 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
}
2018-02-21 17:07:29 +08:00
ZEND_VM_COLD_HELPER ( zend_this_not_in_object_context_helper , ANY , ANY )
2017-06-15 21:23:05 +08:00
{
USE_OPLINE
SAVE_OPLINE ( ) ;
zend_throw_error ( NULL , " Using $this when not in object context " ) ;
if ( ( opline + 1 ) - > opcode = = ZEND_OP_DATA ) {
FREE_UNFETCHED_OP_DATA ( ) ;
}
FREE_UNFETCHED_OP2 ( ) ;
UNDEF_RESULT ( ) ;
HANDLE_EXCEPTION ( ) ;
}
2018-02-21 17:07:29 +08:00
ZEND_VM_COLD_HELPER ( zend_abstract_method_helper , ANY , ANY , zend_function * fbc )
2018-02-16 07:45:31 +08:00
{
USE_OPLINE
SAVE_OPLINE ( ) ;
zend_throw_error ( NULL , " Cannot call abstract method %s::%s() " , ZSTR_VAL ( fbc - > common . scope - > name ) , ZSTR_VAL ( fbc - > common . function_name ) ) ;
UNDEF_RESULT ( ) ;
HANDLE_EXCEPTION ( ) ;
}
2018-02-21 17:07:29 +08:00
ZEND_VM_COLD_HELPER ( zend_undefined_function_helper , ANY , ANY , zval * function_name )
2018-02-16 07:45:31 +08:00
{
SAVE_OPLINE ( ) ;
zend_throw_error ( NULL , " Call to undefined function %s() " , Z_STRVAL_P ( function_name ) ) ;
HANDLE_EXCEPTION ( ) ;
}
2015-12-10 22:17:59 +08:00
ZEND_VM_HELPER ( zend_binary_assign_op_obj_helper , VAR | UNUSED | CV , CONST | TMPVAR | CV , binary_op_type binary_op )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 , free_op_data1 ;
2015-03-13 01:39:04 +08:00
zval * object ;
zval * property ;
2014-03-05 19:33:31 +08:00
zval * value ;
2014-10-21 04:56:48 +08:00
zval * zptr ;
2004-10-23 05:42:14 +08:00
2015-03-13 01:39:04 +08:00
SAVE_OPLINE ( ) ;
object = GET_OP1_OBJ_ZVAL_PTR_PTR ( BP_VAR_RW ) ;
2015-04-02 08:56:42 +08:00
2016-04-01 21:17:49 +08:00
if ( OP1_TYPE = = IS_UNUSED & & UNEXPECTED ( Z_TYPE_P ( object ) = = IS_UNDEF ) ) {
2017-06-15 21:23:05 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_this_not_in_object_context_helper ) ;
2015-04-01 20:54:03 +08:00
}
2015-04-02 08:56:42 +08:00
property = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
2014-12-09 08:05:06 +08:00
do {
2017-10-04 21:53:01 +08:00
value = get_op_data_zval_ptr_r ( ( opline + 1 ) - > op1_type , ( opline + 1 ) - > op1 , & free_op_data1 ) ;
2014-12-09 17:17:55 +08:00
2014-12-09 08:05:06 +08:00
if ( OP1_TYPE ! = IS_UNUSED & & UNEXPECTED ( Z_TYPE_P ( object ) ! = IS_OBJECT ) ) {
2018-02-20 22:22:11 +08:00
if ( Z_ISREF_P ( object ) ) {
object = Z_REFVAL_P ( object ) ;
if ( EXPECTED ( Z_TYPE_P ( object ) = = IS_OBJECT ) ) {
ZEND_VM_C_GOTO ( assign_op_object ) ;
2014-12-09 08:05:06 +08:00
}
2018-02-20 22:22:11 +08:00
}
2018-02-21 01:39:02 +08:00
if ( UNEXPECTED ( ! make_real_object ( object , property OPLINE_CC EXECUTE_DATA_CC ) ) ) {
2014-12-09 08:05:06 +08:00
break ;
}
}
2014-03-05 19:33:31 +08:00
2004-10-23 05:42:14 +08:00
/* here we are sure we are dealing with an object */
2018-02-20 22:22:11 +08:00
ZEND_VM_C_LABEL ( assign_op_object ) :
2014-12-09 20:15:24 +08:00
if ( EXPECTED ( Z_OBJ_HT_P ( object ) - > get_property_ptr_ptr )
2018-02-06 00:41:47 +08:00
& & EXPECTED ( ( zptr = Z_OBJ_HT_P ( object ) - > get_property_ptr_ptr ( object , property , BP_VAR_RW , ( ( OP2_TYPE = = IS_CONST ) ? CACHE_ADDR ( ( opline + 1 ) - > extended_value ) : NULL ) ) ) ! = NULL ) ) {
2016-03-17 11:56:32 +08:00
if ( UNEXPECTED ( Z_ISERROR_P ( zptr ) ) ) {
2016-03-17 15:22:44 +08:00
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
ZVAL_NULL ( EX_VAR ( opline - > result . var ) ) ;
2005-04-16 01:15:18 +08:00
}
2016-03-17 11:56:32 +08:00
} else {
ZVAL_DEREF ( zptr ) ;
2014-10-21 04:56:48 +08:00
2016-03-17 15:22:44 +08:00
binary_op ( zptr , zptr , value ) ;
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
ZVAL_COPY ( EX_VAR ( opline - > result . var ) , zptr ) ;
2004-10-23 05:42:14 +08:00
}
2016-03-17 11:56:32 +08:00
}
2014-10-21 04:56:48 +08:00
} else {
2018-02-21 04:44:25 +08:00
zend_assign_op_overloaded_property ( object , property , ( ( OP2_TYPE = = IS_CONST ) ? CACHE_ADDR ( ( opline + 1 ) - > extended_value ) : NULL ) , value , binary_op OPLINE_CC EXECUTE_DATA_CC ) ;
2004-10-23 05:42:14 +08:00
}
2014-12-09 08:05:06 +08:00
} while ( 0 ) ;
2004-10-23 05:42:14 +08:00
2014-12-20 00:43:17 +08:00
FREE_OP ( free_op_data1 ) ;
FREE_OP2 ( ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1_VAR_PTR ( ) ;
/* assign_obj has two opcodes! */
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_EX ( 1 , 2 ) ;
2004-10-23 05:42:14 +08:00
}
2016-06-16 07:30:23 +08:00
ZEND_VM_HELPER ( zend_binary_assign_op_dim_helper , VAR | CV , CONST | TMPVAR | UNUSED | CV , binary_op_type binary_op )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2014-10-21 23:30:43 +08:00
zend_free_op free_op1 , free_op2 , free_op_data1 ;
2016-04-14 07:35:53 +08:00
zval * var_ptr ;
2014-12-06 08:03:48 +08:00
zval * value , * container , * dim ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2016-04-13 06:19:20 +08:00
container = GET_OP1_OBJ_ZVAL_PTR_PTR_UNDEF ( BP_VAR_RW ) ;
2014-12-06 08:03:48 +08:00
2016-06-16 07:30:23 +08:00
if ( EXPECTED ( Z_TYPE_P ( container ) = = IS_ARRAY ) ) {
2016-04-14 07:35:53 +08:00
ZEND_VM_C_LABEL ( assign_dim_op_array ) :
SEPARATE_ARRAY ( container ) ;
ZEND_VM_C_LABEL ( assign_dim_op_new_array ) :
2017-11-25 05:57:45 +08:00
dim = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2016-04-14 07:35:53 +08:00
if ( OP2_TYPE = = IS_UNUSED ) {
var_ptr = zend_hash_next_index_insert ( Z_ARRVAL_P ( container ) , & EG ( uninitialized_zval ) ) ;
if ( UNEXPECTED ( ! var_ptr ) ) {
2018-02-16 07:45:31 +08:00
zend_cannot_add_element ( ) ;
2016-04-14 07:35:53 +08:00
ZEND_VM_C_GOTO ( assign_dim_op_ret_null ) ;
}
} else {
if ( OP2_TYPE = = IS_CONST ) {
2017-06-16 06:42:49 +08:00
var_ptr = zend_fetch_dimension_address_inner_RW_CONST ( Z_ARRVAL_P ( container ) , dim EXECUTE_DATA_CC ) ;
2016-04-14 07:35:53 +08:00
} else {
2017-06-16 06:42:49 +08:00
var_ptr = zend_fetch_dimension_address_inner_RW ( Z_ARRVAL_P ( container ) , dim EXECUTE_DATA_CC ) ;
2014-12-09 20:15:24 +08:00
}
2016-04-14 07:35:53 +08:00
if ( UNEXPECTED ( ! var_ptr ) ) {
ZEND_VM_C_GOTO ( assign_dim_op_ret_null ) ;
2014-12-09 20:15:24 +08:00
}
2016-04-14 07:35:53 +08:00
ZVAL_DEREF ( var_ptr ) ;
2014-12-09 20:15:24 +08:00
}
2004-10-23 05:42:14 +08:00
2017-10-04 21:53:01 +08:00
value = get_op_data_zval_ptr_r ( ( opline + 1 ) - > op1_type , ( opline + 1 ) - > op1 , & free_op_data1 ) ;
2004-10-23 05:42:14 +08:00
2016-04-14 07:35:53 +08:00
binary_op ( var_ptr , var_ptr , value ) ;
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
ZVAL_COPY ( EX_VAR ( opline - > result . var ) , var_ptr ) ;
}
} else {
2016-06-16 07:30:23 +08:00
if ( EXPECTED ( Z_ISREF_P ( container ) ) ) {
container = Z_REFVAL_P ( container ) ;
if ( EXPECTED ( Z_TYPE_P ( container ) = = IS_ARRAY ) ) {
ZEND_VM_C_GOTO ( assign_dim_op_array ) ;
2014-12-09 20:15:24 +08:00
}
2016-06-16 07:30:23 +08:00
} else if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( container ) = = IS_UNDEF ) ) {
container = GET_OP1_UNDEF_CV ( container , BP_VAR_RW ) ;
ZEND_VM_C_LABEL ( assign_dim_op_convert_to_array ) :
2017-09-20 07:25:56 +08:00
ZVAL_ARR ( container , zend_new_array ( 8 ) ) ;
2016-06-16 07:30:23 +08:00
ZEND_VM_C_GOTO ( assign_dim_op_new_array ) ;
2016-04-14 07:35:53 +08:00
}
2004-10-23 05:42:14 +08:00
2016-04-14 07:35:53 +08:00
dim = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
2016-06-16 07:30:23 +08:00
if ( EXPECTED ( Z_TYPE_P ( container ) = = IS_OBJECT ) ) {
2017-10-04 21:53:01 +08:00
value = get_op_data_zval_ptr_r ( ( opline + 1 ) - > op1_type , ( opline + 1 ) - > op1 , & free_op_data1 ) ;
2017-06-16 06:42:49 +08:00
zend_binary_assign_op_obj_dim ( container , dim , value , UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ? EX_VAR ( opline - > result . var ) : NULL , binary_op EXECUTE_DATA_CC ) ;
2016-06-16 07:30:23 +08:00
} else {
2016-06-08 21:33:11 +08:00
if ( UNEXPECTED ( Z_TYPE_P ( container ) = = IS_STRING ) ) {
2016-04-14 07:35:53 +08:00
if ( OP2_TYPE = = IS_UNUSED ) {
2018-02-16 07:45:31 +08:00
zend_use_new_element_for_string ( ) ;
2016-04-14 07:35:53 +08:00
} else {
2017-06-16 06:42:49 +08:00
zend_check_string_offset ( dim , BP_VAR_RW EXECUTE_DATA_CC ) ;
zend_wrong_string_offset ( EXECUTE_DATA_C ) ;
2016-04-14 07:35:53 +08:00
}
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2016-06-09 17:39:38 +08:00
} else if ( EXPECTED ( Z_TYPE_P ( container ) < = IS_FALSE ) ) {
ZEND_VM_C_GOTO ( assign_dim_op_convert_to_array ) ;
2016-04-14 07:35:53 +08:00
} else {
2016-06-09 17:39:38 +08:00
if ( UNEXPECTED ( OP1_TYPE ! = IS_VAR | | EXPECTED ( ! Z_ISERROR_P ( container ) ) ) ) {
2018-02-16 07:45:31 +08:00
zend_use_scalar_as_array ( ) ;
2016-04-14 07:35:53 +08:00
}
ZEND_VM_C_LABEL ( assign_dim_op_ret_null ) :
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
ZVAL_NULL ( EX_VAR ( opline - > result . var ) ) ;
}
2014-12-09 20:15:24 +08:00
}
2017-10-04 21:53:01 +08:00
value = get_op_data_zval_ptr_r ( ( opline + 1 ) - > op1_type , ( opline + 1 ) - > op1 , & free_op_data1 ) ;
2014-10-21 15:43:13 +08:00
}
2016-04-14 07:35:53 +08:00
}
2014-04-08 06:25:49 +08:00
2004-10-23 05:42:14 +08:00
FREE_OP2 ( ) ;
2014-04-08 06:25:49 +08:00
FREE_OP ( free_op_data1 ) ;
FREE_OP1_VAR_PTR ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_EX ( 1 , 2 ) ;
2014-04-08 06:25:49 +08:00
}
2004-10-23 05:42:14 +08:00
2016-12-04 00:34:02 +08:00
ZEND_VM_HELPER ( zend_binary_assign_op_simple_helper , VAR | CV , CONST | TMPVAR | CV , binary_op_type binary_op )
2014-04-08 06:25:49 +08:00
{
USE_OPLINE
zend_free_op free_op1 , free_op2 ;
zval * var_ptr ;
zval * value ;
SAVE_OPLINE ( ) ;
2014-12-06 07:14:45 +08:00
value = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
2014-04-08 06:25:49 +08:00
var_ptr = GET_OP1_ZVAL_PTR_PTR ( BP_VAR_RW ) ;
2016-02-01 16:12:28 +08:00
if ( OP1_TYPE = = IS_VAR & & UNEXPECTED ( Z_ISERROR_P ( var_ptr ) ) ) {
2014-04-08 06:25:49 +08:00
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
ZVAL_NULL ( EX_VAR ( opline - > result . var ) ) ;
}
2014-10-21 15:43:13 +08:00
} else {
ZVAL_DEREF ( var_ptr ) ;
2014-04-08 06:25:49 +08:00
2014-12-14 06:06:14 +08:00
binary_op ( var_ptr , var_ptr , value ) ;
2014-04-08 06:25:49 +08:00
2014-10-21 15:43:13 +08:00
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
ZVAL_COPY ( EX_VAR ( opline - > result . var ) , var_ptr ) ;
}
2004-10-23 05:42:14 +08:00
}
2014-04-08 06:25:49 +08:00
FREE_OP2 ( ) ;
FREE_OP1_VAR_PTR ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2016-12-04 00:34:02 +08:00
ZEND_VM_INLINE_HELPER ( zend_binary_assign_op_helper , VAR | UNUSED | THIS | CV , CONST | TMPVAR | UNUSED | NEXT | CV , SPEC ( DIM_OBJ ) , binary_op_type binary_op )
2004-10-23 05:42:14 +08:00
{
2016-12-04 00:34:02 +08:00
# if defined(ZEND_VM_SPEC) && OP2_TYPE == IS_UNUSED
ZEND_VM_DISPATCH_TO_HELPER ( zend_binary_assign_op_dim_helper , binary_op , binary_op ) ;
# else
# if !defined(ZEND_VM_SPEC) || OP1_TYPE != IS_UNUSED
2018-02-03 23:48:05 +08:00
# if !defined(ZEND_VM_SPEC)
/* opline->extended_value checks are specialized, don't need opline */
2014-04-08 06:25:49 +08:00
USE_OPLINE
2018-02-03 23:48:05 +08:00
# endif
2014-04-08 06:25:49 +08:00
if ( EXPECTED ( opline - > extended_value = = 0 ) ) {
2016-12-04 00:34:02 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_binary_assign_op_simple_helper , binary_op , binary_op ) ;
2014-12-06 08:03:48 +08:00
}
if ( EXPECTED ( opline - > extended_value = = ZEND_ASSIGN_DIM ) ) {
2016-12-04 00:34:02 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_binary_assign_op_dim_helper , binary_op , binary_op ) ;
2014-04-08 06:25:49 +08:00
}
2016-06-16 07:30:23 +08:00
# endif
2018-01-04 12:41:57 +08:00
2016-12-04 00:34:02 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_binary_assign_op_obj_helper , binary_op , binary_op ) ;
2014-12-06 08:03:48 +08:00
# endif
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 23 , ZEND_ASSIGN_ADD , VAR | UNUSED | THIS | CV , CONST | TMPVAR | UNUSED | NEXT | CV , DIM_OBJ | CACHE_SLOT , SPEC ( DIM_OBJ ) )
2004-10-23 05:42:14 +08:00
{
2016-12-04 00:34:02 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_binary_assign_op_helper , binary_op , add_function ) ;
}
2014-04-08 06:25:49 +08:00
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 24 , ZEND_ASSIGN_SUB , VAR | UNUSED | THIS | CV , CONST | TMPVAR | UNUSED | NEXT | CV , DIM_OBJ | CACHE_SLOT , SPEC ( DIM_OBJ ) )
2016-12-04 00:34:02 +08:00
{
ZEND_VM_DISPATCH_TO_HELPER ( zend_binary_assign_op_helper , binary_op , sub_function ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 25 , ZEND_ASSIGN_MUL , VAR | UNUSED | THIS | CV , CONST | TMPVAR | UNUSED | NEXT | CV , DIM_OBJ | CACHE_SLOT , SPEC ( DIM_OBJ ) )
2004-10-23 05:42:14 +08:00
{
2016-12-04 00:34:02 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_binary_assign_op_helper , binary_op , mul_function ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 26 , ZEND_ASSIGN_DIV , VAR | UNUSED | THIS | CV , CONST | TMPVAR | UNUSED | NEXT | CV , DIM_OBJ | CACHE_SLOT , SPEC ( DIM_OBJ ) )
2004-10-23 05:42:14 +08:00
{
2016-12-04 00:34:02 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_binary_assign_op_helper , binary_op , div_function ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 27 , ZEND_ASSIGN_MOD , VAR | UNUSED | THIS | CV , CONST | TMPVAR | UNUSED | NEXT | CV , DIM_OBJ | CACHE_SLOT , SPEC ( DIM_OBJ ) )
2004-10-23 05:42:14 +08:00
{
2016-12-04 00:34:02 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_binary_assign_op_helper , binary_op , mod_function ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 28 , ZEND_ASSIGN_SL , VAR | UNUSED | THIS | CV , CONST | TMPVAR | UNUSED | NEXT | CV , DIM_OBJ | CACHE_SLOT , SPEC ( DIM_OBJ ) )
2004-10-23 05:42:14 +08:00
{
2016-12-04 00:34:02 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_binary_assign_op_helper , binary_op , shift_left_function ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 29 , ZEND_ASSIGN_SR , VAR | UNUSED | THIS | CV , CONST | TMPVAR | UNUSED | NEXT | CV , DIM_OBJ | CACHE_SLOT , SPEC ( DIM_OBJ ) )
2004-10-23 05:42:14 +08:00
{
2016-12-04 00:34:02 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_binary_assign_op_helper , binary_op , shift_right_function ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 30 , ZEND_ASSIGN_CONCAT , VAR | UNUSED | THIS | CV , CONST | TMPVAR | UNUSED | NEXT | CV , DIM_OBJ | CACHE_SLOT , SPEC ( DIM_OBJ ) )
2004-10-23 05:42:14 +08:00
{
2016-12-04 00:34:02 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_binary_assign_op_helper , binary_op , concat_function ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 31 , ZEND_ASSIGN_BW_OR , VAR | UNUSED | THIS | CV , CONST | TMPVAR | UNUSED | NEXT | CV , DIM_OBJ | CACHE_SLOT , SPEC ( DIM_OBJ ) )
2004-10-23 05:42:14 +08:00
{
2016-12-04 00:34:02 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_binary_assign_op_helper , binary_op , bitwise_or_function ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 32 , ZEND_ASSIGN_BW_AND , VAR | UNUSED | THIS | CV , CONST | TMPVAR | UNUSED | NEXT | CV , DIM_OBJ | CACHE_SLOT , SPEC ( DIM_OBJ ) )
2004-10-23 05:42:14 +08:00
{
2016-12-04 00:34:02 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_binary_assign_op_helper , binary_op , bitwise_and_function ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 33 , ZEND_ASSIGN_BW_XOR , VAR | UNUSED | THIS | CV , CONST | TMPVAR | UNUSED | NEXT | CV , DIM_OBJ | CACHE_SLOT , SPEC ( DIM_OBJ ) )
2004-10-23 05:42:14 +08:00
{
2016-12-04 00:34:02 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_binary_assign_op_helper , binary_op , bitwise_xor_function ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 167 , ZEND_ASSIGN_POW , VAR | UNUSED | THIS | CV , CONST | TMPVAR | UNUSED | NEXT | CV , DIM_OBJ | CACHE_SLOT , SPEC ( DIM_OBJ ) )
2015-09-12 06:54:48 +08:00
{
2016-12-04 00:34:02 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_binary_assign_op_helper , binary_op , pow_function ) ;
2015-09-12 06:54:48 +08:00
}
2015-12-10 22:17:59 +08:00
ZEND_VM_HELPER ( zend_pre_incdec_property_helper , VAR | UNUSED | CV , CONST | TMPVAR | CV , int inc )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
zval * object ;
2010-04-20 19:16:39 +08:00
zval * property ;
2014-10-21 04:56:48 +08:00
zval * zptr ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2014-03-04 16:27:50 +08:00
object = GET_OP1_OBJ_ZVAL_PTR_PTR ( BP_VAR_RW ) ;
2010-04-20 19:16:39 +08:00
2016-04-01 21:17:49 +08:00
if ( OP1_TYPE = = IS_UNUSED & & UNEXPECTED ( Z_TYPE_P ( object ) = = IS_UNDEF ) ) {
2017-06-15 21:23:05 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_this_not_in_object_context_helper ) ;
2015-04-01 20:54:03 +08:00
}
2015-04-02 08:56:42 +08:00
property = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
2014-12-09 08:05:06 +08:00
do {
if ( OP1_TYPE ! = IS_UNUSED & & UNEXPECTED ( Z_TYPE_P ( object ) ! = IS_OBJECT ) ) {
2018-02-20 22:22:11 +08:00
if ( Z_ISREF_P ( object ) ) {
object = Z_REFVAL_P ( object ) ;
if ( EXPECTED ( Z_TYPE_P ( object ) = = IS_OBJECT ) ) {
ZEND_VM_C_GOTO ( pre_incdec_object ) ;
2014-12-09 08:05:06 +08:00
}
2018-02-20 22:22:11 +08:00
}
2018-02-21 01:39:02 +08:00
if ( UNEXPECTED ( ! make_real_object ( object , property OPLINE_CC EXECUTE_DATA_CC ) ) ) {
2014-12-09 08:05:06 +08:00
break ;
}
2004-10-23 05:42:14 +08:00
}
2014-12-09 08:05:06 +08:00
/* here we are sure we are dealing with an object */
2018-02-20 22:22:11 +08:00
ZEND_VM_C_LABEL ( pre_incdec_object ) :
2014-12-09 08:05:06 +08:00
if ( EXPECTED ( Z_OBJ_HT_P ( object ) - > get_property_ptr_ptr )
2018-02-06 00:41:47 +08:00
& & EXPECTED ( ( zptr = Z_OBJ_HT_P ( object ) - > get_property_ptr_ptr ( object , property , BP_VAR_RW , ( ( OP2_TYPE = = IS_CONST ) ? CACHE_ADDR ( opline - > extended_value ) : NULL ) ) ) ! = NULL ) ) {
2016-03-17 15:26:40 +08:00
if ( UNEXPECTED ( Z_ISERROR_P ( zptr ) ) ) {
2016-03-17 15:22:44 +08:00
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
ZVAL_NULL ( EX_VAR ( opline - > result . var ) ) ;
2015-06-03 23:44:25 +08:00
}
} else {
2016-03-17 15:22:44 +08:00
if ( EXPECTED ( Z_TYPE_P ( zptr ) = = IS_LONG ) ) {
if ( inc ) {
fast_long_increment_function ( zptr ) ;
} else {
fast_long_decrement_function ( zptr ) ;
}
2016-03-17 11:56:32 +08:00
} else {
ZVAL_DEREF ( zptr ) ;
2004-10-23 05:42:14 +08:00
2016-03-17 15:22:44 +08:00
if ( inc ) {
increment_function ( zptr ) ;
} else {
decrement_function ( zptr ) ;
}
}
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
ZVAL_COPY ( EX_VAR ( opline - > result . var ) , zptr ) ;
2015-06-03 23:44:25 +08:00
}
2014-12-09 08:05:06 +08:00
}
} else {
2018-02-21 04:44:25 +08:00
zend_pre_incdec_overloaded_property ( object , property , ( ( OP2_TYPE = = IS_CONST ) ? CACHE_ADDR ( opline - > extended_value ) : NULL ) , inc OPLINE_CC EXECUTE_DATA_CC ) ;
2004-10-23 05:42:14 +08:00
}
2014-12-09 08:05:06 +08:00
} while ( 0 ) ;
2004-10-23 05:42:14 +08:00
2014-04-16 01:56:30 +08:00
FREE_OP2 ( ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1_VAR_PTR ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 132 , ZEND_PRE_INC_OBJ , VAR | UNUSED | THIS | CV , CONST | TMPVAR | CV , CACHE_SLOT )
2004-10-23 05:42:14 +08:00
{
2015-12-10 22:17:59 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_pre_incdec_property_helper , inc , 1 ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 133 , ZEND_PRE_DEC_OBJ , VAR | UNUSED | THIS | CV , CONST | TMPVAR | CV , CACHE_SLOT )
2004-10-23 05:42:14 +08:00
{
2015-12-10 22:17:59 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_pre_incdec_property_helper , inc , 0 ) ;
2004-10-23 05:42:14 +08:00
}
2015-12-10 22:17:59 +08:00
ZEND_VM_HELPER ( zend_post_incdec_property_helper , VAR | UNUSED | CV , CONST | TMPVAR | CV , int inc )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
zval * object ;
2010-04-20 19:16:39 +08:00
zval * property ;
2014-10-21 04:56:48 +08:00
zval * zptr ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2014-03-04 16:27:50 +08:00
object = GET_OP1_OBJ_ZVAL_PTR_PTR ( BP_VAR_RW ) ;
2010-04-20 19:16:39 +08:00
2016-04-01 21:17:49 +08:00
if ( OP1_TYPE = = IS_UNUSED & & UNEXPECTED ( Z_TYPE_P ( object ) = = IS_UNDEF ) ) {
2017-06-15 21:23:05 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_this_not_in_object_context_helper ) ;
2015-04-01 20:54:03 +08:00
}
2015-04-02 08:56:42 +08:00
property = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
2014-12-09 08:05:06 +08:00
do {
if ( OP1_TYPE ! = IS_UNUSED & & UNEXPECTED ( Z_TYPE_P ( object ) ! = IS_OBJECT ) ) {
2018-02-20 22:22:11 +08:00
if ( Z_ISREF_P ( object ) ) {
object = Z_REFVAL_P ( object ) ;
if ( EXPECTED ( Z_TYPE_P ( object ) = = IS_OBJECT ) ) {
ZEND_VM_C_GOTO ( post_incdec_object ) ;
}
}
2018-02-21 01:39:02 +08:00
if ( UNEXPECTED ( ! make_real_object ( object , property OPLINE_CC EXECUTE_DATA_CC ) ) ) {
2014-12-09 08:05:06 +08:00
break ;
}
}
2004-10-23 05:42:14 +08:00
2014-12-09 08:05:06 +08:00
/* here we are sure we are dealing with an object */
2018-02-20 22:22:11 +08:00
ZEND_VM_C_LABEL ( post_incdec_object ) :
2014-12-09 08:05:06 +08:00
if ( EXPECTED ( Z_OBJ_HT_P ( object ) - > get_property_ptr_ptr )
2018-02-06 00:41:47 +08:00
& & EXPECTED ( ( zptr = Z_OBJ_HT_P ( object ) - > get_property_ptr_ptr ( object , property , BP_VAR_RW , ( ( OP2_TYPE = = IS_CONST ) ? CACHE_ADDR ( opline - > extended_value ) : NULL ) ) ) ! = NULL ) ) {
2016-03-17 15:26:40 +08:00
if ( UNEXPECTED ( Z_ISERROR_P ( zptr ) ) ) {
2016-03-17 15:22:44 +08:00
ZVAL_NULL ( EX_VAR ( opline - > result . var ) ) ;
2014-12-09 08:05:06 +08:00
} else {
2016-03-17 15:22:44 +08:00
if ( EXPECTED ( Z_TYPE_P ( zptr ) = = IS_LONG ) ) {
2017-12-26 21:49:34 +08:00
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , Z_LVAL_P ( zptr ) ) ;
2016-03-17 15:22:44 +08:00
if ( inc ) {
fast_long_increment_function ( zptr ) ;
} else {
fast_long_decrement_function ( zptr ) ;
}
2016-03-17 11:56:32 +08:00
} else {
ZVAL_DEREF ( zptr ) ;
2017-12-07 19:59:42 +08:00
ZVAL_COPY ( EX_VAR ( opline - > result . var ) , zptr ) ;
2016-03-17 15:22:44 +08:00
if ( inc ) {
increment_function ( zptr ) ;
} else {
decrement_function ( zptr ) ;
}
2015-06-03 23:44:25 +08:00
}
2004-10-23 05:42:14 +08:00
}
2015-06-03 23:44:25 +08:00
} else {
2018-02-21 04:44:25 +08:00
zend_post_incdec_overloaded_property ( object , property , ( ( OP2_TYPE = = IS_CONST ) ? CACHE_ADDR ( opline - > extended_value ) : NULL ) , inc OPLINE_CC EXECUTE_DATA_CC ) ;
2004-10-23 05:42:14 +08:00
}
2014-12-09 08:05:06 +08:00
} while ( 0 ) ;
2004-10-23 05:42:14 +08:00
2014-04-16 01:56:30 +08:00
FREE_OP2 ( ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1_VAR_PTR ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 134 , ZEND_POST_INC_OBJ , VAR | UNUSED | THIS | CV , CONST | TMPVAR | CV , CACHE_SLOT )
2004-10-23 05:42:14 +08:00
{
2015-12-10 22:17:59 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_post_incdec_property_helper , inc , 1 ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 135 , ZEND_POST_DEC_OBJ , VAR | UNUSED | THIS | CV , CONST | TMPVAR | CV , CACHE_SLOT )
2004-10-23 05:42:14 +08:00
{
2015-12-10 22:17:59 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_post_incdec_property_helper , inc , 0 ) ;
2004-10-23 05:42:14 +08:00
}
2016-02-02 10:03:21 +08:00
ZEND_VM_HANDLER ( 34 , ZEND_PRE_INC , VAR | CV , ANY , SPEC ( RETVAL ) )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 ;
2014-02-10 14:04:30 +08:00
zval * var_ptr ;
2004-10-23 05:42:14 +08:00
2015-03-17 23:53:19 +08:00
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_RW ) ;
2010-04-20 19:16:39 +08:00
2014-08-26 01:24:55 +08:00
if ( EXPECTED ( Z_TYPE_P ( var_ptr ) = = IS_LONG ) ) {
2015-03-17 23:53:19 +08:00
fast_long_increment_function ( var_ptr ) ;
2014-12-09 22:07:12 +08:00
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
2014-04-22 01:38:44 +08:00
ZVAL_COPY_VALUE ( EX_VAR ( opline - > result . var ) , var_ptr ) ;
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
2016-02-01 16:12:28 +08:00
if ( OP1_TYPE = = IS_VAR & & UNEXPECTED ( Z_ISERROR_P ( var_ptr ) ) ) {
2014-12-09 22:07:12 +08:00
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
2014-02-10 14:04:30 +08:00
ZVAL_NULL ( EX_VAR ( opline - > result . var ) ) ;
2004-10-23 05:42:14 +08:00
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
2015-03-17 23:53:19 +08:00
SAVE_OPLINE ( ) ;
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( var_ptr ) = = IS_UNDEF ) ) {
var_ptr = GET_OP1_UNDEF_CV ( var_ptr , BP_VAR_RW ) ;
}
2014-06-12 07:14:57 +08:00
ZVAL_DEREF ( var_ptr ) ;
2004-10-23 05:42:14 +08:00
2014-09-25 17:42:46 +08:00
increment_function ( var_ptr ) ;
2004-10-23 05:42:14 +08:00
2014-12-09 22:07:12 +08:00
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
2014-02-10 14:04:30 +08:00
ZVAL_COPY ( EX_VAR ( opline - > result . var ) , var_ptr ) ;
2004-10-23 05:42:14 +08:00
}
FREE_OP1_VAR_PTR ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2016-02-02 10:03:21 +08:00
ZEND_VM_HANDLER ( 35 , ZEND_PRE_DEC , VAR | CV , ANY , SPEC ( RETVAL ) )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 ;
2014-02-10 14:04:30 +08:00
zval * var_ptr ;
2004-10-23 05:42:14 +08:00
2015-03-17 23:53:19 +08:00
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_RW ) ;
2010-04-20 19:16:39 +08:00
2014-08-26 01:24:55 +08:00
if ( EXPECTED ( Z_TYPE_P ( var_ptr ) = = IS_LONG ) ) {
2015-03-17 23:53:19 +08:00
fast_long_decrement_function ( var_ptr ) ;
2014-12-09 22:07:12 +08:00
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
2014-04-22 01:38:44 +08:00
ZVAL_COPY_VALUE ( EX_VAR ( opline - > result . var ) , var_ptr ) ;
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
2016-02-01 16:12:28 +08:00
if ( OP1_TYPE = = IS_VAR & & UNEXPECTED ( Z_ISERROR_P ( var_ptr ) ) ) {
2014-12-09 22:07:12 +08:00
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
2014-02-10 14:04:30 +08:00
ZVAL_NULL ( EX_VAR ( opline - > result . var ) ) ;
2004-10-23 05:42:14 +08:00
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
2015-03-17 23:53:19 +08:00
SAVE_OPLINE ( ) ;
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( var_ptr ) = = IS_UNDEF ) ) {
var_ptr = GET_OP1_UNDEF_CV ( var_ptr , BP_VAR_RW ) ;
}
2014-06-12 07:14:57 +08:00
ZVAL_DEREF ( var_ptr ) ;
2004-10-23 05:42:14 +08:00
2014-09-25 17:42:46 +08:00
decrement_function ( var_ptr ) ;
2004-10-23 05:42:14 +08:00
2014-12-09 22:07:12 +08:00
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
2014-02-10 14:04:30 +08:00
ZVAL_COPY ( EX_VAR ( opline - > result . var ) , var_ptr ) ;
2004-10-23 05:42:14 +08:00
}
FREE_OP1_VAR_PTR ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
ZEND_VM_HANDLER ( 36 , ZEND_POST_INC , VAR | CV , ANY )
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 ;
2014-09-25 17:42:46 +08:00
zval * var_ptr ;
2010-04-20 19:16:39 +08:00
2015-03-17 23:53:19 +08:00
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_RW ) ;
2004-10-23 05:42:14 +08:00
2014-08-26 01:24:55 +08:00
if ( EXPECTED ( Z_TYPE_P ( var_ptr ) = = IS_LONG ) ) {
2017-12-26 21:49:34 +08:00
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , Z_LVAL_P ( var_ptr ) ) ;
2015-03-17 23:53:19 +08:00
fast_long_increment_function ( var_ptr ) ;
2014-04-22 01:38:44 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
}
2016-02-01 16:12:28 +08:00
if ( OP1_TYPE = = IS_VAR & & UNEXPECTED ( Z_ISERROR_P ( var_ptr ) ) ) {
2014-02-10 14:04:30 +08:00
ZVAL_NULL ( EX_VAR ( opline - > result . var ) ) ;
2004-10-23 05:42:14 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
}
2015-03-17 23:53:19 +08:00
SAVE_OPLINE ( ) ;
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( var_ptr ) = = IS_UNDEF ) ) {
var_ptr = GET_OP1_UNDEF_CV ( var_ptr , BP_VAR_RW ) ;
}
2014-12-03 07:47:03 +08:00
ZVAL_DEREF ( var_ptr ) ;
2017-12-07 19:59:42 +08:00
ZVAL_COPY ( EX_VAR ( opline - > result . var ) , var_ptr ) ;
2004-10-23 05:42:14 +08:00
2014-09-25 17:42:46 +08:00
increment_function ( var_ptr ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1_VAR_PTR ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
ZEND_VM_HANDLER ( 37 , ZEND_POST_DEC , VAR | CV , ANY )
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 ;
2014-09-25 17:42:46 +08:00
zval * var_ptr ;
2004-10-23 05:42:14 +08:00
2015-03-17 23:53:19 +08:00
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_RW ) ;
2010-04-20 19:16:39 +08:00
2014-08-26 01:24:55 +08:00
if ( EXPECTED ( Z_TYPE_P ( var_ptr ) = = IS_LONG ) ) {
2017-12-26 21:49:34 +08:00
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , Z_LVAL_P ( var_ptr ) ) ;
2015-03-17 23:53:19 +08:00
fast_long_decrement_function ( var_ptr ) ;
2014-04-22 01:38:44 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
}
2016-02-01 16:12:28 +08:00
if ( OP1_TYPE = = IS_VAR & & UNEXPECTED ( Z_ISERROR_P ( var_ptr ) ) ) {
2014-02-10 14:04:30 +08:00
ZVAL_NULL ( EX_VAR ( opline - > result . var ) ) ;
2004-10-23 05:42:14 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
}
2015-03-17 23:53:19 +08:00
SAVE_OPLINE ( ) ;
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( var_ptr ) = = IS_UNDEF ) ) {
var_ptr = GET_OP1_UNDEF_CV ( var_ptr , BP_VAR_RW ) ;
}
2014-12-03 07:47:03 +08:00
ZVAL_DEREF ( var_ptr ) ;
2017-12-07 19:59:42 +08:00
ZVAL_COPY ( EX_VAR ( opline - > result . var ) , var_ptr ) ;
2004-10-23 05:42:14 +08:00
2014-09-25 17:42:46 +08:00
decrement_function ( var_ptr ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1_VAR_PTR ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2014-12-05 20:07:49 +08:00
ZEND_VM_HANDLER ( 40 , ZEND_ECHO , CONST | TMPVAR | CV , ANY )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 ;
2010-04-20 19:16:39 +08:00
zval * z ;
SAVE_OPLINE ( ) ;
2015-06-05 06:53:32 +08:00
z = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2014-02-23 19:36:38 +08:00
2014-12-05 20:07:49 +08:00
if ( Z_TYPE_P ( z ) = = IS_STRING ) {
zend_string * str = Z_STR_P ( z ) ;
2015-06-30 18:59:27 +08:00
if ( ZSTR_LEN ( str ) ! = 0 ) {
zend_write ( ZSTR_VAL ( str ) , ZSTR_LEN ( str ) ) ;
2014-12-05 20:07:49 +08:00
}
} else {
2017-11-16 22:09:01 +08:00
zend_string * str = zval_get_string_func ( z ) ;
2014-12-05 20:07:49 +08:00
2015-06-30 18:59:27 +08:00
if ( ZSTR_LEN ( str ) ! = 0 ) {
zend_write ( ZSTR_VAL ( str ) , ZSTR_LEN ( str ) ) ;
2015-06-05 06:53:32 +08:00
} else if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( z ) = = IS_UNDEF ) ) {
GET_OP1_UNDEF_CV ( z , BP_VAR_R ) ;
2014-12-05 20:07:49 +08:00
}
zend_string_release ( str ) ;
}
2004-10-23 05:42:14 +08:00
FREE_OP1 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2015-12-10 22:17:59 +08:00
ZEND_VM_HELPER ( zend_fetch_var_address_helper , CONST | TMPVAR | CV , UNUSED , int type )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 ;
2010-04-20 19:16:39 +08:00
zval * varname ;
2014-02-10 14:04:30 +08:00
zval * retval ;
2017-11-16 22:09:32 +08:00
zend_string * name , * tmp_name ;
2004-10-23 05:42:14 +08:00
HashTable * target_symbol_table ;
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2015-06-05 06:53:32 +08:00
varname = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2010-04-20 19:16:39 +08:00
2018-01-10 07:22:07 +08:00
if ( OP1_TYPE = = IS_CONST ) {
2014-06-03 04:36:31 +08:00
name = Z_STR_P ( varname ) ;
} else if ( EXPECTED ( Z_TYPE_P ( varname ) = = IS_STRING ) ) {
name = Z_STR_P ( varname ) ;
2017-11-16 22:09:32 +08:00
tmp_name = NULL ;
2014-06-03 04:36:31 +08:00
} else {
2015-06-05 06:53:32 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( varname ) = = IS_UNDEF ) ) {
GET_OP1_UNDEF_CV ( varname , BP_VAR_R ) ;
}
2017-11-16 22:09:32 +08:00
name = zval_get_tmp_string ( varname , & tmp_name ) ;
2004-10-23 05:42:14 +08:00
}
2018-01-31 18:47:43 +08:00
target_symbol_table = zend_get_target_symbol_table ( opline - > extended_value EXECUTE_DATA_CC ) ;
2017-11-24 19:01:19 +08:00
retval = zend_hash_find_ex ( target_symbol_table , name , OP1_TYPE = = IS_CONST ) ;
2015-10-27 20:47:58 +08:00
if ( retval = = NULL ) {
2017-03-04 17:39:13 +08:00
if ( UNEXPECTED ( zend_string_equals ( name , ZSTR_KNOWN ( ZEND_STR_THIS ) ) ) ) {
2016-06-16 07:30:23 +08:00
ZEND_VM_C_LABEL ( fetch_this ) :
2018-02-21 22:09:42 +08:00
zend_fetch_this_var ( type OPLINE_CC EXECUTE_DATA_CC ) ;
2016-06-16 07:30:23 +08:00
if ( OP1_TYPE ! = IS_CONST ) {
2017-11-16 22:09:32 +08:00
zend_tmp_string_release ( tmp_name ) ;
2016-06-16 07:30:23 +08:00
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
}
2018-02-21 22:09:42 +08:00
if ( type = = BP_VAR_W ) {
retval = zend_hash_add_new ( target_symbol_table , name , & EG ( uninitialized_zval ) ) ;
} else if ( type = = BP_VAR_IS ) {
retval = & EG ( uninitialized_zval ) ;
} else {
zend_error ( E_NOTICE , " Undefined variable: %s " , ZSTR_VAL ( name ) ) ;
if ( type = = BP_VAR_RW ) {
2015-10-27 20:47:58 +08:00
retval = zend_hash_update ( target_symbol_table , name , & EG ( uninitialized_zval ) ) ;
2018-02-21 22:09:42 +08:00
} else {
retval = & EG ( uninitialized_zval ) ;
}
2010-05-06 18:27:35 +08:00
}
2015-10-27 20:47:58 +08:00
/* GLOBAL or $$name variable may be an INDIRECT pointer to CV */
} else if ( Z_TYPE_P ( retval ) = = IS_INDIRECT ) {
retval = Z_INDIRECT_P ( retval ) ;
if ( Z_TYPE_P ( retval ) = = IS_UNDEF ) {
2017-03-04 17:39:13 +08:00
if ( UNEXPECTED ( zend_string_equals ( name , ZSTR_KNOWN ( ZEND_STR_THIS ) ) ) ) {
2016-06-16 07:30:23 +08:00
ZEND_VM_C_GOTO ( fetch_this ) ;
}
2018-02-21 22:09:42 +08:00
if ( type = = BP_VAR_W ) {
ZVAL_NULL ( retval ) ;
} else if ( type = = BP_VAR_IS ) {
retval = & EG ( uninitialized_zval ) ;
} else {
zend_error ( E_NOTICE , " Undefined variable: %s " , ZSTR_VAL ( name ) ) ;
if ( type = = BP_VAR_RW ) {
2015-10-27 20:47:58 +08:00
ZVAL_NULL ( retval ) ;
2018-02-21 22:09:42 +08:00
} else {
retval = & EG ( uninitialized_zval ) ;
}
2004-10-23 05:42:14 +08:00
}
}
2015-10-27 20:47:58 +08:00
}
2018-01-31 03:06:05 +08:00
if ( ! ( opline - > extended_value & ZEND_FETCH_GLOBAL_LOCK ) ) {
2015-10-27 20:47:58 +08:00
FREE_OP1 ( ) ;
2004-10-23 05:42:14 +08:00
}
2014-04-08 04:38:54 +08:00
if ( OP1_TYPE ! = IS_CONST ) {
2017-11-16 22:09:32 +08:00
zend_tmp_string_release ( tmp_name ) ;
2004-10-23 05:42:14 +08:00
}
2014-02-21 21:39:02 +08:00
2014-04-08 04:38:54 +08:00
ZEND_ASSERT ( retval ! = NULL ) ;
if ( type = = BP_VAR_R | | type = = BP_VAR_IS ) {
2016-07-07 01:46:43 +08:00
ZVAL_COPY_UNREF ( EX_VAR ( opline - > result . var ) , retval ) ;
2014-04-08 04:38:54 +08:00
} else {
ZVAL_INDIRECT ( EX_VAR ( opline - > result . var ) , retval ) ;
2014-02-19 19:34:32 +08:00
}
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2015-10-29 04:25:05 +08:00
ZEND_VM_HANDLER ( 80 , ZEND_FETCH_R , CONST | TMPVAR | CV , UNUSED , VAR_FETCH )
2004-10-23 05:42:14 +08:00
{
2015-12-10 22:17:59 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_fetch_var_address_helper , type , BP_VAR_R ) ;
2004-10-23 05:42:14 +08:00
}
2015-10-29 04:25:05 +08:00
ZEND_VM_HANDLER ( 83 , ZEND_FETCH_W , CONST | TMPVAR | CV , UNUSED , VAR_FETCH )
2004-10-23 05:42:14 +08:00
{
2015-12-10 22:17:59 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_fetch_var_address_helper , type , BP_VAR_W ) ;
2004-10-23 05:42:14 +08:00
}
2015-10-29 04:25:05 +08:00
ZEND_VM_HANDLER ( 86 , ZEND_FETCH_RW , CONST | TMPVAR | CV , UNUSED , VAR_FETCH )
2004-10-23 05:42:14 +08:00
{
2015-12-10 22:17:59 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_fetch_var_address_helper , type , BP_VAR_RW ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:40:06 +08:00
ZEND_VM_HANDLER ( 92 , ZEND_FETCH_FUNC_ARG , CONST | TMPVAR | CV , UNUSED , VAR_FETCH )
2004-10-23 05:42:14 +08:00
{
2018-03-07 05:03:13 +08:00
int fetch_type =
( UNEXPECTED ( ZEND_CALL_INFO ( EX ( call ) ) & ZEND_CALL_SEND_ARG_BY_REF ) ) ?
BP_VAR_W : BP_VAR_R ;
ZEND_VM_DISPATCH_TO_HELPER ( zend_fetch_var_address_helper , type , fetch_type ) ;
2004-10-23 05:42:14 +08:00
}
2015-10-29 04:25:05 +08:00
ZEND_VM_HANDLER ( 95 , ZEND_FETCH_UNSET , CONST | TMPVAR | CV , UNUSED , VAR_FETCH )
2004-10-23 05:42:14 +08:00
{
2015-12-10 22:17:59 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_fetch_var_address_helper , type , BP_VAR_UNSET ) ;
2004-10-23 05:42:14 +08:00
}
2015-10-29 04:25:05 +08:00
ZEND_VM_HANDLER ( 89 , ZEND_FETCH_IS , CONST | TMPVAR | CV , UNUSED , VAR_FETCH )
2004-10-23 05:42:14 +08:00
{
2015-12-10 22:17:59 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_fetch_var_address_helper , type , BP_VAR_IS ) ;
2004-10-23 05:42:14 +08:00
}
2015-12-10 22:17:59 +08:00
ZEND_VM_HELPER ( zend_fetch_static_prop_helper , CONST | TMPVAR | CV , UNUSED | CONST | VAR , int type )
2015-10-27 20:47:58 +08:00
{
USE_OPLINE
zend_free_op free_op1 ;
zval * varname ;
zval * retval ;
2018-02-06 00:41:47 +08:00
zend_string * name , * tmp_name ;
zend_class_entry * ce ;
2015-10-27 20:47:58 +08:00
SAVE_OPLINE ( ) ;
2018-02-06 00:41:47 +08:00
do {
if ( OP2_TYPE = = IS_CONST ) {
if ( OP1_TYPE = = IS_CONST & & EXPECTED ( ( ce = CACHED_PTR ( opline - > extended_value ) ) ! = NULL ) ) {
retval = CACHED_PTR ( opline - > extended_value + sizeof ( void * ) ) ;
2018-02-06 01:53:02 +08:00
break ;
2018-02-06 00:41:47 +08:00
} else {
zval * class_name = RT_CONSTANT ( opline , opline - > op2 ) ;
if ( UNEXPECTED ( ( ce = CACHED_PTR ( opline - > extended_value ) ) = = NULL ) ) {
ce = zend_fetch_class_by_name ( Z_STR_P ( class_name ) , class_name + 1 , ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION ) ;
if ( UNEXPECTED ( ce = = NULL ) ) {
FREE_UNFETCHED_OP1 ( ) ;
retval = NULL ;
break ;
}
if ( OP1_TYPE ! = IS_CONST ) {
CACHE_PTR ( opline - > extended_value , ce ) ;
}
}
}
} else {
if ( OP2_TYPE = = IS_UNUSED ) {
ce = zend_fetch_class ( NULL , opline - > op2 . num ) ;
if ( UNEXPECTED ( ce = = NULL ) ) {
FREE_UNFETCHED_OP1 ( ) ;
retval = NULL ;
break ;
}
} else {
ce = Z_CE_P ( EX_VAR ( opline - > op2 . var ) ) ;
}
if ( OP1_TYPE = = IS_CONST & &
EXPECTED ( CACHED_PTR ( opline - > extended_value ) = = ce ) ) {
retval = CACHED_PTR ( opline - > extended_value + sizeof ( void * ) ) ;
2018-02-06 01:53:02 +08:00
break ;
2018-02-06 00:41:47 +08:00
}
}
varname = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
if ( OP1_TYPE = = IS_CONST ) {
name = Z_STR_P ( varname ) ;
} else if ( EXPECTED ( Z_TYPE_P ( varname ) = = IS_STRING ) ) {
name = Z_STR_P ( varname ) ;
tmp_name = NULL ;
} else {
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( varname ) = = IS_UNDEF ) ) {
zval_undefined_cv ( EX ( opline ) - > op1 . var EXECUTE_DATA_CC ) ;
}
name = zval_get_tmp_string ( varname , & tmp_name ) ;
}
retval = zend_std_get_static_property ( ce , name , type = = BP_VAR_IS ) ;
if ( OP1_TYPE ! = IS_CONST ) {
zend_tmp_string_release ( tmp_name ) ;
}
if ( OP1_TYPE = = IS_CONST & & EXPECTED ( retval ) ) {
CACHE_POLYMORPHIC_PTR ( opline - > extended_value , ce , retval ) ;
}
FREE_OP1 ( ) ;
} while ( 0 ) ;
2018-01-04 12:41:57 +08:00
2016-11-22 17:06:39 +08:00
if ( UNEXPECTED ( retval = = NULL ) ) {
2017-04-09 21:35:56 +08:00
if ( EG ( exception ) ) {
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2017-04-09 21:35:44 +08:00
HANDLE_EXCEPTION ( ) ;
2017-04-09 21:35:56 +08:00
} else {
ZEND_ASSERT ( type = = BP_VAR_IS ) ;
retval = & EG ( uninitialized_zval ) ;
2015-12-11 01:24:29 +08:00
}
2015-10-27 20:47:58 +08:00
}
if ( type = = BP_VAR_R | | type = = BP_VAR_IS ) {
2016-07-07 01:46:43 +08:00
ZVAL_COPY_UNREF ( EX_VAR ( opline - > result . var ) , retval ) ;
2015-10-27 20:47:58 +08:00
} else {
ZVAL_INDIRECT ( EX_VAR ( opline - > result . var ) , retval ) ;
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 173 , ZEND_FETCH_STATIC_PROP_R , CONST | TMPVAR | CV , UNUSED | CLASS_FETCH | CONST | VAR , CACHE_SLOT )
2015-10-27 20:47:58 +08:00
{
2015-12-10 22:17:59 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_fetch_static_prop_helper , type , BP_VAR_R ) ;
2015-10-27 20:47:58 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 174 , ZEND_FETCH_STATIC_PROP_W , CONST | TMPVAR | CV , UNUSED | CLASS_FETCH | CONST | VAR , CACHE_SLOT )
2015-10-27 20:47:58 +08:00
{
2015-12-10 22:17:59 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_fetch_static_prop_helper , type , BP_VAR_W ) ;
2015-10-27 20:47:58 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 175 , ZEND_FETCH_STATIC_PROP_RW , CONST | TMPVAR | CV , UNUSED | CLASS_FETCH | CONST | VAR , CACHE_SLOT )
2015-10-27 20:47:58 +08:00
{
2015-12-10 22:17:59 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_fetch_static_prop_helper , type , BP_VAR_RW ) ;
2015-10-27 20:47:58 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 177 , ZEND_FETCH_STATIC_PROP_FUNC_ARG , CONST | TMPVAR | CV , UNUSED | CLASS_FETCH | CONST | VAR , CACHE_SLOT )
2015-10-27 20:47:58 +08:00
{
2018-03-07 05:03:13 +08:00
int fetch_type =
( UNEXPECTED ( ZEND_CALL_INFO ( EX ( call ) ) & ZEND_CALL_SEND_ARG_BY_REF ) ) ?
BP_VAR_W : BP_VAR_R ;
ZEND_VM_DISPATCH_TO_HELPER ( zend_fetch_static_prop_helper , type , fetch_type ) ;
2015-10-27 20:47:58 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 178 , ZEND_FETCH_STATIC_PROP_UNSET , CONST | TMPVAR | CV , UNUSED | CLASS_FETCH | CONST | VAR , CACHE_SLOT )
2015-10-27 20:47:58 +08:00
{
2015-12-10 22:17:59 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_fetch_static_prop_helper , type , BP_VAR_UNSET ) ;
2015-10-27 20:47:58 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 176 , ZEND_FETCH_STATIC_PROP_IS , CONST | TMPVAR | CV , UNUSED | CLASS_FETCH | CONST | VAR , CACHE_SLOT )
2015-10-27 20:47:58 +08:00
{
2015-12-10 22:17:59 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_fetch_static_prop_helper , type , BP_VAR_IS ) ;
2015-10-27 20:47:58 +08:00
}
2014-12-08 23:11:14 +08:00
ZEND_VM_HANDLER ( 81 , ZEND_FETCH_DIM_R , CONST | TMPVAR | CV , CONST | TMPVAR | CV )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2016-05-17 20:08:04 +08:00
zval * container , * dim , * value , * result ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2016-04-13 05:05:19 +08:00
container = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2016-05-17 20:08:04 +08:00
dim = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
if ( OP1_TYPE ! = IS_CONST ) {
if ( EXPECTED ( Z_TYPE_P ( container ) = = IS_ARRAY ) ) {
ZEND_VM_C_LABEL ( fetch_dim_r_array ) :
2017-06-16 06:42:49 +08:00
value = zend_fetch_dimension_address_inner ( Z_ARRVAL_P ( container ) , dim , OP2_TYPE , BP_VAR_R EXECUTE_DATA_CC ) ;
2016-05-17 20:08:04 +08:00
result = EX_VAR ( opline - > result . var ) ;
2016-07-07 01:46:43 +08:00
ZVAL_COPY_UNREF ( result , value ) ;
2016-05-17 20:08:04 +08:00
} else if ( EXPECTED ( Z_TYPE_P ( container ) = = IS_REFERENCE ) ) {
container = Z_REFVAL_P ( container ) ;
if ( EXPECTED ( Z_TYPE_P ( container ) = = IS_ARRAY ) ) {
ZEND_VM_C_GOTO ( fetch_dim_r_array ) ;
} else {
ZEND_VM_C_GOTO ( fetch_dim_r_slow ) ;
}
} else {
ZEND_VM_C_LABEL ( fetch_dim_r_slow ) :
2018-02-21 21:06:29 +08:00
zend_fetch_dimension_address_read_R_slow ( container , dim OPLINE_CC EXECUTE_DATA_CC ) ;
2016-05-17 20:08:04 +08:00
}
} else {
2018-02-21 21:06:29 +08:00
zend_fetch_dimension_address_read_R ( container , dim , OP2_TYPE OPLINE_CC EXECUTE_DATA_CC ) ;
2016-05-17 20:08:04 +08:00
}
2004-10-23 05:42:14 +08:00
FREE_OP2 ( ) ;
2014-10-05 17:02:58 +08:00
FREE_OP1 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2015-12-11 07:31:28 +08:00
ZEND_VM_HANDLER ( 84 , ZEND_FETCH_DIM_W , VAR | CV , CONST | TMPVAR | UNUSED | NEXT | CV )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2018-02-21 21:06:29 +08:00
zval * container ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2014-12-09 06:09:44 +08:00
container = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_W ) ;
2018-02-21 21:06:29 +08:00
zend_fetch_dimension_address_W ( container , GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) , OP2_TYPE OPLINE_CC EXECUTE_DATA_CC ) ;
2004-10-23 05:42:14 +08:00
FREE_OP2 ( ) ;
2017-12-26 21:50:34 +08:00
if ( OP1_TYPE = = IS_VAR ) {
2018-02-21 21:06:29 +08:00
zval * result = EX_VAR ( opline - > result . var ) ;
2017-12-26 21:50:34 +08:00
FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY ( free_op1 , result ) ;
2014-03-04 21:23:23 +08:00
}
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2015-12-11 07:31:28 +08:00
ZEND_VM_HANDLER ( 87 , ZEND_FETCH_DIM_RW , VAR | CV , CONST | TMPVAR | UNUSED | NEXT | CV )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2018-02-21 21:06:29 +08:00
zval * container ;
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2016-04-13 06:19:20 +08:00
container = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_RW ) ;
2018-02-21 21:06:29 +08:00
zend_fetch_dimension_address_RW ( container , GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) , OP2_TYPE OPLINE_CC EXECUTE_DATA_CC ) ;
2004-10-23 05:42:14 +08:00
FREE_OP2 ( ) ;
2017-12-26 21:50:34 +08:00
if ( OP1_TYPE = = IS_VAR ) {
2018-02-21 21:06:29 +08:00
zval * result = EX_VAR ( opline - > result . var ) ;
2017-12-26 21:50:34 +08:00
FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY ( free_op1 , result ) ;
2014-03-04 21:23:23 +08:00
}
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2014-12-08 23:11:14 +08:00
ZEND_VM_HANDLER ( 90 , ZEND_FETCH_DIM_IS , CONST | TMPVAR | CV , CONST | TMPVAR | CV )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2013-11-27 18:26:34 +08:00
zval * container ;
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2016-04-13 05:05:19 +08:00
container = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_IS ) ;
2018-02-21 21:06:29 +08:00
zend_fetch_dimension_address_read_IS ( container , GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) , OP2_TYPE OPLINE_CC EXECUTE_DATA_CC ) ;
2004-10-23 05:42:14 +08:00
FREE_OP2 ( ) ;
2013-11-27 18:26:34 +08:00
FREE_OP1 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-21 17:07:29 +08:00
ZEND_VM_COLD_HELPER ( zend_use_tmp_in_write_context_helper , ANY , ANY )
2018-02-21 06:27:39 +08:00
{
USE_OPLINE
SAVE_OPLINE ( ) ;
zend_throw_error ( NULL , " Cannot use temporary expression in write context " ) ;
FREE_UNFETCHED_OP2 ( ) ;
FREE_UNFETCHED_OP1 ( ) ;
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
HANDLE_EXCEPTION ( ) ;
}
2018-02-21 17:07:29 +08:00
ZEND_VM_COLD_HELPER ( zend_use_undef_in_read_context_helper , ANY , ANY )
2018-02-21 06:27:39 +08:00
{
USE_OPLINE
SAVE_OPLINE ( ) ;
zend_throw_error ( NULL , " Cannot use [] for reading " ) ;
FREE_UNFETCHED_OP2 ( ) ;
FREE_UNFETCHED_OP1 ( ) ;
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
HANDLE_EXCEPTION ( ) ;
}
2018-02-06 00:40:06 +08:00
ZEND_VM_HANDLER ( 93 , ZEND_FETCH_DIM_FUNC_ARG , CONST | TMP | VAR | CV , CONST | TMPVAR | UNUSED | NEXT | CV )
2004-10-23 05:42:14 +08:00
{
2018-02-06 00:40:06 +08:00
if ( UNEXPECTED ( ZEND_CALL_INFO ( EX ( call ) ) & ZEND_CALL_SEND_ARG_BY_REF ) ) {
2016-02-15 11:12:04 +08:00
if ( ( OP1_TYPE & ( IS_CONST | IS_TMP_VAR ) ) ) {
2018-02-21 06:27:39 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_use_tmp_in_write_context_helper ) ;
2014-06-01 02:15:55 +08:00
}
2017-12-07 06:52:27 +08:00
ZEND_VM_DISPATCH_TO_HANDLER ( ZEND_FETCH_DIM_W ) ;
2007-12-14 22:14:50 +08:00
} else {
if ( OP2_TYPE = = IS_UNUSED ) {
2018-02-21 06:27:39 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_use_undef_in_read_context_helper ) ;
2007-11-06 22:11:59 +08:00
}
2017-12-07 06:52:27 +08:00
ZEND_VM_DISPATCH_TO_HANDLER ( ZEND_FETCH_DIM_R ) ;
2006-07-19 17:55:19 +08:00
}
2004-10-23 05:42:14 +08:00
}
2014-12-05 18:45:03 +08:00
ZEND_VM_HANDLER ( 96 , ZEND_FETCH_DIM_UNSET , VAR | CV , CONST | TMPVAR | CV )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2018-02-21 21:06:29 +08:00
zval * container ;
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2016-04-13 06:19:20 +08:00
container = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_UNSET ) ;
2018-02-21 21:06:29 +08:00
zend_fetch_dimension_address_UNSET ( container , GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) , OP2_TYPE OPLINE_CC EXECUTE_DATA_CC ) ;
2004-10-23 05:42:14 +08:00
FREE_OP2 ( ) ;
2017-12-26 21:50:34 +08:00
if ( OP1_TYPE = = IS_VAR ) {
2018-02-21 21:06:29 +08:00
zval * result = EX_VAR ( opline - > result . var ) ;
2017-12-26 21:50:34 +08:00
FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY ( free_op1 , result ) ;
2014-03-04 21:23:23 +08:00
}
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HOT_OBJ_HANDLER ( 82 , ZEND_FETCH_OBJ_R , CONST | TMPVAR | UNUSED | THIS | CV , CONST | TMPVAR | CV , CACHE_SLOT )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 ;
2010-04-20 19:16:39 +08:00
zval * container ;
2009-01-15 16:48:58 +08:00
zend_free_op free_op2 ;
2010-04-20 19:16:39 +08:00
zval * offset ;
2017-10-23 23:29:13 +08:00
void * * cache_slot = NULL ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2017-11-23 18:18:52 +08:00
container = GET_OP1_OBJ_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2010-04-20 19:16:39 +08:00
2016-04-01 21:17:49 +08:00
if ( OP1_TYPE = = IS_UNUSED & & UNEXPECTED ( Z_TYPE_P ( container ) = = IS_UNDEF ) ) {
2017-06-15 21:23:05 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_this_not_in_object_context_helper ) ;
2015-04-01 20:54:03 +08:00
}
2015-04-02 08:56:42 +08:00
2017-11-23 18:18:52 +08:00
offset = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2015-04-02 08:56:42 +08:00
2015-06-03 23:44:25 +08:00
if ( OP1_TYPE = = IS_CONST | |
( OP1_TYPE ! = IS_UNUSED & & UNEXPECTED ( Z_TYPE_P ( container ) ! = IS_OBJECT ) ) ) {
2017-11-23 18:18:52 +08:00
do {
if ( ( OP1_TYPE & ( IS_VAR | IS_CV ) ) & & Z_ISREF_P ( container ) ) {
container = Z_REFVAL_P ( container ) ;
if ( EXPECTED ( Z_TYPE_P ( container ) = = IS_OBJECT ) ) {
break ;
}
}
2017-11-23 18:45:21 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( container ) = = IS_UNDEF ) ) {
2017-11-23 18:18:52 +08:00
GET_OP1_UNDEF_CV ( container , BP_VAR_R ) ;
}
2017-11-23 18:45:21 +08:00
if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( offset ) = = IS_UNDEF ) ) {
2017-11-23 18:18:52 +08:00
GET_OP2_UNDEF_CV ( offset , BP_VAR_R ) ;
2014-12-08 23:11:14 +08:00
}
ZEND_VM_C_GOTO ( fetch_obj_r_no_object ) ;
2017-11-23 18:18:52 +08:00
} while ( 0 ) ;
2015-01-03 17:22:58 +08:00
}
2015-01-13 20:31:42 +08:00
/* here we are sure we are dealing with an object */
do {
zend_object * zobj = Z_OBJ_P ( container ) ;
2007-12-14 22:14:50 +08:00
zval * retval ;
2004-10-23 05:42:14 +08:00
2017-10-23 23:29:13 +08:00
if ( OP2_TYPE = = IS_CONST ) {
2018-02-06 00:41:47 +08:00
cache_slot = CACHE_ADDR ( opline - > extended_value ) ;
2015-01-13 20:31:42 +08:00
2017-10-23 23:29:13 +08:00
if ( EXPECTED ( zobj - > ce = = CACHED_PTR_EX ( cache_slot ) ) ) {
2017-10-25 16:45:17 +08:00
uintptr_t prop_offset = ( uintptr_t ) CACHED_PTR_EX ( cache_slot + 1 ) ;
2017-10-23 23:29:13 +08:00
if ( EXPECTED ( IS_VALID_PROPERTY_OFFSET ( prop_offset ) ) ) {
retval = OBJ_PROP ( zobj , prop_offset ) ;
if ( EXPECTED ( Z_TYPE_INFO_P ( retval ) ! = IS_UNDEF ) ) {
ZVAL_COPY_UNREF ( EX_VAR ( opline - > result . var ) , retval ) ;
break ;
}
} else if ( EXPECTED ( zobj - > properties ! = NULL ) ) {
if ( ! IS_UNKNOWN_DYNAMIC_PROPERTY_OFFSET ( prop_offset ) ) {
2017-10-25 16:45:17 +08:00
uintptr_t idx = ZEND_DECODE_DYN_PROP_OFFSET ( prop_offset ) ;
2017-10-23 23:29:13 +08:00
2017-10-24 15:28:19 +08:00
if ( EXPECTED ( idx < zobj - > properties - > nNumUsed * sizeof ( Bucket ) ) ) {
Bucket * p = ( Bucket * ) ( ( char * ) zobj - > properties - > arData + idx ) ;
2017-10-23 23:29:13 +08:00
if ( EXPECTED ( Z_TYPE ( p - > val ) ! = IS_UNDEF ) & &
( EXPECTED ( p - > key = = Z_STR_P ( offset ) ) | |
( EXPECTED ( p - > h = = ZSTR_H ( Z_STR_P ( offset ) ) ) & &
EXPECTED ( p - > key ! = NULL ) & &
2017-12-04 22:17:02 +08:00
EXPECTED ( zend_string_equal_content ( p - > key , Z_STR_P ( offset ) ) ) ) ) ) {
2017-10-23 23:29:13 +08:00
ZVAL_COPY_UNREF ( EX_VAR ( opline - > result . var ) , & p - > val ) ;
break ;
}
}
2017-10-24 15:28:19 +08:00
CACHE_PTR_EX ( cache_slot + 1 , ( void * ) ZEND_DYNAMIC_PROPERTY_OFFSET ) ;
2017-10-23 23:29:13 +08:00
}
2017-11-24 19:01:19 +08:00
retval = zend_hash_find_ex ( zobj - > properties , Z_STR_P ( offset ) , 1 ) ;
2017-10-23 23:29:13 +08:00
if ( EXPECTED ( retval ) ) {
2017-10-25 16:45:17 +08:00
uintptr_t idx = ( char * ) retval - ( char * ) zobj - > properties - > arData ;
2017-10-24 15:28:19 +08:00
CACHE_PTR_EX ( cache_slot + 1 , ( void * ) ZEND_ENCODE_DYN_PROP_OFFSET ( idx ) ) ;
2017-10-23 23:29:13 +08:00
ZVAL_COPY_UNREF ( EX_VAR ( opline - > result . var ) , retval ) ;
break ;
}
2014-11-06 19:50:03 +08:00
}
}
2017-11-23 18:18:52 +08:00
} else if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( offset ) = = IS_UNDEF ) ) {
GET_OP2_UNDEF_CV ( offset , BP_VAR_R ) ;
2015-01-13 20:31:42 +08:00
}
2004-10-23 05:42:14 +08:00
2015-01-13 20:31:42 +08:00
if ( UNEXPECTED ( zobj - > handlers - > read_property = = NULL ) ) {
ZEND_VM_C_LABEL ( fetch_obj_r_no_object ) :
2017-12-22 21:35:52 +08:00
zend_wrong_property_read ( offset ) ;
2015-01-13 20:31:42 +08:00
ZVAL_NULL ( EX_VAR ( opline - > result . var ) ) ;
} else {
2017-10-23 23:29:13 +08:00
retval = zobj - > handlers - > read_property ( container , offset , BP_VAR_R , cache_slot , EX_VAR ( opline - > result . var ) ) ;
2014-11-06 19:50:03 +08:00
if ( retval ! = EX_VAR ( opline - > result . var ) ) {
2016-07-07 01:46:43 +08:00
ZVAL_COPY_UNREF ( EX_VAR ( opline - > result . var ) , retval ) ;
2014-11-06 19:50:03 +08:00
}
2015-01-13 20:31:42 +08:00
}
} while ( 0 ) ;
2004-10-23 05:42:14 +08:00
2014-04-16 01:56:30 +08:00
FREE_OP2 ( ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 85 , ZEND_FETCH_OBJ_W , VAR | UNUSED | THIS | CV , CONST | TMPVAR | CV , CACHE_SLOT )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2017-12-26 21:50:34 +08:00
zval * property , * container , * result ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2014-12-09 06:09:44 +08:00
container = GET_OP1_OBJ_ZVAL_PTR_PTR_UNDEF ( BP_VAR_W ) ;
2016-04-01 21:17:49 +08:00
if ( OP1_TYPE = = IS_UNUSED & & UNEXPECTED ( Z_TYPE_P ( container ) = = IS_UNDEF ) ) {
2017-06-15 21:23:05 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_this_not_in_object_context_helper ) ;
2015-04-01 20:54:03 +08:00
}
2010-04-20 19:16:39 +08:00
2017-06-15 21:23:05 +08:00
property = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
2017-12-26 21:50:34 +08:00
result = EX_VAR ( opline - > result . var ) ;
2018-02-22 16:00:29 +08:00
zend_fetch_property_address ( result , container , OP1_TYPE , property , OP2_TYPE , ( ( OP2_TYPE = = IS_CONST ) ? CACHE_ADDR ( opline - > extended_value ) : NULL ) , BP_VAR_W OPLINE_CC ) ;
2014-04-16 01:56:30 +08:00
FREE_OP2 ( ) ;
2017-12-26 21:50:34 +08:00
if ( OP1_TYPE = = IS_VAR ) {
FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY ( free_op1 , result ) ;
2014-03-04 21:23:23 +08:00
}
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 88 , ZEND_FETCH_OBJ_RW , VAR | UNUSED | THIS | CV , CONST | TMPVAR | CV , CACHE_SLOT )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2017-12-26 21:50:34 +08:00
zval * property , * container , * result ;
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2014-03-04 16:27:50 +08:00
container = GET_OP1_OBJ_ZVAL_PTR_PTR ( BP_VAR_RW ) ;
2004-10-23 05:42:14 +08:00
2016-04-01 21:17:49 +08:00
if ( OP1_TYPE = = IS_UNUSED & & UNEXPECTED ( Z_TYPE_P ( container ) = = IS_UNDEF ) ) {
2017-06-15 21:23:05 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_this_not_in_object_context_helper ) ;
2015-04-01 20:54:03 +08:00
}
2017-06-15 21:23:05 +08:00
property = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
2017-12-26 21:50:34 +08:00
result = EX_VAR ( opline - > result . var ) ;
2018-02-22 16:00:29 +08:00
zend_fetch_property_address ( result , container , OP1_TYPE , property , OP2_TYPE , ( ( OP2_TYPE = = IS_CONST ) ? CACHE_ADDR ( opline - > extended_value ) : NULL ) , BP_VAR_RW OPLINE_CC ) ;
2014-04-16 01:56:30 +08:00
FREE_OP2 ( ) ;
2017-12-26 21:50:34 +08:00
if ( OP1_TYPE = = IS_VAR ) {
FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY ( free_op1 , result ) ;
2014-03-04 21:23:23 +08:00
}
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 91 , ZEND_FETCH_OBJ_IS , CONST | TMPVAR | UNUSED | THIS | CV , CONST | TMPVAR | CV , CACHE_SLOT )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
zend_free_op free_op1 ;
zval * container ;
zend_free_op free_op2 ;
zval * offset ;
2017-10-23 23:29:13 +08:00
void * * cache_slot = NULL ;
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2014-12-08 23:11:14 +08:00
container = GET_OP1_OBJ_ZVAL_PTR ( BP_VAR_IS ) ;
2010-04-20 19:16:39 +08:00
2016-04-01 21:17:49 +08:00
if ( OP1_TYPE = = IS_UNUSED & & UNEXPECTED ( Z_TYPE_P ( container ) = = IS_UNDEF ) ) {
2017-06-15 21:23:05 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_this_not_in_object_context_helper ) ;
2015-04-01 20:54:03 +08:00
}
2015-04-02 08:56:42 +08:00
2017-11-23 18:18:52 +08:00
offset = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
2015-04-02 08:56:42 +08:00
2015-06-03 23:44:25 +08:00
if ( OP1_TYPE = = IS_CONST | |
( OP1_TYPE ! = IS_UNUSED & & UNEXPECTED ( Z_TYPE_P ( container ) ! = IS_OBJECT ) ) ) {
2017-11-23 18:18:52 +08:00
do {
if ( ( OP1_TYPE & ( IS_VAR | IS_CV ) ) & & Z_ISREF_P ( container ) ) {
container = Z_REFVAL_P ( container ) ;
if ( EXPECTED ( Z_TYPE_P ( container ) = = IS_OBJECT ) ) {
break ;
}
2014-12-08 23:11:14 +08:00
}
ZEND_VM_C_GOTO ( fetch_obj_is_no_object ) ;
2017-11-23 18:18:52 +08:00
} while ( 0 ) ;
2015-01-03 17:22:58 +08:00
}
2015-01-13 20:31:42 +08:00
/* here we are sure we are dealing with an object */
do {
zend_object * zobj = Z_OBJ_P ( container ) ;
2010-04-20 19:16:39 +08:00
zval * retval ;
2017-10-23 23:29:13 +08:00
if ( OP2_TYPE = = IS_CONST ) {
2018-02-06 00:41:47 +08:00
cache_slot = CACHE_ADDR ( opline - > extended_value ) ;
2015-01-13 20:31:42 +08:00
2017-10-23 23:29:13 +08:00
if ( EXPECTED ( zobj - > ce = = CACHED_PTR_EX ( cache_slot ) ) ) {
2017-10-25 16:45:17 +08:00
uintptr_t prop_offset = ( uintptr_t ) CACHED_PTR_EX ( cache_slot + 1 ) ;
2017-10-23 23:29:13 +08:00
if ( EXPECTED ( IS_VALID_PROPERTY_OFFSET ( prop_offset ) ) ) {
retval = OBJ_PROP ( zobj , prop_offset ) ;
if ( EXPECTED ( Z_TYPE_P ( retval ) ! = IS_UNDEF ) ) {
ZVAL_COPY ( EX_VAR ( opline - > result . var ) , retval ) ;
break ;
}
} else if ( EXPECTED ( zobj - > properties ! = NULL ) ) {
if ( ! IS_UNKNOWN_DYNAMIC_PROPERTY_OFFSET ( prop_offset ) ) {
2017-10-25 16:45:17 +08:00
uintptr_t idx = ZEND_DECODE_DYN_PROP_OFFSET ( prop_offset ) ;
2017-10-23 23:29:13 +08:00
2017-10-24 15:28:19 +08:00
if ( EXPECTED ( idx < zobj - > properties - > nNumUsed * sizeof ( Bucket ) ) ) {
Bucket * p = ( Bucket * ) ( ( char * ) zobj - > properties - > arData + idx ) ;
2017-10-23 23:29:13 +08:00
if ( EXPECTED ( Z_TYPE ( p - > val ) ! = IS_UNDEF ) & &
( EXPECTED ( p - > key = = Z_STR_P ( offset ) ) | |
( EXPECTED ( p - > h = = ZSTR_H ( Z_STR_P ( offset ) ) ) & &
EXPECTED ( p - > key ! = NULL ) & &
2017-12-04 22:17:02 +08:00
EXPECTED ( zend_string_equal_content ( p - > key , Z_STR_P ( offset ) ) ) ) ) ) {
2017-10-23 23:29:13 +08:00
ZVAL_COPY ( EX_VAR ( opline - > result . var ) , & p - > val ) ;
break ;
}
}
2017-10-24 15:28:19 +08:00
CACHE_PTR_EX ( cache_slot + 1 , ( void * ) ZEND_DYNAMIC_PROPERTY_OFFSET ) ;
2017-10-23 23:29:13 +08:00
}
2017-11-24 19:01:19 +08:00
retval = zend_hash_find_ex ( zobj - > properties , Z_STR_P ( offset ) , 1 ) ;
2017-10-23 23:29:13 +08:00
if ( EXPECTED ( retval ) ) {
2017-10-25 16:45:17 +08:00
uintptr_t idx = ( char * ) retval - ( char * ) zobj - > properties - > arData ;
2017-10-24 15:28:19 +08:00
CACHE_PTR_EX ( cache_slot + 1 , ( void * ) ZEND_ENCODE_DYN_PROP_OFFSET ( idx ) ) ;
2017-10-23 23:29:13 +08:00
ZVAL_COPY ( EX_VAR ( opline - > result . var ) , retval ) ;
break ;
}
2014-11-06 19:50:03 +08:00
}
}
2015-01-13 20:31:42 +08:00
}
2010-04-20 19:16:39 +08:00
2015-01-13 20:31:42 +08:00
if ( UNEXPECTED ( zobj - > handlers - > read_property = = NULL ) ) {
ZEND_VM_C_LABEL ( fetch_obj_is_no_object ) :
ZVAL_NULL ( EX_VAR ( opline - > result . var ) ) ;
} else {
2017-10-23 23:29:13 +08:00
retval = zobj - > handlers - > read_property ( container , offset , BP_VAR_IS , cache_slot , EX_VAR ( opline - > result . var ) ) ;
2014-11-06 19:50:03 +08:00
if ( retval ! = EX_VAR ( opline - > result . var ) ) {
ZVAL_COPY ( EX_VAR ( opline - > result . var ) , retval ) ;
}
2015-01-13 20:31:42 +08:00
}
} while ( 0 ) ;
2010-04-20 19:16:39 +08:00
2014-04-16 01:56:30 +08:00
FREE_OP2 ( ) ;
2010-04-20 19:16:39 +08:00
FREE_OP1 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 94 , ZEND_FETCH_OBJ_FUNC_ARG , CONST | TMP | VAR | UNUSED | THIS | CV , CONST | TMPVAR | CV , CACHE_SLOT )
2004-10-23 05:42:14 +08:00
{
2018-02-06 00:40:06 +08:00
if ( UNEXPECTED ( ZEND_CALL_INFO ( EX ( call ) ) & ZEND_CALL_SEND_ARG_BY_REF ) ) {
2004-10-23 05:42:14 +08:00
/* Behave like FETCH_OBJ_W */
2016-02-15 11:12:04 +08:00
if ( ( OP1_TYPE & ( IS_CONST | IS_TMP_VAR ) ) ) {
2018-02-21 06:27:39 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_use_tmp_in_write_context_helper ) ;
2015-03-09 20:57:15 +08:00
}
2017-11-25 05:57:45 +08:00
2017-12-07 06:52:27 +08:00
ZEND_VM_DISPATCH_TO_HANDLER ( ZEND_FETCH_OBJ_W ) ;
2004-10-23 05:42:14 +08:00
} else {
2014-09-24 03:26:39 +08:00
ZEND_VM_DISPATCH_TO_HANDLER ( ZEND_FETCH_OBJ_R ) ;
2004-10-23 05:42:14 +08:00
}
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 97 , ZEND_FETCH_OBJ_UNSET , VAR | UNUSED | THIS | CV , CONST | TMPVAR | CV , CACHE_SLOT )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2014-04-04 23:01:53 +08:00
zend_free_op free_op1 , free_op2 ;
2017-12-26 21:50:34 +08:00
zval * container , * property , * result ;
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2014-03-04 16:27:50 +08:00
container = GET_OP1_OBJ_ZVAL_PTR_PTR ( BP_VAR_UNSET ) ;
2004-10-23 05:42:14 +08:00
2016-04-01 21:17:49 +08:00
if ( OP1_TYPE = = IS_UNUSED & & UNEXPECTED ( Z_TYPE_P ( container ) = = IS_UNDEF ) ) {
2017-06-15 21:23:05 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_this_not_in_object_context_helper ) ;
2015-04-01 20:54:03 +08:00
}
2015-04-02 08:56:42 +08:00
property = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
2017-12-26 21:50:34 +08:00
result = EX_VAR ( opline - > result . var ) ;
2018-02-22 16:00:29 +08:00
zend_fetch_property_address ( result , container , OP1_TYPE , property , OP2_TYPE , ( ( OP2_TYPE = = IS_CONST ) ? CACHE_ADDR ( opline - > extended_value ) : NULL ) , BP_VAR_UNSET OPLINE_CC ) ;
2014-04-16 01:56:30 +08:00
FREE_OP2 ( ) ;
2017-12-26 21:50:34 +08:00
if ( OP1_TYPE = = IS_VAR ) {
FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY ( free_op1 , result ) ;
2014-03-04 21:23:23 +08:00
}
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2017-12-29 17:02:50 +08:00
ZEND_VM_HANDLER ( 98 , ZEND_FETCH_LIST_R , CONST | TMPVARCV , CONST | TMPVAR | CV )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2016-04-13 03:53:01 +08:00
zend_free_op free_op1 , free_op2 ;
2010-04-20 19:16:39 +08:00
zval * container ;
SAVE_OPLINE ( ) ;
2016-04-13 05:05:19 +08:00
container = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2018-02-21 21:06:29 +08:00
zend_fetch_dimension_address_LIST_r ( container , GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) OPLINE_CC EXECUTE_DATA_CC ) ;
2017-10-07 07:30:58 +08:00
FREE_OP2 ( ) ;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
}
ZEND_VM_HANDLER ( 198 , ZEND_FETCH_LIST_W , VAR | CV , CONST | TMPVAR | CV )
{
USE_OPLINE
zend_free_op free_op1 , free_op2 ;
2018-02-21 21:06:29 +08:00
zval * container , * dim ;
2017-10-07 07:30:58 +08:00
SAVE_OPLINE ( ) ;
container = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_W ) ;
dim = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
if ( OP1_TYPE = = IS_VAR
& & Z_TYPE_P ( EX_VAR ( opline - > op1 . var ) ) ! = IS_INDIRECT
& & UNEXPECTED ( ! Z_ISREF_P ( container ) )
) {
zend_error ( E_NOTICE , " Attempting to set reference to non referenceable value " ) ;
2018-02-21 21:06:29 +08:00
zend_fetch_dimension_address_LIST_r ( container , dim OPLINE_CC EXECUTE_DATA_CC ) ;
2017-10-07 07:30:58 +08:00
} else {
2018-02-21 21:06:29 +08:00
zend_fetch_dimension_address_LIST_w ( container , dim OPLINE_CC EXECUTE_DATA_CC ) ;
2017-10-07 07:30:58 +08:00
}
2016-03-26 01:18:42 +08:00
FREE_OP2 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 136 , ZEND_ASSIGN_OBJ , VAR | UNUSED | THIS | CV , CONST | TMPVAR | CV , CACHE_SLOT , SPEC ( OP_DATA = CONST | TMP | VAR | CV ) )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2016-02-02 10:03:21 +08:00
zend_free_op free_op1 , free_op2 , free_op_data ;
2017-07-27 10:42:36 +08:00
zval * object , * property , * value , tmp ;
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2014-12-09 05:10:23 +08:00
object = GET_OP1_OBJ_ZVAL_PTR_PTR_UNDEF ( BP_VAR_W ) ;
2004-10-23 05:42:14 +08:00
2016-04-01 21:17:49 +08:00
if ( OP1_TYPE = = IS_UNUSED & & UNEXPECTED ( Z_TYPE_P ( object ) = = IS_UNDEF ) ) {
2017-06-15 21:23:05 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_this_not_in_object_context_helper ) ;
2015-04-01 20:54:03 +08:00
}
2015-04-02 08:56:42 +08:00
2017-07-27 10:42:36 +08:00
property = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
2016-02-02 10:03:21 +08:00
value = GET_OP_DATA_ZVAL_PTR ( BP_VAR_R ) ;
2015-04-02 08:56:42 +08:00
2016-02-02 10:03:21 +08:00
if ( OP1_TYPE ! = IS_UNUSED & & UNEXPECTED ( Z_TYPE_P ( object ) ! = IS_OBJECT ) ) {
2018-02-20 22:22:11 +08:00
if ( Z_ISREF_P ( object ) ) {
object = Z_REFVAL_P ( object ) ;
if ( EXPECTED ( Z_TYPE_P ( object ) = = IS_OBJECT ) ) {
ZEND_VM_C_GOTO ( assign_object ) ;
2016-02-02 10:03:21 +08:00
}
2018-02-20 22:22:11 +08:00
}
2018-02-21 01:39:02 +08:00
if ( UNEXPECTED ( ! make_real_object ( object , property OPLINE_CC EXECUTE_DATA_CC ) ) ) {
2018-02-20 22:22:11 +08:00
FREE_OP_DATA ( ) ;
ZEND_VM_C_GOTO ( exit_assign_obj ) ;
}
2016-02-02 10:03:21 +08:00
}
2018-02-20 22:22:11 +08:00
ZEND_VM_C_LABEL ( assign_object ) :
2016-02-02 10:03:21 +08:00
if ( OP2_TYPE = = IS_CONST & &
2018-02-06 00:41:47 +08:00
EXPECTED ( Z_OBJCE_P ( object ) = = CACHED_PTR ( opline - > extended_value ) ) ) {
uintptr_t prop_offset = ( uintptr_t ) CACHED_PTR ( opline - > extended_value + sizeof ( void * ) ) ;
2016-02-02 10:03:21 +08:00
zend_object * zobj = Z_OBJ_P ( object ) ;
2017-07-27 10:42:36 +08:00
zval * property_val ;
2016-02-02 10:03:21 +08:00
2017-09-18 18:13:24 +08:00
if ( EXPECTED ( IS_VALID_PROPERTY_OFFSET ( prop_offset ) ) ) {
2017-07-27 10:42:36 +08:00
property_val = OBJ_PROP ( zobj , prop_offset ) ;
if ( Z_TYPE_P ( property_val ) ! = IS_UNDEF ) {
2016-02-02 10:03:21 +08:00
ZEND_VM_C_LABEL ( fast_assign_obj ) :
2017-07-27 10:42:36 +08:00
value = zend_assign_to_variable ( property_val , value , OP_DATA_TYPE ) ;
2016-02-02 10:03:21 +08:00
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
ZVAL_COPY ( EX_VAR ( opline - > result . var ) , value ) ;
}
ZEND_VM_C_GOTO ( exit_assign_obj ) ;
}
} else {
if ( EXPECTED ( zobj - > properties ! = NULL ) ) {
if ( UNEXPECTED ( GC_REFCOUNT ( zobj - > properties ) > 1 ) ) {
if ( EXPECTED ( ! ( GC_FLAGS ( zobj - > properties ) & IS_ARRAY_IMMUTABLE ) ) ) {
2017-10-27 06:28:58 +08:00
GC_DELREF ( zobj - > properties ) ;
2016-02-02 10:03:21 +08:00
}
zobj - > properties = zend_array_dup ( zobj - > properties ) ;
}
2017-11-24 19:01:19 +08:00
property_val = zend_hash_find_ex ( zobj - > properties , Z_STR_P ( property ) , 1 ) ;
2017-07-27 10:42:36 +08:00
if ( property_val ) {
2016-02-02 10:03:21 +08:00
ZEND_VM_C_GOTO ( fast_assign_obj ) ;
}
}
if ( ! zobj - > ce - > __set ) {
if ( EXPECTED ( zobj - > properties = = NULL ) ) {
rebuild_object_properties ( zobj ) ;
}
if ( OP_DATA_TYPE = = IS_CONST ) {
2016-04-06 01:09:14 +08:00
if ( UNEXPECTED ( Z_OPT_REFCOUNTED_P ( value ) ) ) {
Z_ADDREF_P ( value ) ;
2016-02-02 10:03:21 +08:00
}
} else if ( OP_DATA_TYPE ! = IS_TMP_VAR ) {
if ( Z_ISREF_P ( value ) ) {
if ( OP_DATA_TYPE = = IS_VAR ) {
zend_reference * ref = Z_REF_P ( value ) ;
2017-10-27 06:28:58 +08:00
if ( GC_DELREF ( ref ) = = 0 ) {
2016-02-02 10:03:21 +08:00
ZVAL_COPY_VALUE ( & tmp , Z_REFVAL_P ( value ) ) ;
efree_size ( ref , sizeof ( zend_reference ) ) ;
value = & tmp ;
} else {
value = Z_REFVAL_P ( value ) ;
2017-11-01 10:25:10 +08:00
Z_TRY_ADDREF_P ( value ) ;
2016-02-02 10:03:21 +08:00
}
} else {
value = Z_REFVAL_P ( value ) ;
2017-11-01 10:25:10 +08:00
Z_TRY_ADDREF_P ( value ) ;
2016-02-02 10:03:21 +08:00
}
2017-11-02 12:13:35 +08:00
} else if ( OP_DATA_TYPE = = IS_CV ) {
Z_TRY_ADDREF_P ( value ) ;
2016-02-02 10:03:21 +08:00
}
}
2017-07-27 10:42:36 +08:00
zend_hash_add_new ( zobj - > properties , Z_STR_P ( property ) , value ) ;
2016-02-02 10:03:21 +08:00
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
ZVAL_COPY ( EX_VAR ( opline - > result . var ) , value ) ;
}
ZEND_VM_C_GOTO ( exit_assign_obj ) ;
}
}
}
if ( ! Z_OBJ_HT_P ( object ) - > write_property ) {
2018-02-21 23:43:38 +08:00
zend_wrong_property_assignment ( property OPLINE_CC EXECUTE_DATA_CC ) ;
2016-02-02 10:03:21 +08:00
FREE_OP_DATA ( ) ;
ZEND_VM_C_GOTO ( exit_assign_obj ) ;
}
2016-06-09 00:01:28 +08:00
if ( OP_DATA_TYPE = = IS_CV | | OP_DATA_TYPE = = IS_VAR ) {
2016-02-02 10:03:21 +08:00
ZVAL_DEREF ( value ) ;
}
2018-02-06 00:41:47 +08:00
Z_OBJ_HT_P ( object ) - > write_property ( object , property , value , ( OP2_TYPE = = IS_CONST ) ? CACHE_ADDR ( opline - > extended_value ) : NULL ) ;
2016-02-02 10:03:21 +08:00
2016-12-07 05:41:07 +08:00
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
2016-02-02 10:03:21 +08:00
ZVAL_COPY ( EX_VAR ( opline - > result . var ) , value ) ;
}
2016-06-08 16:24:53 +08:00
FREE_OP_DATA ( ) ;
2016-02-02 10:03:21 +08:00
ZEND_VM_C_LABEL ( exit_assign_obj ) :
2014-04-16 01:56:30 +08:00
FREE_OP2 ( ) ;
2014-03-04 16:27:50 +08:00
FREE_OP1_VAR_PTR ( ) ;
2004-10-23 05:42:14 +08:00
/* assign_obj has two opcodes! */
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_EX ( 1 , 2 ) ;
2004-10-23 05:42:14 +08:00
}
2016-02-02 10:03:21 +08:00
ZEND_VM_HANDLER ( 147 , ZEND_ASSIGN_DIM , VAR | CV , CONST | TMPVAR | UNUSED | NEXT | CV , SPEC ( OP_DATA = CONST | TMP | VAR | CV ) )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 ;
2014-02-10 14:04:30 +08:00
zval * object_ptr ;
2016-02-02 10:03:21 +08:00
zend_free_op free_op2 , free_op_data ;
2014-12-09 05:10:23 +08:00
zval * value ;
zval * variable_ptr ;
zval * dim ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2014-12-09 05:10:23 +08:00
object_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_W ) ;
2010-04-20 19:16:39 +08:00
2014-12-09 05:10:23 +08:00
if ( EXPECTED ( Z_TYPE_P ( object_ptr ) = = IS_ARRAY ) ) {
ZEND_VM_C_LABEL ( try_assign_dim_array ) :
2016-04-13 00:36:24 +08:00
SEPARATE_ARRAY ( object_ptr ) ;
2015-02-26 07:49:19 +08:00
if ( OP2_TYPE = = IS_UNUSED ) {
variable_ptr = zend_hash_next_index_insert ( Z_ARRVAL_P ( object_ptr ) , & EG ( uninitialized_zval ) ) ;
if ( UNEXPECTED ( variable_ptr = = NULL ) ) {
2018-02-16 07:45:31 +08:00
zend_cannot_add_element ( ) ;
2016-04-13 00:36:24 +08:00
ZEND_VM_C_GOTO ( assign_dim_error ) ;
2015-02-26 07:49:19 +08:00
}
} else {
2016-04-13 00:36:24 +08:00
dim = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
if ( OP2_TYPE = = IS_CONST ) {
2017-06-16 06:42:49 +08:00
variable_ptr = zend_fetch_dimension_address_inner_W_CONST ( Z_ARRVAL_P ( object_ptr ) , dim EXECUTE_DATA_CC ) ;
2016-04-13 00:36:24 +08:00
} else {
2017-06-16 06:42:49 +08:00
variable_ptr = zend_fetch_dimension_address_inner_W ( Z_ARRVAL_P ( object_ptr ) , dim EXECUTE_DATA_CC ) ;
2014-12-09 05:10:23 +08:00
}
2016-04-13 00:36:24 +08:00
if ( UNEXPECTED ( variable_ptr = = NULL ) ) {
ZEND_VM_C_GOTO ( assign_dim_error ) ;
2008-03-04 18:06:52 +08:00
}
2016-04-13 00:36:24 +08:00
}
value = GET_OP_DATA_ZVAL_PTR ( BP_VAR_R ) ;
value = zend_assign_to_variable ( variable_ptr , value , OP_DATA_TYPE ) ;
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
ZVAL_COPY ( EX_VAR ( opline - > result . var ) , value ) ;
2014-02-28 21:39:08 +08:00
}
2015-06-03 22:20:47 +08:00
} else {
if ( EXPECTED ( Z_ISREF_P ( object_ptr ) ) ) {
object_ptr = Z_REFVAL_P ( object_ptr ) ;
if ( EXPECTED ( Z_TYPE_P ( object_ptr ) = = IS_ARRAY ) ) {
ZEND_VM_C_GOTO ( try_assign_dim_array ) ;
}
}
if ( EXPECTED ( Z_TYPE_P ( object_ptr ) = = IS_OBJECT ) ) {
2016-04-13 00:36:24 +08:00
dim = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
2016-12-09 22:30:24 +08:00
value = GET_OP_DATA_ZVAL_PTR_DEREF ( BP_VAR_R ) ;
2016-04-13 00:36:24 +08:00
2018-02-21 04:44:25 +08:00
zend_assign_to_object_dim ( object_ptr , dim , value OPLINE_CC EXECUTE_DATA_CC ) ;
2014-12-09 05:10:23 +08:00
2016-06-08 16:24:53 +08:00
FREE_OP_DATA ( ) ;
2015-06-03 22:20:47 +08:00
} else if ( EXPECTED ( Z_TYPE_P ( object_ptr ) = = IS_STRING ) ) {
2016-02-14 23:49:36 +08:00
if ( OP2_TYPE = = IS_UNUSED ) {
2018-02-16 07:45:31 +08:00
zend_use_new_element_for_string ( ) ;
2016-02-14 23:49:36 +08:00
FREE_UNFETCHED_OP_DATA ( ) ;
FREE_OP1_VAR_PTR ( ) ;
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2016-02-14 23:49:36 +08:00
HANDLE_EXCEPTION ( ) ;
2015-04-01 19:50:09 +08:00
} else {
2016-02-14 23:49:36 +08:00
dim = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
value = GET_OP_DATA_ZVAL_PTR_DEREF ( BP_VAR_R ) ;
2018-02-21 04:44:25 +08:00
zend_assign_to_string_offset ( object_ptr , dim , value OPLINE_CC EXECUTE_DATA_CC ) ;
2016-02-14 23:49:36 +08:00
FREE_OP_DATA ( ) ;
2015-06-03 22:20:47 +08:00
}
} else if ( EXPECTED ( Z_TYPE_P ( object_ptr ) < = IS_FALSE ) ) {
2017-09-20 07:25:56 +08:00
ZVAL_ARR ( object_ptr , zend_new_array ( 8 ) ) ;
2016-02-14 23:49:36 +08:00
ZEND_VM_C_GOTO ( try_assign_dim_array ) ;
2015-02-26 07:49:19 +08:00
} else {
2016-06-09 17:39:38 +08:00
if ( OP1_TYPE ! = IS_VAR | | EXPECTED ( ! Z_ISERROR_P ( object_ptr ) ) ) {
2018-02-16 07:45:31 +08:00
zend_use_scalar_as_array ( ) ;
2016-04-13 00:36:24 +08:00
}
2016-04-14 07:35:53 +08:00
dim = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
2016-04-13 00:36:24 +08:00
ZEND_VM_C_LABEL ( assign_dim_error ) :
2016-02-02 10:03:21 +08:00
FREE_UNFETCHED_OP_DATA ( ) ;
2015-06-03 22:20:47 +08:00
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
ZVAL_NULL ( EX_VAR ( opline - > result . var ) ) ;
}
2015-02-26 07:49:19 +08:00
}
2004-10-23 05:42:14 +08:00
}
2016-04-13 07:47:17 +08:00
if ( OP2_TYPE ! = IS_UNUSED ) {
FREE_OP2 ( ) ;
}
2015-08-19 17:21:14 +08:00
FREE_OP1_VAR_PTR ( ) ;
2004-10-23 05:42:14 +08:00
/* assign_dim has two opcodes! */
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_EX ( 1 , 2 ) ;
2004-10-23 05:42:14 +08:00
}
2016-02-05 18:18:58 +08:00
ZEND_VM_HANDLER ( 38 , ZEND_ASSIGN , VAR | CV , CONST | TMP | VAR | CV , SPEC ( RETVAL ) )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2007-12-14 22:14:50 +08:00
zend_free_op free_op1 , free_op2 ;
2010-04-20 19:16:39 +08:00
zval * value ;
2014-02-10 14:04:30 +08:00
zval * variable_ptr ;
2007-12-14 22:14:50 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2015-04-03 06:32:20 +08:00
value = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
2014-04-04 19:22:41 +08:00
variable_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_W ) ;
2010-04-20 19:16:39 +08:00
2016-02-01 16:12:28 +08:00
if ( OP1_TYPE = = IS_VAR & & UNEXPECTED ( Z_ISERROR_P ( variable_ptr ) ) ) {
2015-04-03 06:32:20 +08:00
FREE_OP2 ( ) ;
2014-12-09 22:07:12 +08:00
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
2014-02-10 14:04:30 +08:00
ZVAL_NULL ( EX_VAR ( opline - > result . var ) ) ;
2008-03-04 18:06:52 +08:00
}
2007-12-14 22:14:50 +08:00
} else {
2015-04-03 06:32:20 +08:00
value = zend_assign_to_variable ( variable_ptr , value , OP2_TYPE ) ;
2014-12-09 22:07:12 +08:00
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
2014-02-10 14:04:30 +08:00
ZVAL_COPY ( EX_VAR ( opline - > result . var ) , value ) ;
2008-03-04 18:06:52 +08:00
}
2014-02-28 21:39:08 +08:00
FREE_OP1_VAR_PTR ( ) ;
2015-04-03 06:32:20 +08:00
/* zend_assign_to_variable() always takes care of op2, never free it! */
2007-12-14 22:14:50 +08:00
}
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2015-12-11 05:47:02 +08:00
ZEND_VM_HANDLER ( 39 , ZEND_ASSIGN_REF , VAR | CV , VAR | CV , SRC )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2014-02-10 14:04:30 +08:00
zval * variable_ptr ;
zval * value_ptr ;
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2014-03-04 16:27:50 +08:00
value_ptr = GET_OP2_ZVAL_PTR_PTR ( BP_VAR_W ) ;
2016-02-05 18:18:58 +08:00
variable_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_W ) ;
2004-10-23 05:42:14 +08:00
2015-07-16 04:36:42 +08:00
if ( OP1_TYPE = = IS_VAR & &
UNEXPECTED ( Z_TYPE_P ( EX_VAR ( opline - > op1 . var ) ) ! = IS_INDIRECT ) & &
2016-02-01 16:12:28 +08:00
UNEXPECTED ( ! Z_ISREF_P ( EX_VAR ( opline - > op1 . var ) ) ) & &
UNEXPECTED ( ! Z_ISERROR_P ( EX_VAR ( opline - > op1 . var ) ) ) ) {
2016-02-05 18:18:58 +08:00
2015-07-16 04:36:42 +08:00
zend_throw_error ( NULL , " Cannot assign by reference to overloaded object " ) ;
2016-07-14 06:08:29 +08:00
FREE_OP1_VAR_PTR ( ) ;
2015-07-16 04:36:42 +08:00
FREE_OP2_VAR_PTR ( ) ;
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2015-07-16 04:36:42 +08:00
HANDLE_EXCEPTION ( ) ;
2016-02-05 18:18:58 +08:00
} else if ( OP2_TYPE = = IS_VAR & &
opline - > extended_value = = ZEND_RETURNS_FUNCTION & &
2016-04-10 19:01:54 +08:00
UNEXPECTED ( ! Z_ISREF_P ( value_ptr ) ) ) {
2018-02-21 15:10:04 +08:00
if ( UNEXPECTED ( ! zend_wrong_assign_to_variable_reference ( variable_ptr , value_ptr , OP2_TYPE OPLINE_CC EXECUTE_DATA_CC ) ) ) {
2008-08-13 15:21:30 +08:00
FREE_OP2_VAR_PTR ( ) ;
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2010-04-20 19:16:39 +08:00
HANDLE_EXCEPTION ( ) ;
2008-08-13 15:21:30 +08:00
}
2014-04-04 19:22:41 +08:00
2014-04-03 20:53:30 +08:00
} else {
2004-10-23 05:42:14 +08:00
2016-02-05 18:18:58 +08:00
if ( ( OP1_TYPE = = IS_VAR & & UNEXPECTED ( Z_ISERROR_P ( variable_ptr ) ) ) | |
( OP2_TYPE = = IS_VAR & & UNEXPECTED ( Z_ISERROR_P ( value_ptr ) ) ) ) {
variable_ptr = & EG ( uninitialized_zval ) ;
} else {
zend_assign_to_variable_reference ( variable_ptr , value_ptr ) ;
}
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
ZVAL_COPY ( EX_VAR ( opline - > result . var ) , variable_ptr ) ;
}
FREE_OP2_VAR_PTR ( ) ;
2004-10-23 05:42:14 +08:00
}
2014-03-04 16:27:50 +08:00
FREE_OP1_VAR_PTR ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2012-08-22 18:32:03 +08:00
ZEND_VM_HELPER ( zend_leave_helper , ANY , ANY )
2004-10-23 05:42:14 +08:00
{
2015-03-03 21:51:27 +08:00
zend_execute_data * old_execute_data ;
2015-04-16 17:16:03 +08:00
uint32_t call_info = EX_CALL_INFO ( ) ;
2012-12-21 08:56:37 +08:00
2016-06-07 01:45:10 +08:00
if ( EXPECTED ( ( call_info & ( ZEND_CALL_CODE | ZEND_CALL_TOP | ZEND_CALL_HAS_SYMBOL_TABLE | ZEND_CALL_FREE_EXTRA_ARGS | ZEND_CALL_ALLOCATED ) ) = = 0 ) ) {
2014-12-14 06:06:14 +08:00
i_free_compiled_variables ( execute_data ) ;
2016-06-07 01:45:10 +08:00
EG ( current_execute_data ) = EX ( prev_execute_data ) ;
if ( UNEXPECTED ( call_info & ZEND_CALL_RELEASE_THIS ) ) {
zend_object * object = Z_OBJ ( execute_data - > This ) ;
2016-04-11 18:17:24 +08:00
#if 0
2016-06-07 01:45:10 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) & & ( EX ( opline ) - > op1 . num & ZEND_CALL_CTOR ) ) {
2016-04-11 18:17:24 +08:00
# else
2016-06-07 01:45:10 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) & & ( call_info & ZEND_CALL_CTOR ) ) {
2016-04-11 18:17:24 +08:00
# endif
2017-10-27 06:28:58 +08:00
GC_DELREF ( object ) ;
2016-07-13 21:43:47 +08:00
zend_object_store_ctor_failed ( object ) ;
2016-04-11 18:17:24 +08:00
}
2016-06-07 01:45:10 +08:00
OBJ_RELEASE ( object ) ;
} else if ( UNEXPECTED ( call_info & ZEND_CALL_CLOSURE ) ) {
2018-01-12 03:15:45 +08:00
OBJ_RELEASE ( ZEND_CLOSURE_OBJECT ( EX ( func ) ) ) ;
2016-06-07 01:45:10 +08:00
}
EG ( vm_stack_top ) = ( zval * ) execute_data ;
execute_data = EX ( prev_execute_data ) ;
2016-04-11 18:17:24 +08:00
2016-06-07 01:45:10 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2016-12-12 15:55:32 +08:00
zend_rethrow_exception ( execute_data ) ;
2016-06-07 01:45:10 +08:00
HANDLE_EXCEPTION_LEAVE ( ) ;
}
LOAD_NEXT_OPLINE ( ) ;
ZEND_VM_LEAVE ( ) ;
} else if ( EXPECTED ( ( call_info & ( ZEND_CALL_CODE | ZEND_CALL_TOP ) ) = = 0 ) ) {
i_free_compiled_variables ( execute_data ) ;
if ( UNEXPECTED ( call_info & ZEND_CALL_HAS_SYMBOL_TABLE ) ) {
zend_clean_and_cache_symbol_table ( EX ( symbol_table ) ) ;
}
EG ( current_execute_data ) = EX ( prev_execute_data ) ;
if ( UNEXPECTED ( call_info & ZEND_CALL_RELEASE_THIS ) ) {
zend_object * object = Z_OBJ ( execute_data - > This ) ;
2015-05-07 21:28:23 +08:00
#if 0
2016-06-07 01:45:10 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) & & ( EX ( opline ) - > op1 . num & ZEND_CALL_CTOR ) ) {
2015-05-07 21:28:23 +08:00
# else
2016-06-07 01:45:10 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) & & ( call_info & ZEND_CALL_CTOR ) ) {
2015-05-07 21:28:23 +08:00
# endif
2017-10-27 06:28:58 +08:00
GC_DELREF ( object ) ;
2016-07-13 21:43:47 +08:00
zend_object_store_ctor_failed ( object ) ;
2012-08-22 18:32:03 +08:00
}
2016-06-07 01:45:10 +08:00
OBJ_RELEASE ( object ) ;
} else if ( UNEXPECTED ( call_info & ZEND_CALL_CLOSURE ) ) {
2018-01-12 03:15:45 +08:00
OBJ_RELEASE ( ZEND_CLOSURE_OBJECT ( EX ( func ) ) ) ;
2014-04-18 17:46:36 +08:00
}
2004-10-23 05:42:14 +08:00
2016-06-07 01:45:10 +08:00
zend_vm_stack_free_extra_args_ex ( call_info , execute_data ) ;
old_execute_data = execute_data ;
execute_data = EX ( prev_execute_data ) ;
zend_vm_stack_free_call_frame_ex ( call_info , old_execute_data ) ;
2014-04-18 17:46:36 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2016-12-12 15:55:32 +08:00
zend_rethrow_exception ( execute_data ) ;
2014-04-18 17:46:36 +08:00
HANDLE_EXCEPTION_LEAVE ( ) ;
}
2004-10-23 05:42:14 +08:00
2015-07-08 23:33:58 +08:00
LOAD_NEXT_OPLINE ( ) ;
2014-04-18 17:46:36 +08:00
ZEND_VM_LEAVE ( ) ;
2016-05-17 07:09:29 +08:00
} else if ( EXPECTED ( ( call_info & ZEND_CALL_TOP ) = = 0 ) ) {
2014-04-18 17:46:36 +08:00
zend_detach_symbol_table ( execute_data ) ;
2015-08-04 06:00:10 +08:00
destroy_op_array ( & EX ( func ) - > op_array ) ;
efree_size ( EX ( func ) , sizeof ( zend_op_array ) ) ;
2015-03-03 21:51:27 +08:00
old_execute_data = execute_data ;
execute_data = EG ( current_execute_data ) = EX ( prev_execute_data ) ;
2015-05-12 20:56:42 +08:00
zend_vm_stack_free_call_frame_ex ( call_info , old_execute_data ) ;
2004-10-23 05:42:14 +08:00
2014-04-18 17:46:36 +08:00
zend_attach_symbol_table ( execute_data ) ;
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2016-12-12 15:55:32 +08:00
zend_rethrow_exception ( execute_data ) ;
2014-04-18 17:46:36 +08:00
HANDLE_EXCEPTION_LEAVE ( ) ;
}
2010-04-20 19:16:39 +08:00
2015-07-08 23:33:58 +08:00
LOAD_NEXT_OPLINE ( ) ;
2014-04-18 17:46:36 +08:00
ZEND_VM_LEAVE ( ) ;
} else {
2016-05-17 07:09:29 +08:00
if ( EXPECTED ( ( call_info & ZEND_CALL_CODE ) = = 0 ) ) {
2014-12-14 06:06:14 +08:00
i_free_compiled_variables ( execute_data ) ;
2016-04-28 20:17:24 +08:00
if ( UNEXPECTED ( call_info & ( ZEND_CALL_HAS_SYMBOL_TABLE | ZEND_CALL_FREE_EXTRA_ARGS ) ) ) {
if ( UNEXPECTED ( call_info & ZEND_CALL_HAS_SYMBOL_TABLE ) ) {
2016-04-11 18:17:24 +08:00
zend_clean_and_cache_symbol_table ( EX ( symbol_table ) ) ;
}
zend_vm_stack_free_extra_args_ex ( call_info , execute_data ) ;
2014-07-04 22:03:45 +08:00
}
2014-07-10 22:36:11 +08:00
EG ( current_execute_data ) = EX ( prev_execute_data ) ;
2015-10-07 04:48:10 +08:00
if ( UNEXPECTED ( call_info & ZEND_CALL_CLOSURE ) ) {
2018-01-12 03:15:45 +08:00
OBJ_RELEASE ( ZEND_CLOSURE_OBJECT ( EX ( func ) ) ) ;
2015-10-07 04:48:10 +08:00
}
2016-04-11 18:17:24 +08:00
ZEND_VM_RETURN ( ) ;
2014-11-28 15:33:03 +08:00
} else /* if (call_kind == ZEND_CALL_TOP_CODE) */ {
2014-04-18 17:46:36 +08:00
zend_array * symbol_table = EX ( symbol_table ) ;
zend_detach_symbol_table ( execute_data ) ;
old_execute_data = EX ( prev_execute_data ) ;
while ( old_execute_data ) {
2016-04-28 20:17:24 +08:00
if ( old_execute_data - > func & & ( ZEND_CALL_INFO ( old_execute_data ) & ZEND_CALL_HAS_SYMBOL_TABLE ) ) {
2014-04-18 17:46:36 +08:00
if ( old_execute_data - > symbol_table = = symbol_table ) {
zend_attach_symbol_table ( old_execute_data ) ;
}
break ;
2012-08-22 18:32:03 +08:00
}
2014-04-18 17:46:36 +08:00
old_execute_data = old_execute_data - > prev_execute_data ;
2012-08-22 18:32:03 +08:00
}
2014-07-10 22:36:11 +08:00
EG ( current_execute_data ) = EX ( prev_execute_data ) ;
2016-04-11 18:17:24 +08:00
ZEND_VM_RETURN ( ) ;
2009-03-18 22:17:15 +08:00
}
2015-01-03 17:22:58 +08:00
}
2004-10-23 05:42:14 +08:00
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_HANDLER ( 42 , ZEND_JMP , JMP_ADDR , ANY )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
2014-12-12 15:19:41 +08:00
ZEND_VM_SET_OPCODE ( OP_JMP_ADDR ( opline , opline - > op1 ) ) ;
2012-11-22 19:17:05 +08:00
ZEND_VM_CONTINUE ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-03-23 21:11:27 +08:00
ZEND_VM_HOT_NOCONST_HANDLER ( 43 , ZEND_JMPZ , CONST | TMPVAR | CV , JMP_ADDR )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2012-08-22 18:32:03 +08:00
zend_free_op free_op1 ;
zval * val ;
2010-05-24 22:11:39 +08:00
2015-04-14 18:09:31 +08:00
val = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2018-01-04 12:41:57 +08:00
2015-04-14 18:09:31 +08:00
if ( Z_TYPE_INFO_P ( val ) = = IS_TRUE ) {
2015-03-17 00:48:29 +08:00
ZEND_VM_SET_NEXT_OPCODE ( opline + 1 ) ;
2014-12-05 22:04:15 +08:00
ZEND_VM_CONTINUE ( ) ;
2015-04-14 18:09:31 +08:00
} else if ( EXPECTED ( Z_TYPE_INFO_P ( val ) < = IS_TRUE ) ) {
2015-07-08 23:33:58 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( val ) = = IS_UNDEF ) ) {
SAVE_OPLINE ( ) ;
GET_OP1_UNDEF_CV ( val , BP_VAR_R ) ;
2014-12-12 15:19:41 +08:00
ZEND_VM_JMP ( OP_JMP_ADDR ( opline , opline - > op2 ) ) ;
2015-01-03 17:22:58 +08:00
} else {
2016-12-02 16:58:41 +08:00
ZEND_VM_SET_OPCODE ( OP_JMP_ADDR ( opline , opline - > op2 ) ) ;
ZEND_VM_CONTINUE ( ) ;
2004-10-23 05:42:14 +08:00
}
}
2015-04-14 18:09:31 +08:00
SAVE_OPLINE ( ) ;
2014-12-14 06:06:14 +08:00
if ( i_zend_is_true ( val ) ) {
2014-05-01 05:24:38 +08:00
opline + + ;
} else {
2014-12-12 15:19:41 +08:00
opline = OP_JMP_ADDR ( opline , opline - > op2 ) ;
2014-05-01 05:24:38 +08:00
}
FREE_OP1 ( ) ;
ZEND_VM_JMP ( opline ) ;
2004-10-23 05:42:14 +08:00
}
2018-03-23 21:11:27 +08:00
ZEND_VM_HOT_NOCONST_HANDLER ( 44 , ZEND_JMPNZ , CONST | TMPVAR | CV , JMP_ADDR )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2012-08-22 18:32:03 +08:00
zend_free_op free_op1 ;
zval * val ;
2004-10-23 05:42:14 +08:00
2015-04-14 18:09:31 +08:00
val = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2004-10-23 05:42:14 +08:00
2015-04-14 18:09:31 +08:00
if ( Z_TYPE_INFO_P ( val ) = = IS_TRUE ) {
2016-12-02 16:58:41 +08:00
ZEND_VM_SET_OPCODE ( OP_JMP_ADDR ( opline , opline - > op2 ) ) ;
ZEND_VM_CONTINUE ( ) ;
2015-04-14 18:09:31 +08:00
} else if ( EXPECTED ( Z_TYPE_INFO_P ( val ) < = IS_TRUE ) ) {
2015-07-08 23:33:58 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( val ) = = IS_UNDEF ) ) {
SAVE_OPLINE ( ) ;
GET_OP1_UNDEF_CV ( val , BP_VAR_R ) ;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2015-01-03 17:22:58 +08:00
} else {
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
2008-07-24 17:42:18 +08:00
}
2007-09-29 03:52:53 +08:00
}
2010-05-24 22:11:39 +08:00
2015-04-14 18:09:31 +08:00
SAVE_OPLINE ( ) ;
2014-12-14 06:06:14 +08:00
if ( i_zend_is_true ( val ) ) {
2014-12-12 15:19:41 +08:00
opline = OP_JMP_ADDR ( opline , opline - > op2 ) ;
2014-05-01 05:24:38 +08:00
} else {
opline + + ;
}
FREE_OP1 ( ) ;
ZEND_VM_JMP ( opline ) ;
2012-08-22 18:32:03 +08:00
}
2004-10-23 05:42:14 +08:00
2018-03-23 21:11:27 +08:00
ZEND_VM_HOT_NOCONST_HANDLER ( 45 , ZEND_JMPZNZ , CONST | TMPVAR | CV , JMP_ADDR , JMP_ADDR )
2012-08-22 18:32:03 +08:00
{
USE_OPLINE
zend_free_op free_op1 ;
zval * val ;
2004-10-23 05:42:14 +08:00
2015-04-14 18:09:31 +08:00
val = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2004-10-23 05:42:14 +08:00
2015-04-14 18:09:31 +08:00
if ( EXPECTED ( Z_TYPE_INFO_P ( val ) = = IS_TRUE ) ) {
2014-12-05 22:04:15 +08:00
ZEND_VM_SET_RELATIVE_OPCODE ( opline , opline - > extended_value ) ;
ZEND_VM_CONTINUE ( ) ;
2015-04-14 18:09:31 +08:00
} else if ( EXPECTED ( Z_TYPE_INFO_P ( val ) < = IS_TRUE ) ) {
2016-12-06 15:01:18 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( val ) = = IS_UNDEF ) ) {
SAVE_OPLINE ( ) ;
GET_OP1_UNDEF_CV ( val , BP_VAR_R ) ;
2014-12-12 15:19:41 +08:00
ZEND_VM_JMP ( OP_JMP_ADDR ( opline , opline - > op2 ) ) ;
2015-01-03 17:22:58 +08:00
} else {
2016-12-02 16:58:41 +08:00
ZEND_VM_SET_OPCODE ( OP_JMP_ADDR ( opline , opline - > op2 ) ) ;
ZEND_VM_CONTINUE ( ) ;
2006-08-08 07:24:33 +08:00
}
2004-10-23 05:42:14 +08:00
}
2014-05-01 05:24:38 +08:00
2015-04-14 18:09:31 +08:00
SAVE_OPLINE ( ) ;
2014-12-14 06:06:14 +08:00
if ( i_zend_is_true ( val ) ) {
2014-12-12 15:19:41 +08:00
opline = ZEND_OFFSET_TO_OPLINE ( opline , opline - > extended_value ) ;
2012-08-22 18:32:03 +08:00
} else {
2014-12-12 15:19:41 +08:00
opline = OP_JMP_ADDR ( opline , opline - > op2 ) ;
2014-05-01 05:24:38 +08:00
}
FREE_OP1 ( ) ;
ZEND_VM_JMP ( opline ) ;
2012-08-22 18:32:03 +08:00
}
2004-10-23 05:42:14 +08:00
2015-10-30 03:50:45 +08:00
ZEND_VM_HANDLER ( 46 , ZEND_JMPZ_EX , CONST | TMPVAR | CV , JMP_ADDR )
2012-08-22 18:32:03 +08:00
{
USE_OPLINE
zend_free_op free_op1 ;
zval * val ;
2015-01-24 01:35:32 +08:00
int ret ;
2012-08-22 18:32:03 +08:00
2015-04-14 18:09:31 +08:00
val = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2012-08-22 18:32:03 +08:00
2015-04-14 18:09:31 +08:00
if ( Z_TYPE_INFO_P ( val ) = = IS_TRUE ) {
2014-12-05 22:04:15 +08:00
ZVAL_TRUE ( EX_VAR ( opline - > result . var ) ) ;
2016-12-06 15:01:18 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
2015-04-14 18:09:31 +08:00
} else if ( EXPECTED ( Z_TYPE_INFO_P ( val ) < = IS_TRUE ) ) {
2014-12-05 22:04:15 +08:00
ZVAL_FALSE ( EX_VAR ( opline - > result . var ) ) ;
2016-12-06 15:01:18 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( val ) = = IS_UNDEF ) ) {
SAVE_OPLINE ( ) ;
GET_OP1_UNDEF_CV ( val , BP_VAR_R ) ;
2014-12-12 15:19:41 +08:00
ZEND_VM_JMP ( OP_JMP_ADDR ( opline , opline - > op2 ) ) ;
2015-01-03 17:22:58 +08:00
} else {
2016-12-02 16:58:41 +08:00
ZEND_VM_SET_OPCODE ( OP_JMP_ADDR ( opline , opline - > op2 ) ) ;
ZEND_VM_CONTINUE ( ) ;
2004-10-23 05:42:14 +08:00
}
}
2014-05-01 05:24:38 +08:00
2015-04-14 18:09:31 +08:00
SAVE_OPLINE ( ) ;
2015-01-24 01:35:32 +08:00
ret = i_zend_is_true ( val ) ;
FREE_OP1 ( ) ;
if ( ret ) {
2014-05-01 05:24:38 +08:00
ZVAL_TRUE ( EX_VAR ( opline - > result . var ) ) ;
opline + + ;
} else {
ZVAL_FALSE ( EX_VAR ( opline - > result . var ) ) ;
2014-12-12 15:19:41 +08:00
opline = OP_JMP_ADDR ( opline , opline - > op2 ) ;
2012-08-22 18:32:03 +08:00
}
2014-05-01 05:24:38 +08:00
ZEND_VM_JMP ( opline ) ;
2004-10-23 05:42:14 +08:00
}
2015-10-30 03:50:45 +08:00
ZEND_VM_HANDLER ( 47 , ZEND_JMPNZ_EX , CONST | TMPVAR | CV , JMP_ADDR )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2012-08-22 18:32:03 +08:00
zend_free_op free_op1 ;
zval * val ;
2015-01-24 01:35:32 +08:00
int ret ;
2010-04-20 19:16:39 +08:00
2015-04-14 18:09:31 +08:00
val = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2004-10-23 05:42:14 +08:00
2015-04-14 18:09:31 +08:00
if ( Z_TYPE_INFO_P ( val ) = = IS_TRUE ) {
2014-12-05 22:04:15 +08:00
ZVAL_TRUE ( EX_VAR ( opline - > result . var ) ) ;
2016-12-02 16:58:41 +08:00
ZEND_VM_SET_OPCODE ( OP_JMP_ADDR ( opline , opline - > op2 ) ) ;
ZEND_VM_CONTINUE ( ) ;
2015-04-14 18:09:31 +08:00
} else if ( EXPECTED ( Z_TYPE_INFO_P ( val ) < = IS_TRUE ) ) {
2014-12-05 22:04:15 +08:00
ZVAL_FALSE ( EX_VAR ( opline - > result . var ) ) ;
2015-07-08 23:33:58 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( val ) = = IS_UNDEF ) ) {
SAVE_OPLINE ( ) ;
GET_OP1_UNDEF_CV ( val , BP_VAR_R ) ;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2015-01-03 17:22:58 +08:00
} else {
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
2014-05-01 05:24:38 +08:00
}
}
2015-04-14 18:09:31 +08:00
SAVE_OPLINE ( ) ;
2015-01-24 01:35:32 +08:00
ret = i_zend_is_true ( val ) ;
FREE_OP1 ( ) ;
if ( ret ) {
2014-05-01 05:24:38 +08:00
ZVAL_TRUE ( EX_VAR ( opline - > result . var ) ) ;
2014-12-12 15:19:41 +08:00
opline = OP_JMP_ADDR ( opline , opline - > op2 ) ;
2012-08-22 18:32:03 +08:00
} else {
2014-05-01 05:24:38 +08:00
ZVAL_FALSE ( EX_VAR ( opline - > result . var ) ) ;
opline + + ;
2012-08-22 18:32:03 +08:00
}
2014-05-01 05:24:38 +08:00
ZEND_VM_JMP ( opline ) ;
2012-08-22 18:32:03 +08:00
}
2011-06-07 05:42:05 +08:00
2018-02-17 04:25:49 +08:00
ZEND_VM_HANDLER ( 70 , ZEND_FREE , TMPVAR , ANY )
2012-08-22 18:32:03 +08:00
{
USE_OPLINE
2012-01-26 09:28:37 +08:00
2012-08-22 18:32:03 +08:00
SAVE_OPLINE ( ) ;
2015-08-11 04:55:37 +08:00
zval_ptr_dtor_nogc ( EX_VAR ( opline - > op1 . var ) ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2012-08-22 18:32:03 +08:00
}
2012-01-26 09:28:37 +08:00
2018-02-17 04:25:49 +08:00
ZEND_VM_HANDLER ( 127 , ZEND_FE_FREE , TMPVAR , ANY )
2015-02-12 18:57:12 +08:00
{
zval * var ;
USE_OPLINE
SAVE_OPLINE ( ) ;
var = EX_VAR ( opline - > op1 . var ) ;
if ( Z_TYPE_P ( var ) ! = IS_ARRAY & & Z_FE_ITER_P ( var ) ! = ( uint32_t ) - 1 ) {
zend_hash_iterator_del ( Z_FE_ITER_P ( var ) ) ;
}
zval_ptr_dtor_nogc ( var ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2015-02-12 18:57:12 +08:00
}
2015-03-25 03:47:21 +08:00
ZEND_VM_HANDLER ( 53 , ZEND_FAST_CONCAT , CONST | TMPVAR | CV , CONST | TMPVAR | CV )
2012-08-22 18:32:03 +08:00
{
USE_OPLINE
2015-03-25 03:47:21 +08:00
zend_free_op free_op1 , free_op2 ;
zval * op1 , * op2 ;
zend_string * op1_str , * op2_str , * str ;
2011-06-07 05:42:05 +08:00
2017-07-19 20:42:32 +08:00
2015-06-05 06:53:32 +08:00
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2017-07-19 20:42:32 +08:00
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
if ( ( OP1_TYPE = = IS_CONST | | EXPECTED ( Z_TYPE_P ( op1 ) = = IS_STRING ) ) & &
( OP2_TYPE = = IS_CONST | | EXPECTED ( Z_TYPE_P ( op2 ) = = IS_STRING ) ) ) {
zend_string * op1_str = Z_STR_P ( op1 ) ;
zend_string * op2_str = Z_STR_P ( op2 ) ;
zend_string * str ;
2017-11-28 19:11:40 +08:00
if ( OP1_TYPE ! = IS_CONST & & UNEXPECTED ( ZSTR_LEN ( op1_str ) = = 0 ) ) {
if ( OP2_TYPE = = IS_CONST | | OP2_TYPE = = IS_CV ) {
ZVAL_STR_COPY ( EX_VAR ( opline - > result . var ) , op2_str ) ;
} else {
ZVAL_STR ( EX_VAR ( opline - > result . var ) , op2_str ) ;
2017-07-19 20:42:32 +08:00
}
2017-11-28 19:11:40 +08:00
FREE_OP1 ( ) ;
} else if ( OP2_TYPE ! = IS_CONST & & UNEXPECTED ( ZSTR_LEN ( op2_str ) = = 0 ) ) {
if ( OP1_TYPE = = IS_CONST | | OP1_TYPE = = IS_CV ) {
ZVAL_STR_COPY ( EX_VAR ( opline - > result . var ) , op1_str ) ;
2017-07-19 20:42:32 +08:00
} else {
2017-11-28 19:11:40 +08:00
ZVAL_STR ( EX_VAR ( opline - > result . var ) , op1_str ) ;
2017-07-19 20:42:32 +08:00
}
2017-11-28 19:11:40 +08:00
FREE_OP2 ( ) ;
} else if ( OP1_TYPE ! = IS_CONST & & OP1_TYPE ! = IS_CV & &
! ZSTR_IS_INTERNED ( op1_str ) & & GC_REFCOUNT ( op1_str ) = = 1 ) {
size_t len = ZSTR_LEN ( op1_str ) ;
str = zend_string_extend ( op1_str , len + ZSTR_LEN ( op2_str ) , 0 ) ;
memcpy ( ZSTR_VAL ( str ) + len , ZSTR_VAL ( op2_str ) , ZSTR_LEN ( op2_str ) + 1 ) ;
ZVAL_NEW_STR ( EX_VAR ( opline - > result . var ) , str ) ;
FREE_OP2 ( ) ;
} else {
str = zend_string_alloc ( ZSTR_LEN ( op1_str ) + ZSTR_LEN ( op2_str ) , 0 ) ;
memcpy ( ZSTR_VAL ( str ) , ZSTR_VAL ( op1_str ) , ZSTR_LEN ( op1_str ) ) ;
memcpy ( ZSTR_VAL ( str ) + ZSTR_LEN ( op1_str ) , ZSTR_VAL ( op2_str ) , ZSTR_LEN ( op2_str ) + 1 ) ;
ZVAL_NEW_STR ( EX_VAR ( opline - > result . var ) , str ) ;
2017-07-19 20:42:32 +08:00
FREE_OP1 ( ) ;
2017-11-28 19:11:40 +08:00
FREE_OP2 ( ) ;
}
2017-07-19 20:42:32 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
}
SAVE_OPLINE ( ) ;
2015-03-25 03:47:21 +08:00
if ( OP1_TYPE = = IS_CONST ) {
op1_str = Z_STR_P ( op1 ) ;
2015-06-05 06:53:32 +08:00
} else if ( EXPECTED ( Z_TYPE_P ( op1 ) = = IS_STRING ) ) {
op1_str = zend_string_copy ( Z_STR_P ( op1 ) ) ;
2015-03-25 03:47:21 +08:00
} else {
2015-06-05 06:53:32 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( op1 ) = = IS_UNDEF ) ) {
GET_OP1_UNDEF_CV ( op1 , BP_VAR_R ) ;
}
2017-11-16 22:09:01 +08:00
op1_str = zval_get_string_func ( op1 ) ;
2005-06-16 22:20:00 +08:00
}
2015-03-25 03:47:21 +08:00
if ( OP2_TYPE = = IS_CONST ) {
op2_str = Z_STR_P ( op2 ) ;
2015-06-05 06:53:32 +08:00
} else if ( EXPECTED ( Z_TYPE_P ( op2 ) = = IS_STRING ) ) {
op2_str = zend_string_copy ( Z_STR_P ( op2 ) ) ;
2015-03-25 03:47:21 +08:00
} else {
2015-06-05 06:53:32 +08:00
if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( op2 ) = = IS_UNDEF ) ) {
GET_OP2_UNDEF_CV ( op2 , BP_VAR_R ) ;
}
2017-11-16 22:09:01 +08:00
op2_str = zval_get_string_func ( op2 ) ;
2015-03-25 03:47:21 +08:00
}
2015-06-03 16:15:28 +08:00
do {
if ( OP1_TYPE ! = IS_CONST ) {
2015-06-30 18:59:27 +08:00
if ( UNEXPECTED ( ZSTR_LEN ( op1_str ) = = 0 ) ) {
2015-06-03 16:15:28 +08:00
if ( OP2_TYPE = = IS_CONST ) {
2017-11-17 18:23:22 +08:00
if ( UNEXPECTED ( Z_REFCOUNTED_P ( op2 ) ) ) {
GC_ADDREF ( op2_str ) ;
}
2015-06-03 16:15:28 +08:00
}
ZVAL_STR ( EX_VAR ( opline - > result . var ) , op2_str ) ;
zend_string_release ( op1_str ) ;
break ;
}
}
if ( OP2_TYPE ! = IS_CONST ) {
2015-06-30 18:59:27 +08:00
if ( UNEXPECTED ( ZSTR_LEN ( op2_str ) = = 0 ) ) {
2015-06-03 16:15:28 +08:00
if ( OP1_TYPE = = IS_CONST ) {
2017-11-17 18:23:22 +08:00
if ( UNEXPECTED ( Z_REFCOUNTED_P ( op1 ) ) ) {
GC_ADDREF ( op1_str ) ;
}
2015-06-03 16:15:28 +08:00
}
ZVAL_STR ( EX_VAR ( opline - > result . var ) , op1_str ) ;
zend_string_release ( op2_str ) ;
break ;
}
}
2015-06-30 18:59:27 +08:00
str = zend_string_alloc ( ZSTR_LEN ( op1_str ) + ZSTR_LEN ( op2_str ) , 0 ) ;
memcpy ( ZSTR_VAL ( str ) , ZSTR_VAL ( op1_str ) , ZSTR_LEN ( op1_str ) ) ;
memcpy ( ZSTR_VAL ( str ) + ZSTR_LEN ( op1_str ) , ZSTR_VAL ( op2_str ) , ZSTR_LEN ( op2_str ) + 1 ) ;
2015-06-03 16:15:28 +08:00
ZVAL_NEW_STR ( EX_VAR ( opline - > result . var ) , str ) ;
if ( OP1_TYPE ! = IS_CONST ) {
zend_string_release ( op1_str ) ;
}
if ( OP2_TYPE ! = IS_CONST ) {
zend_string_release ( op2_str ) ;
}
} while ( 0 ) ;
2015-03-25 03:47:21 +08:00
FREE_OP1 ( ) ;
FREE_OP2 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2012-08-22 18:32:03 +08:00
}
2015-10-29 04:25:05 +08:00
ZEND_VM_HANDLER ( 54 , ZEND_ROPE_INIT , UNUSED , CONST | TMPVAR | CV , NUM )
2007-11-22 17:02:55 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2015-03-25 03:47:21 +08:00
zend_free_op free_op2 ;
zend_string * * rope ;
zval * var ;
2010-04-27 20:23:29 +08:00
2015-03-25 03:47:21 +08:00
/* Compiler allocates the necessary number of zval slots to keep the rope */
rope = ( zend_string * * ) EX_VAR ( opline - > result . var ) ;
if ( OP2_TYPE = = IS_CONST ) {
var = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
2017-11-17 18:23:22 +08:00
rope [ 0 ] = Z_STR_P ( var ) ;
if ( UNEXPECTED ( Z_REFCOUNTED_P ( var ) ) ) {
2017-11-19 03:47:31 +08:00
Z_ADDREF_P ( var ) ;
2017-11-17 18:23:22 +08:00
}
2015-03-25 03:47:21 +08:00
} else {
2015-06-05 06:53:32 +08:00
var = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
if ( EXPECTED ( Z_TYPE_P ( var ) = = IS_STRING ) ) {
if ( OP2_TYPE = = IS_CV ) {
rope [ 0 ] = zend_string_copy ( Z_STR_P ( var ) ) ;
} else {
rope [ 0 ] = Z_STR_P ( var ) ;
}
} else {
SAVE_OPLINE ( ) ;
if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( var ) = = IS_UNDEF ) ) {
GET_OP2_UNDEF_CV ( var , BP_VAR_R ) ;
}
2017-11-16 22:09:01 +08:00
rope [ 0 ] = zval_get_string_func ( var ) ;
2015-06-05 06:53:32 +08:00
FREE_OP2 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2015-06-05 06:53:32 +08:00
}
2007-11-22 17:02:55 +08:00
}
2004-10-23 05:42:14 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
}
2015-10-29 04:25:05 +08:00
ZEND_VM_HANDLER ( 55 , ZEND_ROPE_ADD , TMP , CONST | TMPVAR | CV , NUM )
2008-06-11 21:18:41 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2008-07-26 23:30:28 +08:00
zend_free_op free_op2 ;
2015-03-25 03:47:21 +08:00
zend_string * * rope ;
2010-04-20 19:16:39 +08:00
zval * var ;
2012-08-13 23:17:18 +08:00
2015-03-25 03:47:21 +08:00
/* op1 and result are the same */
rope = ( zend_string * * ) EX_VAR ( opline - > op1 . var ) ;
if ( OP2_TYPE = = IS_CONST ) {
var = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
2017-11-17 18:23:22 +08:00
rope [ opline - > extended_value ] = Z_STR_P ( var ) ;
if ( UNEXPECTED ( Z_REFCOUNTED_P ( var ) ) ) {
Z_ADDREF_P ( var ) ;
}
2015-03-25 03:47:21 +08:00
} else {
2015-06-05 06:53:32 +08:00
var = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
if ( EXPECTED ( Z_TYPE_P ( var ) = = IS_STRING ) ) {
if ( OP2_TYPE = = IS_CV ) {
rope [ opline - > extended_value ] = zend_string_copy ( Z_STR_P ( var ) ) ;
} else {
rope [ opline - > extended_value ] = Z_STR_P ( var ) ;
}
} else {
SAVE_OPLINE ( ) ;
if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( var ) = = IS_UNDEF ) ) {
GET_OP2_UNDEF_CV ( var , BP_VAR_R ) ;
}
2017-11-16 22:09:01 +08:00
rope [ opline - > extended_value ] = zval_get_string_func ( var ) ;
2015-06-05 06:53:32 +08:00
FREE_OP2 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2015-06-05 06:53:32 +08:00
}
2012-08-13 23:17:18 +08:00
}
2015-03-25 03:47:21 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
}
2012-08-13 23:17:18 +08:00
2015-10-29 04:25:05 +08:00
ZEND_VM_HANDLER ( 56 , ZEND_ROPE_END , TMP , CONST | TMPVAR | CV , NUM )
2015-03-25 03:47:21 +08:00
{
USE_OPLINE
zend_free_op free_op2 ;
zend_string * * rope ;
zval * var , * ret ;
uint32_t i ;
size_t len = 0 ;
char * target ;
rope = ( zend_string * * ) EX_VAR ( opline - > op1 . var ) ;
if ( OP2_TYPE = = IS_CONST ) {
var = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
2017-11-17 18:23:22 +08:00
rope [ opline - > extended_value ] = Z_STR_P ( var ) ;
if ( UNEXPECTED ( Z_REFCOUNTED_P ( var ) ) ) {
Z_ADDREF_P ( var ) ;
}
2015-03-25 03:47:21 +08:00
} else {
2015-06-05 06:53:32 +08:00
var = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
if ( EXPECTED ( Z_TYPE_P ( var ) = = IS_STRING ) ) {
if ( OP2_TYPE = = IS_CV ) {
rope [ opline - > extended_value ] = zend_string_copy ( Z_STR_P ( var ) ) ;
} else {
rope [ opline - > extended_value ] = Z_STR_P ( var ) ;
}
} else {
SAVE_OPLINE ( ) ;
if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( var ) = = IS_UNDEF ) ) {
GET_OP2_UNDEF_CV ( var , BP_VAR_R ) ;
}
2017-11-16 22:09:01 +08:00
rope [ opline - > extended_value ] = zval_get_string_func ( var ) ;
2015-06-05 06:53:32 +08:00
FREE_OP2 ( ) ;
2015-07-07 02:12:07 +08:00
if ( UNEXPECTED ( EG ( exception ) ) ) {
for ( i = 0 ; i < = opline - > extended_value ; i + + ) {
zend_string_release ( rope [ i ] ) ;
}
2016-12-07 05:41:07 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2015-07-07 02:12:07 +08:00
HANDLE_EXCEPTION ( ) ;
}
2015-06-05 06:53:32 +08:00
}
2008-06-11 21:18:41 +08:00
}
2015-03-25 03:47:21 +08:00
for ( i = 0 ; i < = opline - > extended_value ; i + + ) {
2015-06-30 09:05:24 +08:00
len + = ZSTR_LEN ( rope [ i ] ) ;
2011-04-20 20:59:18 +08:00
}
2015-03-25 03:47:21 +08:00
ret = EX_VAR ( opline - > result . var ) ;
ZVAL_STR ( ret , zend_string_alloc ( len , 0 ) ) ;
target = Z_STRVAL_P ( ret ) ;
for ( i = 0 ; i < = opline - > extended_value ; i + + ) {
2015-06-30 09:05:24 +08:00
memcpy ( target , ZSTR_VAL ( rope [ i ] ) , ZSTR_LEN ( rope [ i ] ) ) ;
target + = ZSTR_LEN ( rope [ i ] ) ;
2015-03-25 03:47:21 +08:00
zend_string_release ( rope [ i ] ) ;
}
* target = ' \0 ' ;
2011-04-20 20:59:18 +08:00
2004-10-23 05:42:14 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
}
2011-03-16 13:25:02 +08:00
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 109 , ZEND_FETCH_CLASS , UNUSED | CLASS_FETCH , CONST | TMPVAR | UNUSED | CV , CACHE_SLOT )
2004-10-23 05:42:14 +08:00
{
2018-02-06 00:41:47 +08:00
zend_free_op free_op2 ;
zval * class_name ;
2010-04-20 19:16:39 +08:00
USE_OPLINE
2008-06-11 21:18:41 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2004-10-23 05:42:14 +08:00
if ( OP2_TYPE = = IS_UNUSED ) {
2018-01-31 23:14:43 +08:00
Z_CE_P ( EX_VAR ( opline - > result . var ) ) = zend_fetch_class ( NULL , opline - > op1 . num ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2018-02-06 00:41:47 +08:00
} else if ( OP2_TYPE = = IS_CONST ) {
zend_class_entry * ce = CACHED_PTR ( opline - > extended_value ) ;
2008-06-11 21:18:41 +08:00
2018-02-06 00:41:47 +08:00
if ( UNEXPECTED ( ce = = NULL ) ) {
class_name = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
ce = zend_fetch_class_by_name ( Z_STR_P ( class_name ) , class_name + 1 , opline - > op1 . num ) ;
CACHE_PTR ( opline - > extended_value , ce ) ;
}
Z_CE_P ( EX_VAR ( opline - > result . var ) ) = ce ;
} else {
class_name = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2014-12-05 23:23:39 +08:00
ZEND_VM_C_LABEL ( try_class_name ) :
2018-02-06 00:41:47 +08:00
if ( Z_TYPE_P ( class_name ) = = IS_OBJECT ) {
2014-02-10 14:04:30 +08:00
Z_CE_P ( EX_VAR ( opline - > result . var ) ) = Z_OBJCE_P ( class_name ) ;
2009-04-08 21:19:34 +08:00
} else if ( Z_TYPE_P ( class_name ) = = IS_STRING ) {
2018-01-31 23:14:43 +08:00
Z_CE_P ( EX_VAR ( opline - > result . var ) ) = zend_fetch_class ( Z_STR_P ( class_name ) , opline - > op1 . num ) ;
2014-12-05 23:23:39 +08:00
} else if ( ( OP2_TYPE & ( IS_VAR | IS_CV ) ) & & Z_TYPE_P ( class_name ) = = IS_REFERENCE ) {
class_name = Z_REFVAL_P ( class_name ) ;
ZEND_VM_C_GOTO ( try_class_name ) ;
2009-04-08 21:19:34 +08:00
} else {
2015-06-05 06:53:32 +08:00
if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( class_name ) = = IS_UNDEF ) ) {
GET_OP2_UNDEF_CV ( class_name , BP_VAR_R ) ;
2015-09-08 22:20:52 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
HANDLE_EXCEPTION ( ) ;
}
2013-02-16 22:22:22 +08:00
}
2015-07-08 01:10:22 +08:00
zend_throw_error ( NULL , " Class name must be a valid object or a string " ) ;
2009-04-08 21:19:34 +08:00
}
}
2018-02-06 00:41:47 +08:00
FREE_OP2 ( ) ;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2008-06-11 21:18:41 +08:00
2018-02-06 00:41:47 +08:00
ZEND_VM_HOT_OBJ_HANDLER ( 112 , ZEND_INIT_METHOD_CALL , CONST | TMPVAR | UNUSED | THIS | CV , CONST | TMPVAR | CV , NUM | CACHE_SLOT )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zval * function_name ;
zend_free_op free_op1 , free_op2 ;
2014-02-28 19:58:11 +08:00
zval * object ;
2014-06-30 19:43:45 +08:00
zend_function * fbc ;
zend_class_entry * called_scope ;
zend_object * obj ;
2015-04-15 22:02:21 +08:00
zend_execute_data * call ;
2015-05-07 21:28:23 +08:00
uint32_t call_info ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2017-06-15 21:23:05 +08:00
object = GET_OP1_OBJ_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
if ( OP1_TYPE = = IS_UNUSED & & UNEXPECTED ( Z_TYPE_P ( object ) = = IS_UNDEF ) ) {
ZEND_VM_DISPATCH_TO_HELPER ( zend_this_not_in_object_context_helper ) ;
}
2018-02-06 00:41:47 +08:00
if ( OP2_TYPE ! = IS_CONST ) {
function_name = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
}
2008-06-11 21:18:41 +08:00
2010-04-20 19:16:39 +08:00
if ( OP2_TYPE ! = IS_CONST & &
UNEXPECTED ( Z_TYPE_P ( function_name ) ! = IS_STRING ) ) {
2015-02-26 21:21:48 +08:00
do {
if ( ( OP2_TYPE & ( IS_VAR | IS_CV ) ) & & Z_ISREF_P ( function_name ) ) {
function_name = Z_REFVAL_P ( function_name ) ;
if ( EXPECTED ( Z_TYPE_P ( function_name ) = = IS_STRING ) ) {
2014-12-08 23:11:14 +08:00
break ;
}
2015-09-08 22:20:52 +08:00
} else if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( function_name ) = = IS_UNDEF ) ) {
2015-06-05 06:53:32 +08:00
GET_OP2_UNDEF_CV ( function_name , BP_VAR_R ) ;
2015-09-08 22:20:52 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2017-06-15 21:23:05 +08:00
FREE_OP1 ( ) ;
2015-09-08 22:20:52 +08:00
HANDLE_EXCEPTION ( ) ;
}
2014-12-08 23:11:14 +08:00
}
2015-07-08 01:10:22 +08:00
zend_throw_error ( NULL , " Method name must be a string " ) ;
2014-12-08 23:11:14 +08:00
FREE_OP2 ( ) ;
2017-06-15 21:23:05 +08:00
FREE_OP1 ( ) ;
2015-03-09 20:57:15 +08:00
HANDLE_EXCEPTION ( ) ;
2015-02-26 21:21:48 +08:00
} while ( 0 ) ;
2004-10-23 05:42:14 +08:00
}
2014-07-06 20:48:42 +08:00
2015-03-09 20:57:15 +08:00
if ( OP1_TYPE ! = IS_UNUSED ) {
2015-05-07 22:26:35 +08:00
do {
2015-06-04 00:29:03 +08:00
if ( OP1_TYPE = = IS_CONST | | UNEXPECTED ( Z_TYPE_P ( object ) ! = IS_OBJECT ) ) {
2015-05-07 22:26:35 +08:00
if ( ( OP1_TYPE & ( IS_VAR | IS_CV ) ) & & EXPECTED ( Z_ISREF_P ( object ) ) ) {
object = Z_REFVAL_P ( object ) ;
if ( EXPECTED ( Z_TYPE_P ( object ) = = IS_OBJECT ) ) {
break ;
}
}
2015-06-05 06:53:32 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( object ) = = IS_UNDEF ) ) {
2016-02-25 00:00:04 +08:00
object = GET_OP1_UNDEF_CV ( object , BP_VAR_R ) ;
2015-09-08 22:20:52 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
FREE_OP2 ( ) ;
HANDLE_EXCEPTION ( ) ;
}
2015-05-07 22:26:35 +08:00
}
2018-02-06 00:41:47 +08:00
if ( OP2_TYPE = = IS_CONST ) {
function_name = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
}
2018-02-16 07:45:31 +08:00
zend_invalid_method_call ( object , function_name ) ;
2015-05-07 22:26:35 +08:00
FREE_OP2 ( ) ;
FREE_OP1 ( ) ;
2014-12-08 23:11:14 +08:00
HANDLE_EXCEPTION ( ) ;
}
2015-05-07 22:26:35 +08:00
} while ( 0 ) ;
2015-03-09 20:57:15 +08:00
}
2008-06-11 21:18:41 +08:00
2014-06-30 19:43:45 +08:00
obj = Z_OBJ_P ( object ) ;
2014-10-09 20:17:30 +08:00
called_scope = obj - > ce ;
2014-06-30 19:43:45 +08:00
2017-05-10 18:27:37 +08:00
if ( OP2_TYPE = = IS_CONST & &
2018-02-06 00:41:47 +08:00
EXPECTED ( CACHED_PTR ( opline - > result . num ) = = called_scope ) ) {
fbc = CACHED_PTR ( opline - > result . num + sizeof ( void * ) ) ;
2017-05-10 18:27:37 +08:00
} else {
2014-06-30 19:43:45 +08:00
zend_object * orig_obj = obj ;
if ( UNEXPECTED ( obj - > handlers - > get_method = = NULL ) ) {
2015-07-08 01:10:22 +08:00
zend_throw_error ( NULL , " Object does not support method calls " ) ;
2015-03-09 20:57:15 +08:00
FREE_OP2 ( ) ;
FREE_OP1 ( ) ;
HANDLE_EXCEPTION ( ) ;
2014-06-30 19:43:45 +08:00
}
2018-02-06 00:41:47 +08:00
if ( OP2_TYPE = = IS_CONST ) {
function_name = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
}
2014-06-30 19:43:45 +08:00
/* First, locate the function. */
2017-10-04 21:53:01 +08:00
fbc = obj - > handlers - > get_method ( & obj , Z_STR_P ( function_name ) , ( ( OP2_TYPE = = IS_CONST ) ? ( RT_CONSTANT ( opline , opline - > op2 ) + 1 ) : NULL ) ) ;
2014-06-30 19:43:45 +08:00
if ( UNEXPECTED ( fbc = = NULL ) ) {
2015-04-01 05:37:59 +08:00
if ( EXPECTED ( ! EG ( exception ) ) ) {
2018-02-16 07:45:31 +08:00
zend_undefined_method ( obj - > ce , Z_STR_P ( function_name ) ) ;
2015-04-01 05:37:59 +08:00
}
2015-03-09 20:57:15 +08:00
FREE_OP2 ( ) ;
FREE_OP1 ( ) ;
HANDLE_EXCEPTION ( ) ;
2014-06-30 19:43:45 +08:00
}
if ( OP2_TYPE = = IS_CONST & &
EXPECTED ( fbc - > type < = ZEND_USER_FUNCTION ) & &
2015-04-11 04:01:00 +08:00
EXPECTED ( ! ( fbc - > common . fn_flags & ( ZEND_ACC_CALL_VIA_TRAMPOLINE | ZEND_ACC_NEVER_CACHE ) ) ) & &
2014-06-30 19:43:45 +08:00
EXPECTED ( obj = = orig_obj ) ) {
2018-02-06 00:41:47 +08:00
CACHE_POLYMORPHIC_PTR ( opline - > result . num , called_scope , fbc ) ;
2014-06-30 19:43:45 +08:00
}
2016-04-05 05:01:00 +08:00
if ( EXPECTED ( fbc - > type = = ZEND_USER_FUNCTION ) & & UNEXPECTED ( ! fbc - > op_array . run_time_cache ) ) {
init_func_run_time_cache ( & fbc - > op_array ) ;
}
2014-06-30 19:43:45 +08:00
}
2015-05-07 21:28:23 +08:00
call_info = ZEND_CALL_NESTED_FUNCTION ;
2014-10-10 03:58:41 +08:00
if ( UNEXPECTED ( ( fbc - > common . fn_flags & ZEND_ACC_STATIC ) ! = 0 ) ) {
2014-06-30 19:43:45 +08:00
obj = NULL ;
2015-05-25 23:29:31 +08:00
} else if ( OP1_TYPE & ( IS_VAR | IS_TMP_VAR | IS_CV ) ) {
2015-05-26 00:20:52 +08:00
/* CV may be changed indirectly (e.g. when it's a reference) */
2015-05-07 21:28:23 +08:00
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_RELEASE_THIS ;
2017-10-27 06:28:58 +08:00
GC_ADDREF ( obj ) ; /* For $this pointer */
2008-06-11 21:18:41 +08:00
}
2013-08-29 17:35:11 +08:00
2016-10-18 20:13:20 +08:00
FREE_OP2 ( ) ;
FREE_OP1 ( ) ;
if ( ( OP1_TYPE & ( IS_VAR | IS_TMP_VAR ) ) & & UNEXPECTED ( EG ( exception ) ) ) {
HANDLE_EXCEPTION ( ) ;
}
2015-05-07 21:28:23 +08:00
call = zend_vm_stack_push_call_frame ( call_info ,
2015-04-15 22:02:21 +08:00
fbc , opline - > extended_value , called_scope , obj ) ;
call - > prev_execute_data = EX ( call ) ;
EX ( call ) = call ;
2004-10-23 05:42:14 +08:00
2016-10-18 20:13:20 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
2008-06-11 21:18:41 +08:00
}
2004-10-23 05:42:14 +08:00
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 113 , ZEND_INIT_STATIC_METHOD_CALL , UNUSED | CLASS_FETCH | CONST | VAR , CONST | TMPVAR | UNUSED | CONSTRUCTOR | CV , NUM | CACHE_SLOT )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zval * function_name ;
zend_class_entry * ce ;
2014-06-30 19:43:45 +08:00
zend_object * object ;
zend_function * fbc ;
2015-04-15 22:02:21 +08:00
zend_execute_data * call ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2007-10-03 14:49:15 +08:00
2009-03-10 18:01:44 +08:00
if ( OP1_TYPE = = IS_CONST ) {
2007-10-03 14:49:15 +08:00
/* no function found. try a static method in class */
2018-02-06 00:41:47 +08:00
ce = CACHED_PTR ( opline - > result . num ) ;
2015-08-28 04:02:15 +08:00
if ( UNEXPECTED ( ce = = NULL ) ) {
2017-10-04 21:53:01 +08:00
ce = zend_fetch_class_by_name ( Z_STR_P ( RT_CONSTANT ( opline , opline - > op1 ) ) , RT_CONSTANT ( opline , opline - > op1 ) + 1 , ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION ) ;
2010-05-24 22:11:39 +08:00
if ( UNEXPECTED ( ce = = NULL ) ) {
2016-09-30 16:00:14 +08:00
ZEND_ASSERT ( EG ( exception ) ) ;
2015-03-09 20:57:15 +08:00
HANDLE_EXCEPTION ( ) ;
2010-05-24 22:11:39 +08:00
}
2018-02-06 00:41:47 +08:00
if ( OP2_TYPE ! = IS_CONST ) {
CACHE_PTR ( opline - > result . num , ce ) ;
}
2007-09-29 15:28:34 +08:00
}
2015-10-27 20:47:58 +08:00
} else if ( OP1_TYPE = = IS_UNUSED ) {
ce = zend_fetch_class ( NULL , opline - > op1 . num ) ;
2015-11-16 18:19:22 +08:00
if ( UNEXPECTED ( ce = = NULL ) ) {
ZEND_ASSERT ( EG ( exception ) ) ;
2015-12-15 00:30:45 +08:00
FREE_UNFETCHED_OP2 ( ) ;
2015-11-16 18:19:22 +08:00
HANDLE_EXCEPTION ( ) ;
}
2007-09-29 03:52:53 +08:00
} else {
2014-02-10 14:04:30 +08:00
ce = Z_CE_P ( EX_VAR ( opline - > op1 . var ) ) ;
2004-10-23 05:42:14 +08:00
}
2010-05-24 22:11:39 +08:00
if ( OP1_TYPE = = IS_CONST & &
OP2_TYPE = = IS_CONST & &
2018-02-06 00:41:47 +08:00
EXPECTED ( ( fbc = CACHED_PTR ( opline - > result . num + sizeof ( void * ) ) ) ! = NULL ) ) {
2015-08-28 04:02:15 +08:00
/* nothing to do */
2010-05-24 22:11:39 +08:00
} else if ( OP1_TYPE ! = IS_CONST & &
OP2_TYPE = = IS_CONST & &
2018-02-06 00:41:47 +08:00
EXPECTED ( CACHED_PTR ( opline - > result . num ) = = ce ) ) {
fbc = CACHED_PTR ( opline - > result . num + sizeof ( void * ) ) ;
2010-05-24 22:11:39 +08:00
} else if ( OP2_TYPE ! = IS_UNUSED ) {
2004-10-23 05:42:14 +08:00
zend_free_op free_op2 ;
2007-09-29 15:28:34 +08:00
2015-06-05 06:53:32 +08:00
function_name = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2014-02-10 14:04:30 +08:00
if ( OP2_TYPE ! = IS_CONST ) {
2010-04-20 19:16:39 +08:00
if ( UNEXPECTED ( Z_TYPE_P ( function_name ) ! = IS_STRING ) ) {
2016-02-19 04:14:46 +08:00
do {
if ( OP2_TYPE & ( IS_VAR | IS_CV ) & & Z_ISREF_P ( function_name ) ) {
function_name = Z_REFVAL_P ( function_name ) ;
if ( EXPECTED ( Z_TYPE_P ( function_name ) = = IS_STRING ) ) {
break ;
}
} else if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( function_name ) = = IS_UNDEF ) ) {
GET_OP2_UNDEF_CV ( function_name , BP_VAR_R ) ;
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
HANDLE_EXCEPTION ( ) ;
}
2015-09-08 22:20:52 +08:00
}
2016-02-19 04:14:46 +08:00
zend_throw_error ( NULL , " Function name must be a string " ) ;
FREE_OP2 ( ) ;
HANDLE_EXCEPTION ( ) ;
} while ( 0 ) ;
2018-01-10 07:22:07 +08:00
}
2004-10-23 05:42:14 +08:00
}
2010-04-20 19:16:39 +08:00
2014-02-10 14:04:30 +08:00
if ( ce - > get_static_method ) {
2014-12-14 06:06:14 +08:00
fbc = ce - > get_static_method ( ce , Z_STR_P ( function_name ) ) ;
2014-02-10 14:04:30 +08:00
} else {
2017-10-04 21:53:01 +08:00
fbc = zend_std_get_static_method ( ce , Z_STR_P ( function_name ) , ( ( OP2_TYPE = = IS_CONST ) ? ( RT_CONSTANT ( opline , opline - > op2 ) + 1 ) : NULL ) ) ;
2014-02-10 14:04:30 +08:00
}
2014-06-30 19:43:45 +08:00
if ( UNEXPECTED ( fbc = = NULL ) ) {
2015-04-01 05:37:59 +08:00
if ( EXPECTED ( ! EG ( exception ) ) ) {
2018-02-16 07:45:31 +08:00
zend_undefined_method ( ce , Z_STR_P ( function_name ) ) ;
2015-04-01 05:37:59 +08:00
}
2015-03-09 20:57:15 +08:00
FREE_OP2 ( ) ;
HANDLE_EXCEPTION ( ) ;
2014-02-10 14:04:30 +08:00
}
if ( OP2_TYPE = = IS_CONST & &
2014-06-30 19:43:45 +08:00
EXPECTED ( fbc - > type < = ZEND_USER_FUNCTION ) & &
2015-04-11 04:01:00 +08:00
EXPECTED ( ! ( fbc - > common . fn_flags & ( ZEND_ACC_CALL_VIA_TRAMPOLINE | ZEND_ACC_NEVER_CACHE ) ) ) ) {
2018-02-06 00:41:47 +08:00
CACHE_POLYMORPHIC_PTR ( opline - > result . num , ce , fbc ) ;
2007-09-29 17:34:24 +08:00
}
2016-04-05 05:01:00 +08:00
if ( EXPECTED ( fbc - > type = = ZEND_USER_FUNCTION ) & & UNEXPECTED ( ! fbc - > op_array . run_time_cache ) ) {
init_func_run_time_cache ( & fbc - > op_array ) ;
}
2008-01-24 01:55:55 +08:00
if ( OP2_TYPE ! = IS_CONST ) {
2004-10-23 05:42:14 +08:00
FREE_OP2 ( ) ;
}
} else {
2010-04-20 19:16:39 +08:00
if ( UNEXPECTED ( ce - > constructor = = NULL ) ) {
2015-07-08 01:10:22 +08:00
zend_throw_error ( NULL , " Cannot call constructor " ) ;
2015-03-09 20:57:15 +08:00
HANDLE_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2016-04-01 21:17:49 +08:00
if ( Z_TYPE ( EX ( This ) ) = = IS_OBJECT & & Z_OBJ ( EX ( This ) ) - > ce ! = ce - > constructor - > common . scope & & ( ce - > constructor - > common . fn_flags & ZEND_ACC_PRIVATE ) ) {
2015-07-08 01:10:22 +08:00
zend_throw_error ( NULL , " Cannot call private %s::__construct() " , ZSTR_VAL ( ce - > name ) ) ;
2015-03-09 20:57:15 +08:00
HANDLE_EXCEPTION ( ) ;
2006-08-08 07:24:33 +08:00
}
2014-06-30 19:43:45 +08:00
fbc = ce - > constructor ;
2016-04-05 05:01:00 +08:00
if ( EXPECTED ( fbc - > type = = ZEND_USER_FUNCTION ) & & UNEXPECTED ( ! fbc - > op_array . run_time_cache ) ) {
init_func_run_time_cache ( & fbc - > op_array ) ;
}
2004-10-23 05:42:14 +08:00
}
2014-06-30 19:43:45 +08:00
object = NULL ;
if ( ! ( fbc - > common . fn_flags & ZEND_ACC_STATIC ) ) {
2016-04-01 21:17:49 +08:00
if ( Z_TYPE ( EX ( This ) ) = = IS_OBJECT & & instanceof_function ( Z_OBJCE ( EX ( This ) ) , ce ) ) {
2014-10-03 23:32:46 +08:00
object = Z_OBJ ( EX ( This ) ) ;
2015-11-30 21:52:57 +08:00
ce = object - > ce ;
} else {
2018-02-16 07:45:31 +08:00
zend_non_static_method_call ( fbc ) ;
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2015-07-28 14:54:20 +08:00
HANDLE_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
}
2014-06-30 19:43:45 +08:00
}
2015-10-27 20:47:58 +08:00
if ( OP1_TYPE = = IS_UNUSED ) {
2015-10-07 04:48:08 +08:00
/* previous opcode is ZEND_FETCH_CLASS */
2018-01-04 12:41:57 +08:00
if ( ( opline - > op1 . num & ZEND_FETCH_CLASS_MASK ) = = ZEND_FETCH_CLASS_PARENT | |
2015-10-27 20:47:58 +08:00
( opline - > op1 . num & ZEND_FETCH_CLASS_MASK ) = = ZEND_FETCH_CLASS_SELF ) {
2016-04-01 21:17:49 +08:00
if ( Z_TYPE ( EX ( This ) ) = = IS_OBJECT ) {
ce = Z_OBJCE ( EX ( This ) ) ;
} else {
ce = Z_CE ( EX ( This ) ) ;
}
2015-10-07 04:48:08 +08:00
}
2004-10-23 05:42:14 +08:00
}
2015-10-07 04:48:08 +08:00
call = zend_vm_stack_push_call_frame ( ZEND_CALL_NESTED_FUNCTION ,
fbc , opline - > extended_value , ce , object ) ;
2015-04-15 22:02:21 +08:00
call - > prev_execute_data = EX ( call ) ;
EX ( call ) = call ;
2015-01-03 17:22:58 +08:00
2016-10-18 20:13:20 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HOT_HANDLER ( 59 , ZEND_INIT_FCALL_BY_NAME , ANY , CONST , NUM | CACHE_SLOT )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2014-06-30 19:43:45 +08:00
zend_function * fbc ;
zval * function_name , * func ;
2015-04-15 22:02:21 +08:00
zend_execute_data * call ;
2004-10-23 05:42:14 +08:00
2018-02-06 00:41:47 +08:00
fbc = CACHED_PTR ( opline - > result . num ) ;
2015-08-28 04:02:15 +08:00
if ( UNEXPECTED ( fbc = = NULL ) ) {
2018-02-06 00:41:47 +08:00
function_name = ( zval * ) RT_CONSTANT ( opline , opline - > op2 ) ;
2017-11-24 19:01:19 +08:00
func = zend_hash_find_ex ( EG ( function_table ) , Z_STR_P ( function_name + 1 ) , 1 ) ;
2015-08-28 04:02:15 +08:00
if ( UNEXPECTED ( func = = NULL ) ) {
2018-02-16 07:45:31 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_undefined_function_helper , function_name , function_name ) ;
2004-10-23 05:42:14 +08:00
}
2015-08-28 04:02:15 +08:00
fbc = Z_FUNC_P ( func ) ;
2016-04-05 05:01:00 +08:00
if ( EXPECTED ( fbc - > type = = ZEND_USER_FUNCTION ) & & UNEXPECTED ( ! fbc - > op_array . run_time_cache ) ) {
init_func_run_time_cache ( & fbc - > op_array ) ;
}
2018-02-06 00:41:47 +08:00
CACHE_PTR ( opline - > result . num , fbc ) ;
2015-02-25 03:29:47 +08:00
}
2015-04-15 22:02:21 +08:00
call = zend_vm_stack_push_call_frame ( ZEND_CALL_NESTED_FUNCTION ,
fbc , opline - > extended_value , NULL , NULL ) ;
call - > prev_execute_data = EX ( call ) ;
EX ( call ) = call ;
2013-08-29 17:35:11 +08:00
2015-02-25 03:29:47 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
}
2013-08-29 17:35:11 +08:00
2015-10-29 04:25:05 +08:00
ZEND_VM_HANDLER ( 128 , ZEND_INIT_DYNAMIC_CALL , ANY , CONST | TMPVAR | CV , NUM )
2015-02-25 03:29:47 +08:00
{
USE_OPLINE
zend_free_op free_op2 ;
2016-04-12 19:41:06 +08:00
zval * function_name ;
2015-04-15 22:02:21 +08:00
zend_execute_data * call ;
2010-04-20 19:16:39 +08:00
2015-02-25 03:29:47 +08:00
SAVE_OPLINE ( ) ;
2015-06-05 06:53:32 +08:00
function_name = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2004-10-23 05:42:14 +08:00
2014-12-05 23:23:39 +08:00
ZEND_VM_C_LABEL ( try_function_name ) :
2015-02-25 03:29:47 +08:00
if ( OP2_TYPE ! = IS_CONST & & EXPECTED ( Z_TYPE_P ( function_name ) = = IS_STRING ) ) {
2016-04-12 19:41:06 +08:00
call = zend_init_dynamic_call_string ( Z_STR_P ( function_name ) , opline - > extended_value ) ;
} else if ( OP2_TYPE ! = IS_CONST & & EXPECTED ( Z_TYPE_P ( function_name ) = = IS_OBJECT ) ) {
call = zend_init_dynamic_call_object ( function_name , opline - > extended_value ) ;
} else if ( EXPECTED ( Z_TYPE_P ( function_name ) = = IS_ARRAY ) ) {
call = zend_init_dynamic_call_array ( Z_ARRVAL_P ( function_name ) , opline - > extended_value ) ;
} else if ( ( OP2_TYPE & ( IS_VAR | IS_CV ) ) & & EXPECTED ( Z_TYPE_P ( function_name ) = = IS_REFERENCE ) ) {
2015-02-25 03:29:47 +08:00
function_name = Z_REFVAL_P ( function_name ) ;
ZEND_VM_C_GOTO ( try_function_name ) ;
} else {
2015-06-05 06:53:32 +08:00
if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( function_name ) = = IS_UNDEF ) ) {
GET_OP2_UNDEF_CV ( function_name , BP_VAR_R ) ;
2015-09-08 22:20:52 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
HANDLE_EXCEPTION ( ) ;
}
2015-02-25 03:29:47 +08:00
}
2015-07-08 01:10:22 +08:00
zend_throw_error ( NULL , " Function name must be a string " ) ;
2016-04-12 19:41:06 +08:00
call = NULL ;
2004-10-23 05:42:14 +08:00
}
2016-04-12 19:41:06 +08:00
if ( UNEXPECTED ( ! call ) ) {
HANDLE_EXCEPTION ( ) ;
2016-04-05 05:01:00 +08:00
}
2016-04-12 19:41:06 +08:00
2016-10-18 20:13:20 +08:00
FREE_OP2 ( ) ;
2016-10-18 20:31:49 +08:00
if ( OP2_TYPE & ( IS_VAR | IS_TMP_VAR ) ) {
if ( UNEXPECTED ( EG ( exception ) ) ) {
if ( call ) {
if ( call - > func - > common . fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE ) {
zend_string_release ( call - > func - > common . function_name ) ;
zend_free_trampoline ( call - > func ) ;
}
zend_vm_stack_free_call_frame ( call ) ;
}
HANDLE_EXCEPTION ( ) ;
2016-10-18 20:13:20 +08:00
}
2016-10-18 20:31:49 +08:00
} else if ( UNEXPECTED ( ! call ) ) {
2016-10-18 20:13:20 +08:00
HANDLE_EXCEPTION ( ) ;
}
2016-10-18 20:31:49 +08:00
2015-04-15 22:02:21 +08:00
call - > prev_execute_data = EX ( call ) ;
EX ( call ) = call ;
2015-02-25 03:29:47 +08:00
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2012-08-22 18:32:03 +08:00
}
2004-10-23 05:42:14 +08:00
2015-10-29 04:25:05 +08:00
ZEND_VM_HANDLER ( 118 , ZEND_INIT_USER_CALL , CONST , CONST | TMPVAR | CV , NUM )
2014-07-11 04:32:18 +08:00
{
USE_OPLINE
zend_free_op free_op2 ;
2015-03-13 01:39:04 +08:00
zval * function_name ;
2014-07-11 04:32:18 +08:00
zend_fcall_info_cache fcc ;
char * error = NULL ;
zend_function * func ;
zend_class_entry * called_scope ;
zend_object * object ;
2015-04-15 22:02:21 +08:00
zend_execute_data * call ;
2016-04-25 05:49:52 +08:00
uint32_t call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_DYNAMIC ;
2014-07-11 04:32:18 +08:00
2015-03-13 01:39:04 +08:00
SAVE_OPLINE ( ) ;
function_name = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
2014-12-14 06:06:14 +08:00
if ( zend_is_callable_ex ( function_name , NULL , 0 , NULL , & fcc , & error ) ) {
2014-07-11 04:32:18 +08:00
func = fcc . function_handler ;
2016-03-31 23:58:13 +08:00
called_scope = fcc . called_scope ;
object = fcc . object ;
2016-10-18 20:13:20 +08:00
if ( error ) {
efree ( error ) ;
/* This is the only soft error is_callable() can generate */
2018-02-16 07:45:31 +08:00
zend_non_static_method_call ( func ) ;
2016-10-18 20:13:20 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
FREE_OP2 ( ) ;
HANDLE_EXCEPTION ( ) ;
}
}
2014-07-11 04:32:18 +08:00
if ( func - > common . fn_flags & ZEND_ACC_CLOSURE ) {
/* Delay closure destruction until its invocation */
2018-01-12 03:15:45 +08:00
GC_ADDREF ( ZEND_CLOSURE_OBJECT ( func ) ) ;
2015-04-16 17:16:03 +08:00
call_info | = ZEND_CALL_CLOSURE ;
2016-09-26 22:44:28 +08:00
if ( func - > common . fn_flags & ZEND_ACC_FAKE_CLOSURE ) {
call_info | = ZEND_CALL_FAKE_CLOSURE ;
}
2016-03-31 23:58:13 +08:00
} else if ( object ) {
2015-05-07 21:28:23 +08:00
call_info | = ZEND_CALL_RELEASE_THIS ;
2017-10-27 06:28:58 +08:00
GC_ADDREF ( object ) ; /* For $this pointer */
2015-05-08 21:05:59 +08:00
}
2016-10-18 20:13:20 +08:00
FREE_OP2 ( ) ;
if ( ( OP2_TYPE & ( IS_TMP_VAR | IS_VAR ) ) & & UNEXPECTED ( EG ( exception ) ) ) {
if ( call_info & ZEND_CALL_CLOSURE ) {
2018-01-12 03:15:45 +08:00
zend_object_release ( ZEND_CLOSURE_OBJECT ( func ) ) ;
2015-07-28 16:06:06 +08:00
}
2016-10-18 20:13:20 +08:00
if ( call_info & ZEND_CALL_RELEASE_THIS ) {
zend_object_release ( object ) ;
2015-07-28 16:06:06 +08:00
}
2016-10-18 20:13:20 +08:00
HANDLE_EXCEPTION ( ) ;
2014-07-11 04:32:18 +08:00
}
2016-10-18 20:31:49 +08:00
2016-04-05 05:01:00 +08:00
if ( EXPECTED ( func - > type = = ZEND_USER_FUNCTION ) & & UNEXPECTED ( ! func - > op_array . run_time_cache ) ) {
init_func_run_time_cache ( & func - > op_array ) ;
}
2014-07-11 04:32:18 +08:00
} else {
2017-10-04 21:53:01 +08:00
zend_internal_type_error ( EX_USES_STRICT_TYPES ( ) , " %s() expects parameter 1 to be a valid callback, %s " , Z_STRVAL_P ( RT_CONSTANT ( opline , opline - > op1 ) ) , error ) ;
2014-07-11 04:32:18 +08:00
efree ( error ) ;
2016-10-18 20:13:20 +08:00
FREE_OP2 ( ) ;
if ( UNEXPECTED ( EG ( exception ) ) ) {
HANDLE_EXCEPTION ( ) ;
}
2014-07-11 04:32:18 +08:00
func = ( zend_function * ) & zend_pass_function ;
called_scope = NULL ;
object = NULL ;
}
2015-04-16 17:16:03 +08:00
call = zend_vm_stack_push_call_frame ( call_info ,
2015-04-15 22:02:21 +08:00
func , opline - > extended_value , called_scope , object ) ;
call - > prev_execute_data = EX ( call ) ;
EX ( call ) = call ;
2014-07-11 04:32:18 +08:00
2016-10-18 20:13:20 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
2014-07-11 04:32:18 +08:00
}
2008-04-21 18:14:20 +08:00
2018-03-23 18:59:47 +08:00
ZEND_VM_HOT_HANDLER ( 69 , ZEND_INIT_NS_FCALL_BY_NAME , ANY , CONST , NUM | CACHE_SLOT )
2012-08-22 18:32:03 +08:00
{
USE_OPLINE
2014-04-17 19:40:45 +08:00
zval * func_name ;
2014-02-10 14:04:30 +08:00
zval * func ;
2014-06-30 19:43:45 +08:00
zend_function * fbc ;
2015-04-15 22:02:21 +08:00
zend_execute_data * call ;
2012-08-22 18:32:03 +08:00
2018-02-06 00:41:47 +08:00
fbc = CACHED_PTR ( opline - > result . num ) ;
2015-08-28 04:02:15 +08:00
if ( UNEXPECTED ( fbc = = NULL ) ) {
2018-02-06 00:41:47 +08:00
func_name = RT_CONSTANT ( opline , opline - > op2 ) + 1 ;
2017-11-24 19:01:19 +08:00
func = zend_hash_find_ex ( EG ( function_table ) , Z_STR_P ( func_name ) , 1 ) ;
2015-08-28 04:02:15 +08:00
if ( func = = NULL ) {
func_name + + ;
2017-11-24 19:01:19 +08:00
func = zend_hash_find_ex ( EG ( function_table ) , Z_STR_P ( func_name ) , 1 ) ;
2015-08-28 04:02:15 +08:00
if ( UNEXPECTED ( func = = NULL ) ) {
2018-02-16 07:45:31 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_undefined_function_helper , function_name , func_name ) ;
2015-08-28 04:02:15 +08:00
}
2004-10-23 05:42:14 +08:00
}
2014-06-30 19:43:45 +08:00
fbc = Z_FUNC_P ( func ) ;
2018-02-06 00:41:47 +08:00
CACHE_PTR ( opline - > result . num , fbc ) ;
2016-04-05 05:01:00 +08:00
if ( EXPECTED ( fbc - > type = = ZEND_USER_FUNCTION ) & & UNEXPECTED ( ! fbc - > op_array . run_time_cache ) ) {
init_func_run_time_cache ( & fbc - > op_array ) ;
}
2004-10-23 05:42:14 +08:00
}
2015-04-15 22:02:21 +08:00
call = zend_vm_stack_push_call_frame ( ZEND_CALL_NESTED_FUNCTION ,
fbc , opline - > extended_value , NULL , NULL ) ;
call - > prev_execute_data = EX ( call ) ;
EX ( call ) = call ;
2014-02-10 14:04:30 +08:00
2004-10-23 05:42:14 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HOT_HANDLER ( 61 , ZEND_INIT_FCALL , NUM , CONST , NUM | CACHE_SLOT )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2014-06-30 19:43:45 +08:00
zend_free_op free_op2 ;
2018-02-06 00:41:47 +08:00
zval * fname ;
2014-02-10 14:04:30 +08:00
zval * func ;
2014-06-30 19:43:45 +08:00
zend_function * fbc ;
2015-04-15 22:02:21 +08:00
zend_execute_data * call ;
2004-10-23 05:42:14 +08:00
2018-02-06 00:41:47 +08:00
fbc = CACHED_PTR ( opline - > result . num ) ;
2015-08-28 04:02:15 +08:00
if ( UNEXPECTED ( fbc = = NULL ) ) {
2018-02-06 00:41:47 +08:00
fname = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
2017-11-24 19:01:19 +08:00
func = zend_hash_find_ex ( EG ( function_table ) , Z_STR_P ( fname ) , 1 ) ;
2015-08-28 04:02:15 +08:00
if ( UNEXPECTED ( func = = NULL ) ) {
2018-02-16 07:45:31 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_undefined_function_helper , function_name , fname ) ;
2015-08-28 04:02:15 +08:00
}
2014-06-30 19:43:45 +08:00
fbc = Z_FUNC_P ( func ) ;
2018-02-06 00:41:47 +08:00
CACHE_PTR ( opline - > result . num , fbc ) ;
2016-04-05 05:01:00 +08:00
if ( EXPECTED ( fbc - > type = = ZEND_USER_FUNCTION ) & & UNEXPECTED ( ! fbc - > op_array . run_time_cache ) ) {
init_func_run_time_cache ( & fbc - > op_array ) ;
}
2004-10-23 05:42:14 +08:00
}
2013-08-29 17:35:11 +08:00
2015-04-15 22:02:21 +08:00
call = zend_vm_stack_push_call_frame_ex (
2014-12-16 23:40:52 +08:00
opline - > op1 . num , ZEND_CALL_NESTED_FUNCTION ,
2015-04-15 22:02:21 +08:00
fbc , opline - > extended_value , NULL , NULL ) ;
call - > prev_execute_data = EX ( call ) ;
EX ( call ) = call ;
2004-10-23 05:42:14 +08:00
2014-06-30 19:43:45 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_HANDLER ( 129 , ZEND_DO_ICALL , ANY , ANY , SPEC ( RETVAL ) )
2015-02-25 15:37:21 +08:00
{
USE_OPLINE
zend_execute_data * call = EX ( call ) ;
zend_function * fbc = call - > func ;
zval * ret ;
2016-02-05 22:23:23 +08:00
zval retval ;
2015-02-25 15:37:21 +08:00
SAVE_OPLINE ( ) ;
EX ( call ) = call - > prev_execute_data ;
call - > prev_execute_data = execute_data ;
EG ( current_execute_data ) = call ;
2016-02-05 22:23:23 +08:00
ret = RETURN_VALUE_USED ( opline ) ? EX_VAR ( opline - > result . var ) : & retval ;
2015-02-25 15:37:21 +08:00
ZVAL_NULL ( ret ) ;
fbc - > internal_function . handler ( call , ret ) ;
2015-03-24 17:21:06 +08:00
# if ZEND_DEBUG
2017-10-17 18:35:59 +08:00
if ( ! EG ( exception ) & & call - > func ) {
ZEND_ASSERT ( ! ( call - > func - > common . fn_flags & ZEND_ACC_HAS_RETURN_TYPE ) | |
zend_verify_internal_return_type ( call - > func , ret ) ) ;
ZEND_ASSERT ( ( call - > func - > common . fn_flags & ZEND_ACC_RETURN_REFERENCE )
? Z_ISREF_P ( ret ) : ! Z_ISREF_P ( ret ) ) ;
}
2015-03-24 17:21:06 +08:00
# endif
2015-02-25 15:37:21 +08:00
2016-09-13 22:10:30 +08:00
EG ( current_execute_data ) = execute_data ;
2015-02-25 15:37:21 +08:00
zend_vm_stack_free_args ( call ) ;
zend_vm_stack_free_call_frame ( call ) ;
if ( ! RETURN_VALUE_USED ( opline ) ) {
2016-02-05 22:23:23 +08:00
zval_ptr_dtor ( ret ) ;
2015-02-25 15:37:21 +08:00
}
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2016-12-12 15:55:32 +08:00
zend_rethrow_exception ( execute_data ) ;
2015-02-25 15:37:21 +08:00
HANDLE_EXCEPTION ( ) ;
}
2016-04-20 16:06:52 +08:00
ZEND_VM_SET_OPCODE ( opline + 1 ) ;
ZEND_VM_CONTINUE ( ) ;
2015-02-25 15:37:21 +08:00
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_HANDLER ( 130 , ZEND_DO_UCALL , ANY , ANY , SPEC ( RETVAL ) )
2015-02-25 15:37:21 +08:00
{
USE_OPLINE
zend_execute_data * call = EX ( call ) ;
zend_function * fbc = call - > func ;
zval * ret ;
SAVE_OPLINE ( ) ;
EX ( call ) = call - > prev_execute_data ;
ret = NULL ;
if ( RETURN_VALUE_USED ( opline ) ) {
ret = EX_VAR ( opline - > result . var ) ;
ZVAL_NULL ( ret ) ;
}
call - > prev_execute_data = execute_data ;
2017-12-06 07:53:30 +08:00
execute_data = call ;
i_init_func_execute_data ( & fbc - > op_array , ret , 0 EXECUTE_DATA_CC ) ;
LOAD_OPLINE ( ) ;
2014-07-11 04:32:18 +08:00
2017-12-06 07:53:30 +08:00
ZEND_VM_ENTER_EX ( ) ;
2014-07-11 04:32:18 +08:00
}
2008-04-21 18:14:20 +08:00
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_HANDLER ( 131 , ZEND_DO_FCALL_BY_NAME , ANY , ANY , SPEC ( RETVAL ) )
2012-08-22 18:32:03 +08:00
{
USE_OPLINE
2015-02-25 15:37:21 +08:00
zend_execute_data * call = EX ( call ) ;
zend_function * fbc = call - > func ;
zval * ret ;
2012-08-22 18:32:03 +08:00
2015-02-25 15:37:21 +08:00
SAVE_OPLINE ( ) ;
EX ( call ) = call - > prev_execute_data ;
if ( EXPECTED ( fbc - > type = = ZEND_USER_FUNCTION ) ) {
2016-05-13 06:40:15 +08:00
ret = NULL ;
if ( RETURN_VALUE_USED ( opline ) ) {
ret = EX_VAR ( opline - > result . var ) ;
ZVAL_NULL ( ret ) ;
}
2015-02-25 15:37:21 +08:00
2016-05-13 06:40:15 +08:00
call - > prev_execute_data = execute_data ;
2017-12-06 07:53:30 +08:00
execute_data = call ;
i_init_func_execute_data ( & fbc - > op_array , ret , 0 EXECUTE_DATA_CC ) ;
LOAD_OPLINE ( ) ;
2015-02-25 15:37:21 +08:00
2017-12-06 07:53:30 +08:00
ZEND_VM_ENTER_EX ( ) ;
2012-08-22 18:32:03 +08:00
} else {
2016-02-05 22:23:23 +08:00
zval retval ;
2015-02-25 15:37:21 +08:00
ZEND_ASSERT ( fbc - > type = = ZEND_INTERNAL_FUNCTION ) ;
2004-10-23 05:42:14 +08:00
2015-02-25 15:37:21 +08:00
if ( UNEXPECTED ( ( fbc - > common . fn_flags & ZEND_ACC_DEPRECATED ) ! = 0 ) ) {
2018-02-16 07:45:31 +08:00
zend_deprecated_function ( fbc ) ;
2015-02-25 15:37:21 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2015-02-25 15:37:21 +08:00
HANDLE_EXCEPTION ( ) ;
}
}
2014-02-10 14:04:30 +08:00
2015-02-25 15:37:21 +08:00
call - > prev_execute_data = execute_data ;
EG ( current_execute_data ) = call ;
2004-10-23 05:42:14 +08:00
2016-04-14 01:13:17 +08:00
if ( UNEXPECTED ( fbc - > common . fn_flags & ZEND_ACC_HAS_TYPE_HINTS )
& & UNEXPECTED ( ! zend_verify_internal_arg_types ( fbc , call ) ) ) {
zend_vm_stack_free_call_frame ( call ) ;
2016-12-12 15:55:32 +08:00
zend_rethrow_exception ( execute_data ) ;
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2016-04-14 01:13:17 +08:00
HANDLE_EXCEPTION ( ) ;
2015-02-25 15:37:21 +08:00
}
2004-10-23 05:42:14 +08:00
2016-02-05 22:23:23 +08:00
ret = RETURN_VALUE_USED ( opline ) ? EX_VAR ( opline - > result . var ) : & retval ;
2015-02-25 15:37:21 +08:00
ZVAL_NULL ( ret ) ;
fbc - > internal_function . handler ( call , ret ) ;
2015-03-24 17:21:06 +08:00
# if ZEND_DEBUG
2016-04-10 19:01:54 +08:00
if ( ! EG ( exception ) & & call - > func ) {
ZEND_ASSERT ( ! ( call - > func - > common . fn_flags & ZEND_ACC_HAS_RETURN_TYPE ) | |
zend_verify_internal_return_type ( call - > func , ret ) ) ;
2017-10-17 18:25:19 +08:00
ZEND_ASSERT ( ( call - > func - > common . fn_flags & ZEND_ACC_RETURN_REFERENCE )
? Z_ISREF_P ( ret ) : ! Z_ISREF_P ( ret ) ) ;
2016-04-10 19:01:54 +08:00
}
2015-03-24 17:21:06 +08:00
# endif
2015-02-25 15:37:21 +08:00
2016-09-13 22:10:30 +08:00
EG ( current_execute_data ) = execute_data ;
2015-02-25 15:37:21 +08:00
zend_vm_stack_free_args ( call ) ;
zend_vm_stack_free_call_frame ( call ) ;
if ( ! RETURN_VALUE_USED ( opline ) ) {
2016-02-05 22:23:23 +08:00
zval_ptr_dtor ( ret ) ;
2015-02-25 15:37:21 +08:00
}
}
2014-06-30 19:43:45 +08:00
2015-02-25 15:37:21 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2016-12-12 15:55:32 +08:00
zend_rethrow_exception ( execute_data ) ;
2015-02-25 15:37:21 +08:00
HANDLE_EXCEPTION ( ) ;
}
2016-04-20 16:06:52 +08:00
ZEND_VM_SET_OPCODE ( opline + 1 ) ;
ZEND_VM_CONTINUE ( ) ;
2014-06-30 19:43:45 +08:00
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_HANDLER ( 60 , ZEND_DO_FCALL , ANY , ANY , SPEC ( RETVAL ) )
2014-06-30 19:43:45 +08:00
{
USE_OPLINE
zend_execute_data * call = EX ( call ) ;
zend_function * fbc = call - > func ;
2015-05-07 21:28:23 +08:00
zend_object * object ;
2014-12-29 18:38:36 +08:00
zval * ret ;
2014-06-30 19:43:45 +08:00
SAVE_OPLINE ( ) ;
2014-10-01 14:46:13 +08:00
EX ( call ) = call - > prev_execute_data ;
2014-06-30 19:43:45 +08:00
if ( UNEXPECTED ( ( fbc - > common . fn_flags & ( ZEND_ACC_ABSTRACT | ZEND_ACC_DEPRECATED ) ) ! = 0 ) ) {
if ( UNEXPECTED ( ( fbc - > common . fn_flags & ZEND_ACC_ABSTRACT ) ! = 0 ) ) {
2018-02-16 07:45:31 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_abstract_method_helper , fbc , fbc ) ;
2014-06-30 19:43:45 +08:00
}
if ( UNEXPECTED ( ( fbc - > common . fn_flags & ZEND_ACC_DEPRECATED ) ! = 0 ) ) {
2018-02-16 07:45:31 +08:00
zend_deprecated_function ( fbc ) ;
2014-06-30 19:43:45 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2014-06-30 19:43:45 +08:00
HANDLE_EXCEPTION ( ) ;
}
}
}
2014-12-29 19:20:52 +08:00
if ( EXPECTED ( fbc - > type = = ZEND_USER_FUNCTION ) ) {
2016-05-13 06:40:15 +08:00
ret = NULL ;
if ( RETURN_VALUE_USED ( opline ) ) {
ret = EX_VAR ( opline - > result . var ) ;
ZVAL_NULL ( ret ) ;
}
2014-12-29 19:20:52 +08:00
2016-05-13 06:40:15 +08:00
call - > prev_execute_data = execute_data ;
2017-12-06 07:53:30 +08:00
execute_data = call ;
i_init_func_execute_data ( & fbc - > op_array , ret , 1 EXECUTE_DATA_CC ) ;
2014-12-29 19:20:52 +08:00
2016-05-13 06:40:15 +08:00
if ( EXPECTED ( zend_execute_ex = = execute_ex ) ) {
2017-12-06 07:53:30 +08:00
LOAD_OPLINE ( ) ;
ZEND_VM_ENTER_EX ( ) ;
2016-05-13 06:40:15 +08:00
} else {
2017-12-06 07:53:30 +08:00
execute_data = EX ( prev_execute_data ) ;
LOAD_OPLINE ( ) ;
2016-05-13 06:40:15 +08:00
ZEND_ADD_CALL_FLAG ( call , ZEND_CALL_TOP ) ;
zend_execute_ex ( call ) ;
2014-12-29 19:20:52 +08:00
}
} else if ( EXPECTED ( fbc - > type < ZEND_USER_FUNCTION ) ) {
2016-02-05 22:23:23 +08:00
zval retval ;
2014-06-30 19:43:45 +08:00
2014-07-04 21:03:44 +08:00
call - > prev_execute_data = execute_data ;
2014-07-03 02:01:25 +08:00
EG ( current_execute_data ) = call ;
2016-04-14 01:13:17 +08:00
if ( UNEXPECTED ( fbc - > common . fn_flags & ZEND_ACC_HAS_TYPE_HINTS )
& & UNEXPECTED ( ! zend_verify_internal_arg_types ( fbc , call ) ) ) {
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2016-04-28 09:13:34 +08:00
ZEND_VM_C_GOTO ( fcall_end ) ;
2014-06-30 19:43:45 +08:00
}
2016-02-05 22:23:23 +08:00
ret = RETURN_VALUE_USED ( opline ) ? EX_VAR ( opline - > result . var ) : & retval ;
2014-06-30 19:43:45 +08:00
ZVAL_NULL ( ret ) ;
if ( ! zend_execute_internal ) {
/* saves one function call if zend_execute_internal is not used */
2014-12-14 06:06:14 +08:00
fbc - > internal_function . handler ( call , ret ) ;
2014-06-30 19:43:45 +08:00
} else {
2014-12-14 06:06:14 +08:00
zend_execute_internal ( call , ret ) ;
2014-06-30 19:43:45 +08:00
}
2018-01-04 12:41:57 +08:00
2015-03-24 17:21:06 +08:00
# if ZEND_DEBUG
2016-04-10 19:01:54 +08:00
if ( ! EG ( exception ) & & call - > func ) {
ZEND_ASSERT ( ! ( call - > func - > common . fn_flags & ZEND_ACC_HAS_RETURN_TYPE ) | |
zend_verify_internal_return_type ( call - > func , ret ) ) ;
2017-10-17 18:25:19 +08:00
ZEND_ASSERT ( ( call - > func - > common . fn_flags & ZEND_ACC_RETURN_REFERENCE )
? Z_ISREF_P ( ret ) : ! Z_ISREF_P ( ret ) ) ;
2016-04-10 19:01:54 +08:00
}
2015-03-24 17:21:06 +08:00
# endif
2015-02-11 22:41:21 +08:00
2016-09-13 22:10:30 +08:00
EG ( current_execute_data ) = execute_data ;
2014-12-14 06:06:14 +08:00
zend_vm_stack_free_args ( call ) ;
2014-06-30 19:43:45 +08:00
if ( ! RETURN_VALUE_USED ( opline ) ) {
2016-02-05 22:23:23 +08:00
zval_ptr_dtor ( ret ) ;
2014-06-30 19:43:45 +08:00
}
2004-10-23 05:42:14 +08:00
2014-06-30 19:43:45 +08:00
} else { /* ZEND_OVERLOADED_FUNCTION */
2016-02-05 22:23:23 +08:00
zval retval ;
2015-09-23 04:51:30 +08:00
2016-02-05 22:23:23 +08:00
ret = RETURN_VALUE_USED ( opline ) ? EX_VAR ( opline - > result . var ) : & retval ;
2015-09-23 04:51:30 +08:00
call - > prev_execute_data = execute_data ;
2016-11-22 23:36:27 +08:00
if ( UNEXPECTED ( ! zend_do_fcall_overloaded ( call , ret ) ) ) {
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2016-04-14 01:13:17 +08:00
HANDLE_EXCEPTION ( ) ;
2014-06-30 19:43:45 +08:00
}
if ( ! RETURN_VALUE_USED ( opline ) ) {
2016-02-05 22:23:23 +08:00
zval_ptr_dtor ( ret ) ;
2014-06-30 19:43:45 +08:00
}
}
2016-04-28 09:13:34 +08:00
ZEND_VM_C_LABEL ( fcall_end ) :
2015-05-07 22:26:35 +08:00
if ( UNEXPECTED ( ZEND_CALL_INFO ( call ) & ZEND_CALL_RELEASE_THIS ) ) {
2015-05-07 21:28:23 +08:00
object = Z_OBJ ( call - > This ) ;
#if 0
2014-06-30 19:43:45 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) & & ( opline - > op1 . num & ZEND_CALL_CTOR ) ) {
2015-05-07 21:28:23 +08:00
# else
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) & & ( ZEND_CALL_INFO ( call ) & ZEND_CALL_CTOR ) ) {
# endif
2017-10-27 06:28:58 +08:00
GC_DELREF ( object ) ;
2016-07-13 21:43:47 +08:00
zend_object_store_ctor_failed ( object ) ;
2014-06-30 19:43:45 +08:00
}
2014-10-03 23:32:46 +08:00
OBJ_RELEASE ( object ) ;
2014-06-30 19:43:45 +08:00
}
2015-05-07 21:28:23 +08:00
zend_vm_stack_free_call_frame ( call ) ;
2014-06-30 19:43:45 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2016-12-12 15:55:32 +08:00
zend_rethrow_exception ( execute_data ) ;
2014-06-30 19:43:45 +08:00
HANDLE_EXCEPTION ( ) ;
}
2016-04-20 16:06:52 +08:00
ZEND_VM_SET_OPCODE ( opline + 1 ) ;
ZEND_VM_CONTINUE ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 124 , ZEND_VERIFY_RETURN_TYPE , CONST | TMP | VAR | UNUSED | CV , UNUSED | CACHE_SLOT )
2015-01-09 04:40:36 +08:00
{
USE_OPLINE
2015-03-20 23:36:43 +08:00
2015-01-09 04:40:36 +08:00
SAVE_OPLINE ( ) ;
if ( OP1_TYPE = = IS_UNUSED ) {
2015-06-17 17:07:43 +08:00
zend_verify_missing_return_type ( EX ( func ) , CACHE_ADDR ( opline - > op2 . num ) ) ;
2015-01-09 04:40:36 +08:00
} else {
2015-02-03 04:07:46 +08:00
/* prevents "undefined variable opline" errors */
2015-03-20 23:36:43 +08:00
# if !defined(ZEND_VM_SPEC) || (OP1_TYPE != IS_UNUSED)
2015-03-24 17:48:16 +08:00
zval * retval_ref , * retval_ptr ;
2015-01-09 04:40:36 +08:00
zend_free_op free_op1 ;
2015-03-20 05:47:43 +08:00
zend_arg_info * ret_info = EX ( func ) - > common . arg_info - 1 ;
2015-01-09 04:40:36 +08:00
2015-03-24 17:48:16 +08:00
retval_ref = retval_ptr = GET_OP1_ZVAL_PTR ( BP_VAR_R ) ;
2015-03-20 16:10:29 +08:00
2015-03-21 05:22:25 +08:00
if ( OP1_TYPE = = IS_CONST ) {
ZVAL_COPY ( EX_VAR ( opline - > result . var ) , retval_ptr ) ;
2015-03-24 17:48:16 +08:00
retval_ref = retval_ptr = EX_VAR ( opline - > result . var ) ;
2015-07-23 11:16:10 +08:00
} else if ( OP1_TYPE = = IS_VAR ) {
if ( UNEXPECTED ( Z_TYPE_P ( retval_ptr ) = = IS_INDIRECT ) ) {
retval_ptr = Z_INDIRECT_P ( retval_ptr ) ;
}
ZVAL_DEREF ( retval_ptr ) ;
} else if ( OP1_TYPE = = IS_CV ) {
2015-03-24 17:48:16 +08:00
ZVAL_DEREF ( retval_ptr ) ;
2015-03-21 05:22:25 +08:00
}
2017-01-13 16:37:46 +08:00
if ( UNEXPECTED ( ! ZEND_TYPE_IS_CLASS ( ret_info - > type )
& & ZEND_TYPE_CODE ( ret_info - > type ) ! = IS_CALLABLE
& & ZEND_TYPE_CODE ( ret_info - > type ) ! = IS_ITERABLE
& & ! ZEND_SAME_FAKE_TYPE ( ZEND_TYPE_CODE ( ret_info - > type ) , Z_TYPE_P ( retval_ptr ) )
2015-06-20 19:57:37 +08:00
& & ! ( EX ( func ) - > op_array . fn_flags & ZEND_ACC_RETURN_REFERENCE )
& & retval_ref ! = retval_ptr )
) {
/* A cast might happen - unwrap the reference if this is a by-value return */
if ( Z_REFCOUNT_P ( retval_ref ) = = 1 ) {
ZVAL_UNREF ( retval_ref ) ;
2015-03-20 05:47:43 +08:00
} else {
2015-06-20 19:57:37 +08:00
Z_DELREF_P ( retval_ref ) ;
ZVAL_COPY ( retval_ref , retval_ptr ) ;
2015-03-20 05:47:43 +08:00
}
2015-06-20 19:57:37 +08:00
retval_ptr = retval_ref ;
2015-03-19 06:10:08 +08:00
}
2015-06-17 17:07:43 +08:00
zend_verify_return_type ( EX ( func ) , retval_ptr , CACHE_ADDR ( opline - > op2 . num ) ) ;
2015-02-03 04:07:46 +08:00
# endif
2015-01-09 04:40:36 +08:00
}
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2015-01-09 04:40:36 +08:00
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_HANDLER ( 62 , ZEND_RETURN , CONST | TMP | VAR | CV , ANY )
2010-04-22 19:56:45 +08:00
{
USE_OPLINE
zval * retval_ptr ;
2016-04-05 21:45:15 +08:00
zval * return_value ;
2010-04-22 19:56:45 +08:00
zend_free_op free_op1 ;
2015-04-16 01:53:27 +08:00
retval_ptr = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2016-04-05 21:45:15 +08:00
return_value = EX ( return_value ) ;
2015-04-16 01:53:27 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( retval_ptr ) = = IS_UNDEF ) ) {
SAVE_OPLINE ( ) ;
retval_ptr = GET_OP1_UNDEF_CV ( retval_ptr , BP_VAR_R ) ;
2016-04-05 21:45:15 +08:00
if ( return_value ) {
ZVAL_NULL ( return_value ) ;
2015-05-21 03:51:45 +08:00
}
2016-04-05 21:45:15 +08:00
} else if ( ! return_value ) {
2016-02-15 11:12:04 +08:00
if ( OP1_TYPE & ( IS_VAR | IS_TMP_VAR ) ) {
2015-04-16 01:53:27 +08:00
if ( Z_REFCOUNTED_P ( free_op1 ) & & ! Z_DELREF_P ( free_op1 ) ) {
SAVE_OPLINE ( ) ;
2016-05-06 15:09:04 +08:00
zval_dtor_func ( Z_COUNTED_P ( free_op1 ) ) ;
2015-04-16 01:53:27 +08:00
}
}
2013-03-13 21:51:10 +08:00
} else {
2016-02-15 11:12:04 +08:00
if ( ( OP1_TYPE & ( IS_CONST | IS_TMP_VAR ) ) ) {
2016-04-05 21:45:15 +08:00
ZVAL_COPY_VALUE ( return_value , retval_ptr ) ;
2014-06-03 07:54:03 +08:00
if ( OP1_TYPE = = IS_CONST ) {
2016-04-06 01:09:14 +08:00
if ( UNEXPECTED ( Z_OPT_REFCOUNTED_P ( return_value ) ) ) {
Z_ADDREF_P ( return_value ) ;
2014-06-05 20:04:11 +08:00
}
2013-03-13 21:51:10 +08:00
}
2015-04-03 06:32:20 +08:00
} else if ( OP1_TYPE = = IS_CV ) {
2016-04-05 21:45:15 +08:00
if ( Z_OPT_REFCOUNTED_P ( retval_ptr ) ) {
if ( EXPECTED ( ! Z_OPT_ISREF_P ( retval_ptr ) ) ) {
ZVAL_COPY_VALUE ( return_value , retval_ptr ) ;
if ( EXPECTED ( ! ( EX_CALL_INFO ( ) & ZEND_CALL_CODE ) ) ) {
ZVAL_NULL ( retval_ptr ) ;
} else {
Z_ADDREF_P ( return_value ) ;
}
} else {
retval_ptr = Z_REFVAL_P ( retval_ptr ) ;
ZVAL_COPY ( return_value , retval_ptr ) ;
}
} else {
ZVAL_COPY_VALUE ( return_value , retval_ptr ) ;
}
2015-04-03 06:32:20 +08:00
} else /* if (OP1_TYPE == IS_VAR) */ {
if ( UNEXPECTED ( Z_ISREF_P ( retval_ptr ) ) ) {
zend_refcounted * ref = Z_COUNTED_P ( retval_ptr ) ;
retval_ptr = Z_REFVAL_P ( retval_ptr ) ;
2016-04-05 21:45:15 +08:00
ZVAL_COPY_VALUE ( return_value , retval_ptr ) ;
2017-10-27 06:28:58 +08:00
if ( UNEXPECTED ( GC_DELREF ( ref ) = = 0 ) ) {
2015-04-03 06:32:20 +08:00
efree_size ( ref , sizeof ( zend_reference ) ) ;
} else if ( Z_OPT_REFCOUNTED_P ( retval_ptr ) ) {
Z_ADDREF_P ( retval_ptr ) ;
}
} else {
2016-04-05 21:45:15 +08:00
ZVAL_COPY_VALUE ( return_value , retval_ptr ) ;
2013-05-17 17:15:09 +08:00
}
2010-04-22 19:56:45 +08:00
}
}
2012-11-22 19:17:05 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_leave_helper ) ;
2010-04-22 19:56:45 +08:00
}
2015-12-11 05:47:02 +08:00
ZEND_VM_HANDLER ( 111 , ZEND_RETURN_BY_REF , CONST | TMP | VAR | CV , ANY , SRC )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zval * retval_ptr ;
zend_free_op free_op1 ;
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2004-10-23 05:42:14 +08:00
2010-04-22 19:56:45 +08:00
do {
2016-02-15 11:12:04 +08:00
if ( ( OP1_TYPE & ( IS_CONST | IS_TMP_VAR ) ) | |
2013-11-28 00:30:35 +08:00
( OP1_TYPE = = IS_VAR & & opline - > extended_value = = ZEND_RETURNS_VALUE ) ) {
2004-10-23 05:42:14 +08:00
/* Not supposed to happen, but we'll allow it */
2005-07-12 02:44:37 +08:00
zend_error ( E_NOTICE , " Only variable references should be returned by reference " ) ;
2010-04-22 19:56:45 +08:00
retval_ptr = GET_OP1_ZVAL_PTR ( BP_VAR_R ) ;
2014-02-12 18:29:51 +08:00
if ( ! EX ( return_value ) ) {
2016-04-10 19:01:54 +08:00
FREE_OP1 ( ) ;
2010-04-22 19:56:45 +08:00
} else {
2016-04-10 19:01:54 +08:00
if ( OP1_TYPE = = IS_VAR & & UNEXPECTED ( Z_ISREF_P ( retval_ptr ) ) ) {
ZVAL_COPY_VALUE ( EX ( return_value ) , retval_ptr ) ;
break ;
}
ZVAL_NEW_REF ( EX ( return_value ) , retval_ptr ) ;
if ( OP1_TYPE = = IS_CONST ) {
2017-11-01 10:25:10 +08:00
Z_TRY_ADDREF_P ( retval_ptr ) ;
2014-06-03 06:43:53 +08:00
}
2010-04-22 19:56:45 +08:00
}
break ;
2004-10-23 05:42:14 +08:00
}
2014-03-04 16:27:50 +08:00
retval_ptr = GET_OP1_ZVAL_PTR_PTR ( BP_VAR_W ) ;
2004-10-23 05:42:14 +08:00
2014-10-23 01:45:02 +08:00
if ( OP1_TYPE = = IS_VAR ) {
if ( retval_ptr = = & EG ( uninitialized_zval ) | |
2016-04-10 19:01:54 +08:00
( opline - > extended_value = = ZEND_RETURNS_FUNCTION & & ! Z_ISREF_P ( retval_ptr ) ) ) {
2014-03-04 16:27:50 +08:00
zend_error ( E_NOTICE , " Only variable references should be returned by reference " ) ;
if ( EX ( return_value ) ) {
2014-09-22 20:17:35 +08:00
ZVAL_NEW_REF ( EX ( return_value ) , retval_ptr ) ;
2016-04-10 19:01:54 +08:00
} else {
FREE_OP1_VAR_PTR ( ) ;
2014-03-04 16:27:50 +08:00
}
break ;
2014-03-07 16:25:55 +08:00
}
2004-10-23 05:42:14 +08:00
}
2014-02-12 18:29:51 +08:00
if ( EX ( return_value ) ) {
2017-12-26 18:30:25 +08:00
if ( Z_ISREF_P ( retval_ptr ) ) {
Z_ADDREF_P ( retval_ptr ) ;
} else {
ZVAL_MAKE_REF_EX ( retval_ptr , 2 ) ;
}
2014-06-05 20:04:11 +08:00
ZVAL_REF ( EX ( return_value ) , Z_REF_P ( retval_ptr ) ) ;
2008-04-11 17:43:28 +08:00
}
2016-04-10 19:01:54 +08:00
FREE_OP1_VAR_PTR ( ) ;
2010-04-22 19:56:45 +08:00
} while ( 0 ) ;
2004-10-23 05:42:14 +08:00
2012-11-22 19:17:05 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_leave_helper ) ;
2004-10-23 05:42:14 +08:00
}
2016-05-13 06:40:15 +08:00
ZEND_VM_HANDLER ( 41 , ZEND_GENERATOR_CREATE , ANY , ANY )
{
zval * return_value = EX ( return_value ) ;
if ( EXPECTED ( return_value ) ) {
USE_OPLINE
zend_generator * generator ;
zend_execute_data * gen_execute_data ;
uint32_t num_args , used_stack , call_info ;
object_init_ex ( return_value , zend_ce_generator ) ;
/*
* Normally the execute_data is allocated on the VM stack ( because it does
* not actually do any allocation and thus is faster ) . For generators
* though this behavior would be suboptimal , because the ( rather large )
* structure would have to be copied back and forth every time execution is
* suspended or resumed . That ' s why for generators the execution context
* is allocated on heap .
*/
num_args = EX_NUM_ARGS ( ) ;
2017-01-16 02:26:15 +08:00
if ( EXPECTED ( num_args < = EX ( func ) - > op_array . num_args ) ) {
2017-01-10 03:24:21 +08:00
used_stack = ( ZEND_CALL_FRAME_SLOT + EX ( func ) - > op_array . last_var + EX ( func ) - > op_array . T ) * sizeof ( zval ) ;
gen_execute_data = ( zend_execute_data * ) emalloc ( used_stack ) ;
used_stack = ( ZEND_CALL_FRAME_SLOT + EX ( func ) - > op_array . last_var ) * sizeof ( zval ) ;
} else {
used_stack = ( ZEND_CALL_FRAME_SLOT + num_args + EX ( func ) - > op_array . last_var + EX ( func ) - > op_array . T - EX ( func ) - > op_array . num_args ) * sizeof ( zval ) ;
gen_execute_data = ( zend_execute_data * ) emalloc ( used_stack ) ;
}
2016-05-13 06:40:15 +08:00
memcpy ( gen_execute_data , execute_data , used_stack ) ;
/* Save execution context in generator object. */
generator = ( zend_generator * ) Z_OBJ_P ( EX ( return_value ) ) ;
generator - > execute_data = gen_execute_data ;
generator - > frozen_call_stack = NULL ;
2016-05-31 05:04:52 +08:00
generator - > execute_fake . opline = NULL ;
generator - > execute_fake . func = NULL ;
generator - > execute_fake . prev_execute_data = NULL ;
2016-05-13 06:40:15 +08:00
ZVAL_OBJ ( & generator - > execute_fake . This , ( zend_object * ) generator ) ;
gen_execute_data - > opline = opline + 1 ;
/* EX(return_value) keeps pointer to zend_object (not a real zval) */
gen_execute_data - > return_value = ( zval * ) generator ;
call_info = Z_TYPE_INFO ( EX ( This ) ) ;
if ( ( call_info & Z_TYPE_MASK ) = = IS_OBJECT
2016-07-01 18:50:35 +08:00
& & ( ! ( call_info & ( ( ZEND_CALL_CLOSURE | ZEND_CALL_RELEASE_THIS ) < < ZEND_CALL_INFO_SHIFT ) )
/* Bug #72523 */
| | UNEXPECTED ( zend_execute_ex ! = execute_ex ) ) ) {
2016-05-13 06:40:15 +08:00
ZEND_ADD_CALL_FLAG_EX ( call_info , ZEND_CALL_RELEASE_THIS ) ;
Z_ADDREF ( gen_execute_data - > This ) ;
}
2016-05-16 17:42:13 +08:00
ZEND_ADD_CALL_FLAG_EX ( call_info , ( ZEND_CALL_TOP_FUNCTION | ZEND_CALL_ALLOCATED | ZEND_CALL_GENERATOR ) ) ;
2016-05-13 06:40:15 +08:00
Z_TYPE_INFO ( gen_execute_data - > This ) = call_info ;
gen_execute_data - > prev_execute_data = NULL ;
call_info = EX_CALL_INFO ( ) ;
EG ( current_execute_data ) = EX ( prev_execute_data ) ;
if ( EXPECTED ( ! ( call_info & ( ZEND_CALL_TOP | ZEND_CALL_ALLOCATED ) ) ) ) {
EG ( vm_stack_top ) = ( zval * ) execute_data ;
execute_data = EX ( prev_execute_data ) ;
LOAD_NEXT_OPLINE ( ) ;
ZEND_VM_LEAVE ( ) ;
} else if ( EXPECTED ( ! ( call_info & ZEND_CALL_TOP ) ) ) {
zend_execute_data * old_execute_data = execute_data ;
execute_data = EX ( prev_execute_data ) ;
zend_vm_stack_free_call_frame_ex ( call_info , old_execute_data ) ;
LOAD_NEXT_OPLINE ( ) ;
ZEND_VM_LEAVE ( ) ;
} else {
ZEND_VM_RETURN ( ) ;
}
} else {
ZEND_VM_DISPATCH_TO_HELPER ( zend_leave_helper ) ;
}
}
2015-02-20 03:17:37 +08:00
ZEND_VM_HANDLER ( 161 , ZEND_GENERATOR_RETURN , CONST | TMP | VAR | CV , ANY )
2012-08-24 19:51:39 +08:00
{
2015-02-20 03:17:37 +08:00
USE_OPLINE
zval * retval ;
zend_free_op free_op1 ;
2017-06-16 06:42:49 +08:00
zend_generator * generator = zend_get_running_generator ( EXECUTE_DATA_C ) ;
2012-12-11 21:25:32 +08:00
2015-02-20 03:17:37 +08:00
SAVE_OPLINE ( ) ;
retval = GET_OP1_ZVAL_PTR ( BP_VAR_R ) ;
/* Copy return value into generator->retval */
2016-02-15 11:12:04 +08:00
if ( ( OP1_TYPE & ( IS_CONST | IS_TMP_VAR ) ) ) {
2015-02-20 03:17:37 +08:00
ZVAL_COPY_VALUE ( & generator - > retval , retval ) ;
if ( OP1_TYPE = = IS_CONST ) {
2016-04-06 01:09:14 +08:00
if ( UNEXPECTED ( Z_OPT_REFCOUNTED ( generator - > retval ) ) ) {
Z_ADDREF ( generator - > retval ) ;
2015-02-20 03:17:37 +08:00
}
}
2015-04-03 06:32:20 +08:00
} else if ( OP1_TYPE = = IS_CV ) {
ZVAL_DEREF ( retval ) ;
2015-04-04 16:38:00 +08:00
ZVAL_COPY ( & generator - > retval , retval ) ;
2015-04-03 06:32:20 +08:00
} else /* if (OP1_TYPE == IS_VAR) */ {
if ( UNEXPECTED ( Z_ISREF_P ( retval ) ) ) {
zend_refcounted * ref = Z_COUNTED_P ( retval ) ;
retval = Z_REFVAL_P ( retval ) ;
ZVAL_COPY_VALUE ( & generator - > retval , retval ) ;
2017-10-27 06:28:58 +08:00
if ( UNEXPECTED ( GC_DELREF ( ref ) = = 0 ) ) {
2015-04-03 06:32:20 +08:00
efree_size ( ref , sizeof ( zend_reference ) ) ;
} else if ( Z_OPT_REFCOUNTED_P ( retval ) ) {
Z_ADDREF_P ( retval ) ;
}
} else {
ZVAL_COPY_VALUE ( & generator - > retval , retval ) ;
2015-02-20 03:17:37 +08:00
}
}
2012-12-11 21:25:32 +08:00
/* Close the generator to free up resources */
2014-12-14 06:06:14 +08:00
zend_generator_close ( generator , 1 ) ;
2012-12-11 21:25:32 +08:00
/* Pass execution back to handling code */
ZEND_VM_RETURN ( ) ;
2012-08-24 19:51:39 +08:00
}
2005-06-16 22:20:00 +08:00
ZEND_VM_HANDLER ( 108 , ZEND_THROW , CONST | TMP | VAR | CV , ANY )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zval * value ;
zend_free_op free_op1 ;
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2015-06-05 06:53:32 +08:00
value = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2004-10-23 05:42:14 +08:00
2014-12-08 23:11:14 +08:00
do {
if ( OP1_TYPE = = IS_CONST | | UNEXPECTED ( Z_TYPE_P ( value ) ! = IS_OBJECT ) ) {
if ( ( OP1_TYPE & ( IS_VAR | IS_CV ) ) & & Z_ISREF_P ( value ) ) {
value = Z_REFVAL_P ( value ) ;
if ( EXPECTED ( Z_TYPE_P ( value ) = = IS_OBJECT ) ) {
break ;
}
}
2015-06-05 06:53:32 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( value ) = = IS_UNDEF ) ) {
GET_OP1_UNDEF_CV ( value , BP_VAR_R ) ;
2015-09-08 22:20:52 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
HANDLE_EXCEPTION ( ) ;
}
2014-12-08 23:11:14 +08:00
}
2015-07-08 01:10:22 +08:00
zend_throw_error ( NULL , " Can only throw objects " ) ;
2015-03-09 20:57:15 +08:00
FREE_OP1 ( ) ;
HANDLE_EXCEPTION ( ) ;
2013-02-16 22:22:22 +08:00
}
2014-12-08 23:11:14 +08:00
} while ( 0 ) ;
2013-02-16 22:22:22 +08:00
2014-12-14 06:06:14 +08:00
zend_exception_save ( ) ;
2014-05-07 02:02:26 +08:00
if ( OP1_TYPE ! = IS_TMP_VAR ) {
2017-11-01 10:25:10 +08:00
Z_TRY_ADDREF_P ( value ) ;
2004-10-23 05:42:14 +08:00
}
2014-12-14 06:06:14 +08:00
zend_throw_exception_object ( value ) ;
zend_exception_restore ( ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1_IF_VAR ( ) ;
2010-04-20 19:16:39 +08:00
HANDLE_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 107 , ZEND_CATCH , CONST , JMP_ADDR , LAST_CATCH | CACHE_SLOT )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
zend_class_entry * ce , * catch_ce ;
2014-02-10 14:04:30 +08:00
zend_object * exception ;
2016-07-20 16:59:14 +08:00
zval * ex ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2004-10-23 05:42:14 +08:00
/* Check whether an exception has been thrown, if not, jump over code */
2014-12-14 06:06:14 +08:00
zend_exception_restore ( ) ;
2004-10-23 05:42:14 +08:00
if ( EG ( exception ) = = NULL ) {
2018-02-01 03:39:30 +08:00
ZEND_VM_SET_OPCODE ( OP_JMP_ADDR ( opline , opline - > op2 ) ) ;
2015-10-30 19:53:53 +08:00
ZEND_VM_CONTINUE ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
catch_ce = CACHED_PTR ( opline - > extended_value & ~ ZEND_LAST_CATCH ) ;
2015-08-28 04:02:15 +08:00
if ( UNEXPECTED ( catch_ce = = NULL ) ) {
2017-10-04 21:53:01 +08:00
catch_ce = zend_fetch_class_by_name ( Z_STR_P ( RT_CONSTANT ( opline , opline - > op1 ) ) , RT_CONSTANT ( opline , opline - > op1 ) + 1 , ZEND_FETCH_CLASS_NO_AUTOLOAD ) ;
2012-05-13 13:12:48 +08:00
2018-02-06 00:41:47 +08:00
CACHE_PTR ( opline - > extended_value & ~ ZEND_LAST_CATCH , catch_ce ) ;
2010-05-24 22:11:39 +08:00
}
2014-10-09 20:17:30 +08:00
ce = EG ( exception ) - > ce ;
2010-04-24 21:32:30 +08:00
# ifdef HAVE_DTRACE
if ( DTRACE_EXCEPTION_CAUGHT_ENABLED ( ) ) {
2013-08-14 11:42:39 +08:00
DTRACE_EXCEPTION_CAUGHT ( ( char * ) ce - > name ) ;
2010-04-24 21:32:30 +08:00
}
# endif /* HAVE_DTRACE */
2010-04-20 19:16:39 +08:00
if ( ce ! = catch_ce ) {
2015-01-14 20:06:26 +08:00
if ( ! catch_ce | | ! instanceof_function ( ce , catch_ce ) ) {
2018-02-06 00:41:47 +08:00
if ( opline - > extended_value & ZEND_LAST_CATCH ) {
2016-12-12 15:55:32 +08:00
zend_rethrow_exception ( execute_data ) ;
2010-04-20 19:16:39 +08:00
HANDLE_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-01 03:39:30 +08:00
ZEND_VM_SET_OPCODE ( OP_JMP_ADDR ( opline , opline - > op2 ) ) ;
2015-10-30 19:53:53 +08:00
ZEND_VM_CONTINUE ( ) ;
2004-10-23 05:42:14 +08:00
}
}
2010-05-24 22:46:31 +08:00
exception = EG ( exception ) ;
2018-02-01 03:39:30 +08:00
ex = EX_VAR ( opline - > result . var ) ;
2016-07-20 16:59:14 +08:00
if ( UNEXPECTED ( Z_ISREF_P ( ex ) ) ) {
ex = Z_REFVAL_P ( ex ) ;
}
2016-07-20 17:01:42 +08:00
zval_ptr_dtor ( ex ) ;
2016-07-20 16:59:14 +08:00
ZVAL_OBJ ( ex , EG ( exception ) ) ;
2010-05-24 22:46:31 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = exception ) ) {
2017-10-27 06:28:58 +08:00
GC_ADDREF ( EG ( exception ) ) ;
2010-05-24 22:46:31 +08:00
HANDLE_EXCEPTION ( ) ;
} else {
EG ( exception ) = NULL ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2004-10-23 05:42:14 +08:00
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_HANDLER ( 65 , ZEND_SEND_VAL , CONST | TMPVAR , NUM )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2014-06-30 19:43:45 +08:00
zval * value , * arg ;
2014-04-22 16:33:00 +08:00
zend_free_op free_op1 ;
2010-04-20 19:16:39 +08:00
2014-07-08 06:13:53 +08:00
value = GET_OP1_ZVAL_PTR ( BP_VAR_R ) ;
2014-12-16 23:40:52 +08:00
arg = ZEND_CALL_VAR ( EX ( call ) , opline - > result . var ) ;
2014-07-08 06:13:53 +08:00
ZVAL_COPY_VALUE ( arg , value ) ;
if ( OP1_TYPE = = IS_CONST ) {
2016-04-06 01:09:14 +08:00
if ( UNEXPECTED ( Z_OPT_REFCOUNTED_P ( arg ) ) ) {
Z_ADDREF_P ( arg ) ;
2013-08-29 17:35:11 +08:00
}
2004-10-23 05:42:14 +08:00
}
2014-07-08 06:13:53 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
}
2013-08-29 17:35:11 +08:00
2018-02-21 17:07:29 +08:00
ZEND_VM_COLD_HELPER ( zend_cannot_pass_by_ref_helper , ANY , ANY )
2018-02-16 07:45:31 +08:00
{
USE_OPLINE
zval * arg ;
uint32_t arg_num = opline - > op2 . num ;
SAVE_OPLINE ( ) ;
zend_throw_error ( NULL , " Cannot pass parameter %d by reference " , arg_num ) ;
FREE_UNFETCHED_OP1 ( ) ;
arg = ZEND_CALL_VAR ( EX ( call ) , opline - > result . var ) ;
ZVAL_UNDEF ( arg ) ;
HANDLE_EXCEPTION ( ) ;
}
2018-02-15 18:48:04 +08:00
ZEND_VM_HOT_SEND_HANDLER ( 116 , ZEND_SEND_VAL_EX , CONST | TMP , NUM , SPEC ( QUICK_ARG ) )
2014-07-08 06:13:53 +08:00
{
USE_OPLINE
zval * value , * arg ;
zend_free_op free_op1 ;
2015-09-11 19:13:41 +08:00
uint32_t arg_num = opline - > op2 . num ;
2014-07-08 06:13:53 +08:00
2015-09-11 19:13:41 +08:00
if ( EXPECTED ( arg_num < = MAX_ARG_FLAG_NUM ) ) {
if ( QUICK_ARG_MUST_BE_SENT_BY_REF ( EX ( call ) - > func , arg_num ) ) {
2015-04-23 02:46:13 +08:00
ZEND_VM_C_GOTO ( send_val_by_ref ) ;
}
2015-09-11 19:13:41 +08:00
} else if ( ARG_MUST_BE_SENT_BY_REF ( EX ( call ) - > func , arg_num ) ) {
2015-04-23 02:46:13 +08:00
ZEND_VM_C_LABEL ( send_val_by_ref ) :
2018-02-16 07:45:31 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_cannot_pass_by_ref_helper ) ;
2014-07-08 06:13:53 +08:00
}
2014-04-22 16:33:00 +08:00
value = GET_OP1_ZVAL_PTR ( BP_VAR_R ) ;
2014-12-16 23:40:52 +08:00
arg = ZEND_CALL_VAR ( EX ( call ) , opline - > result . var ) ;
2014-06-30 19:43:45 +08:00
ZVAL_COPY_VALUE ( arg , value ) ;
2014-04-22 16:33:00 +08:00
if ( OP1_TYPE = = IS_CONST ) {
2016-04-06 01:09:14 +08:00
if ( UNEXPECTED ( Z_OPT_REFCOUNTED_P ( arg ) ) ) {
Z_ADDREF_P ( arg ) ;
2014-06-05 20:04:11 +08:00
}
2004-10-23 05:42:14 +08:00
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_HANDLER ( 117 , ZEND_SEND_VAR , VAR | CV , NUM )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2014-06-30 19:43:45 +08:00
zval * varptr , * arg ;
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 ;
2015-04-16 01:53:27 +08:00
varptr = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( varptr ) = = IS_UNDEF ) ) {
SAVE_OPLINE ( ) ;
2015-07-08 23:33:58 +08:00
GET_OP1_UNDEF_CV ( varptr , BP_VAR_R ) ;
arg = ZEND_CALL_VAR ( EX ( call ) , opline - > result . var ) ;
ZVAL_NULL ( arg ) ;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2015-04-16 01:53:27 +08:00
}
2015-07-08 23:33:58 +08:00
2014-12-16 23:40:52 +08:00
arg = ZEND_CALL_VAR ( EX ( call ) , opline - > result . var ) ;
2015-04-03 06:32:20 +08:00
if ( OP1_TYPE = = IS_CV ) {
2015-07-10 16:39:21 +08:00
ZVAL_OPT_DEREF ( varptr ) ;
2015-04-03 06:32:20 +08:00
ZVAL_COPY ( arg , varptr ) ;
} else /* if (OP1_TYPE == IS_VAR) */ {
if ( UNEXPECTED ( Z_ISREF_P ( varptr ) ) ) {
zend_refcounted * ref = Z_COUNTED_P ( varptr ) ;
varptr = Z_REFVAL_P ( varptr ) ;
ZVAL_COPY_VALUE ( arg , varptr ) ;
2017-10-27 06:28:58 +08:00
if ( UNEXPECTED ( GC_DELREF ( ref ) = = 0 ) ) {
2015-04-03 06:32:20 +08:00
efree_size ( ref , sizeof ( zend_reference ) ) ;
} else if ( Z_OPT_REFCOUNTED_P ( arg ) ) {
Z_ADDREF_P ( arg ) ;
}
} else {
ZVAL_COPY_VALUE ( arg , varptr ) ;
2014-04-05 06:14:17 +08:00
}
2004-10-23 05:42:14 +08:00
}
2015-04-03 06:32:20 +08:00
2004-10-23 05:42:14 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
}
2016-05-31 09:06:00 +08:00
ZEND_VM_HANDLER ( 106 , ZEND_SEND_VAR_NO_REF , VAR , NUM )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2005-09-20 00:02:21 +08:00
zend_free_op free_op1 ;
2014-06-30 19:43:45 +08:00
zval * varptr , * arg ;
2005-09-20 00:02:21 +08:00
2015-07-08 23:33:58 +08:00
varptr = GET_OP1_ZVAL_PTR ( BP_VAR_R ) ;
2016-06-06 20:50:06 +08:00
arg = ZEND_CALL_VAR ( EX ( call ) , opline - > result . var ) ;
ZVAL_COPY_VALUE ( arg , varptr ) ;
2015-07-08 23:33:58 +08:00
2016-05-31 09:06:00 +08:00
if ( EXPECTED ( Z_ISREF_P ( varptr ) ) ) {
2016-04-17 02:27:53 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
2014-03-05 03:54:05 +08:00
}
2014-11-18 19:37:36 +08:00
2016-04-17 02:27:53 +08:00
SAVE_OPLINE ( ) ;
zend_error ( E_NOTICE , " Only variables should be passed by reference " ) ;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-03-23 18:59:47 +08:00
ZEND_VM_HOT_SEND_HANDLER ( 50 , ZEND_SEND_VAR_NO_REF_EX , VAR , NUM , SPEC ( QUICK_ARG ) )
2016-05-31 09:06:00 +08:00
{
USE_OPLINE
zend_free_op free_op1 ;
zval * varptr , * arg ;
uint32_t arg_num = opline - > op2 . num ;
if ( EXPECTED ( arg_num < = MAX_ARG_FLAG_NUM ) ) {
if ( ! QUICK_ARG_SHOULD_BE_SENT_BY_REF ( EX ( call ) - > func , arg_num ) ) {
ZEND_VM_DISPATCH_TO_HANDLER ( ZEND_SEND_VAR ) ;
}
varptr = GET_OP1_ZVAL_PTR ( BP_VAR_R ) ;
2016-06-06 20:50:06 +08:00
arg = ZEND_CALL_VAR ( EX ( call ) , opline - > result . var ) ;
ZVAL_COPY_VALUE ( arg , varptr ) ;
2016-05-31 09:06:00 +08:00
if ( EXPECTED ( Z_ISREF_P ( varptr ) | |
QUICK_ARG_MAY_BE_SENT_BY_REF ( EX ( call ) - > func , arg_num ) ) ) {
ZEND_VM_NEXT_OPCODE ( ) ;
}
} else {
if ( ! ARG_SHOULD_BE_SENT_BY_REF ( EX ( call ) - > func , arg_num ) ) {
ZEND_VM_DISPATCH_TO_HANDLER ( ZEND_SEND_VAR ) ;
}
varptr = GET_OP1_ZVAL_PTR ( BP_VAR_R ) ;
2016-06-06 20:50:06 +08:00
arg = ZEND_CALL_VAR ( EX ( call ) , opline - > result . var ) ;
ZVAL_COPY_VALUE ( arg , varptr ) ;
2016-05-31 09:06:00 +08:00
if ( EXPECTED ( Z_ISREF_P ( varptr ) | |
ARG_MAY_BE_SENT_BY_REF ( EX ( call ) - > func , arg_num ) ) ) {
ZEND_VM_NEXT_OPCODE ( ) ;
}
}
SAVE_OPLINE ( ) ;
zend_error ( E_NOTICE , " Only variables should be passed by reference " ) ;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
}
2015-10-29 04:25:05 +08:00
ZEND_VM_HANDLER ( 67 , ZEND_SEND_REF , VAR | CV , NUM )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 ;
2014-06-30 19:43:45 +08:00
zval * varptr , * arg ;
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2014-03-04 16:27:50 +08:00
varptr = GET_OP1_ZVAL_PTR_PTR ( BP_VAR_W ) ;
2004-10-23 05:42:14 +08:00
2014-12-16 23:40:52 +08:00
arg = ZEND_CALL_VAR ( EX ( call ) , opline - > result . var ) ;
2016-02-01 16:12:28 +08:00
if ( OP1_TYPE = = IS_VAR & & UNEXPECTED ( Z_ISERROR_P ( varptr ) ) ) {
2016-06-07 06:14:53 +08:00
ZVAL_NEW_EMPTY_REF ( arg ) ;
ZVAL_NULL ( Z_REFVAL_P ( arg ) ) ;
2011-03-16 19:14:33 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
2010-07-05 17:08:35 +08:00
}
2014-03-13 04:30:53 +08:00
if ( Z_ISREF_P ( varptr ) ) {
2014-03-11 18:49:25 +08:00
Z_ADDREF_P ( varptr ) ;
2014-03-13 04:30:53 +08:00
} else {
2017-12-26 18:30:25 +08:00
ZVAL_MAKE_REF_EX ( varptr , 2 ) ;
2014-03-11 18:49:25 +08:00
}
2017-12-26 18:30:25 +08:00
ZVAL_REF ( arg , Z_REF_P ( varptr ) ) ;
2014-04-11 16:43:22 +08:00
2004-10-23 05:42:14 +08:00
FREE_OP1_VAR_PTR ( ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2018-02-15 18:48:04 +08:00
ZEND_VM_HOT_SEND_HANDLER ( 66 , ZEND_SEND_VAR_EX , VAR | CV , NUM , SPEC ( QUICK_ARG ) )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2014-06-30 19:43:45 +08:00
zval * varptr , * arg ;
2014-04-22 16:33:00 +08:00
zend_free_op free_op1 ;
2015-09-11 19:13:41 +08:00
uint32_t arg_num = opline - > op2 . num ;
2004-10-23 05:42:14 +08:00
2015-09-11 19:13:41 +08:00
if ( EXPECTED ( arg_num < = MAX_ARG_FLAG_NUM ) ) {
if ( QUICK_ARG_SHOULD_BE_SENT_BY_REF ( EX ( call ) - > func , arg_num ) ) {
2015-04-23 02:46:13 +08:00
ZEND_VM_C_GOTO ( send_var_by_ref ) ;
}
2015-09-11 19:13:41 +08:00
} else if ( ARG_SHOULD_BE_SENT_BY_REF ( EX ( call ) - > func , arg_num ) ) {
2015-04-23 02:46:13 +08:00
ZEND_VM_C_LABEL ( send_var_by_ref ) :
2014-07-08 06:13:53 +08:00
ZEND_VM_DISPATCH_TO_HANDLER ( ZEND_SEND_REF ) ;
2004-10-23 05:42:14 +08:00
}
2015-04-16 01:53:27 +08:00
varptr = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( varptr ) = = IS_UNDEF ) ) {
SAVE_OPLINE ( ) ;
2015-07-08 23:33:58 +08:00
GET_OP1_UNDEF_CV ( varptr , BP_VAR_R ) ;
arg = ZEND_CALL_VAR ( EX ( call ) , opline - > result . var ) ;
ZVAL_NULL ( arg ) ;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2015-04-16 01:53:27 +08:00
}
2015-07-08 23:33:58 +08:00
2014-12-16 23:40:52 +08:00
arg = ZEND_CALL_VAR ( EX ( call ) , opline - > result . var ) ;
2015-04-03 06:32:20 +08:00
if ( OP1_TYPE = = IS_CV ) {
2015-07-10 16:39:21 +08:00
ZVAL_OPT_DEREF ( varptr ) ;
2015-04-03 06:32:20 +08:00
ZVAL_COPY ( arg , varptr ) ;
} else /* if (OP1_TYPE == IS_VAR) */ {
if ( UNEXPECTED ( Z_ISREF_P ( varptr ) ) ) {
zend_refcounted * ref = Z_COUNTED_P ( varptr ) ;
varptr = Z_REFVAL_P ( varptr ) ;
ZVAL_COPY_VALUE ( arg , varptr ) ;
2017-10-27 06:28:58 +08:00
if ( UNEXPECTED ( GC_DELREF ( ref ) = = 0 ) ) {
2015-04-03 06:32:20 +08:00
efree_size ( ref , sizeof ( zend_reference ) ) ;
} else if ( Z_OPT_REFCOUNTED_P ( arg ) ) {
Z_ADDREF_P ( arg ) ;
}
} else {
ZVAL_COPY_VALUE ( arg , varptr ) ;
2014-04-22 16:33:00 +08:00
}
}
2015-04-03 06:32:20 +08:00
2014-04-22 16:33:00 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-15 18:48:04 +08:00
ZEND_VM_HOT_SEND_HANDLER ( 100 , ZEND_CHECK_FUNC_ARG , UNUSED , NUM , SPEC ( QUICK_ARG ) )
2018-02-06 00:40:06 +08:00
{
USE_OPLINE
uint32_t arg_num = opline - > op2 . num ;
if ( EXPECTED ( arg_num < = MAX_ARG_FLAG_NUM ) ) {
if ( QUICK_ARG_SHOULD_BE_SENT_BY_REF ( EX ( call ) - > func , arg_num ) ) {
ZEND_ADD_CALL_FLAG ( EX ( call ) , ZEND_CALL_SEND_ARG_BY_REF ) ;
} else {
ZEND_DEL_CALL_FLAG ( EX ( call ) , ZEND_CALL_SEND_ARG_BY_REF ) ;
}
} else if ( ARG_SHOULD_BE_SENT_BY_REF ( EX ( call ) - > func , arg_num ) ) {
ZEND_ADD_CALL_FLAG ( EX ( call ) , ZEND_CALL_SEND_ARG_BY_REF ) ;
} else {
ZEND_DEL_CALL_FLAG ( EX ( call ) , ZEND_CALL_SEND_ARG_BY_REF ) ;
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
ZEND_VM_HOT_HANDLER ( 185 , ZEND_SEND_FUNC_ARG , VAR , NUM )
{
USE_OPLINE
zval * varptr , * arg ;
zend_free_op free_op1 ;
if ( UNEXPECTED ( ZEND_CALL_INFO ( EX ( call ) ) & ZEND_CALL_SEND_ARG_BY_REF ) ) {
ZEND_VM_DISPATCH_TO_HANDLER ( ZEND_SEND_REF ) ;
}
varptr = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
arg = ZEND_CALL_VAR ( EX ( call ) , opline - > result . var ) ;
2018-02-06 01:43:08 +08:00
if ( UNEXPECTED ( Z_ISREF_P ( varptr ) ) ) {
zend_refcounted * ref = Z_COUNTED_P ( varptr ) ;
2018-02-06 00:40:06 +08:00
2018-02-06 01:43:08 +08:00
varptr = Z_REFVAL_P ( varptr ) ;
ZVAL_COPY_VALUE ( arg , varptr ) ;
if ( UNEXPECTED ( GC_DELREF ( ref ) = = 0 ) ) {
efree_size ( ref , sizeof ( zend_reference ) ) ;
} else if ( Z_OPT_REFCOUNTED_P ( arg ) ) {
Z_ADDREF_P ( arg ) ;
2018-02-06 00:40:06 +08:00
}
2018-02-06 01:43:08 +08:00
} else {
ZVAL_COPY_VALUE ( arg , varptr ) ;
2018-02-06 00:40:06 +08:00
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
2013-08-29 17:35:11 +08:00
ZEND_VM_HANDLER ( 165 , ZEND_SEND_UNPACK , ANY , ANY )
{
USE_OPLINE
zend_free_op free_op1 ;
zval * args ;
int arg_num ;
2015-03-13 01:39:04 +08:00
SAVE_OPLINE ( ) ;
2015-06-05 06:53:32 +08:00
args = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2014-11-28 15:28:49 +08:00
arg_num = ZEND_CALL_NUM_ARGS ( EX ( call ) ) + 1 ;
2013-08-29 17:35:11 +08:00
2014-03-26 22:07:31 +08:00
ZEND_VM_C_LABEL ( send_again ) :
2015-06-05 00:14:16 +08:00
if ( EXPECTED ( Z_TYPE_P ( args ) = = IS_ARRAY ) ) {
HashTable * ht = Z_ARRVAL_P ( args ) ;
zval * arg , * top ;
zend_string * name ;
zend_vm_stack_extend_call_frame ( & EX ( call ) , arg_num - 1 , zend_hash_num_elements ( ht ) ) ;
2016-04-18 19:13:54 +08:00
if ( ( OP1_TYPE & ( IS_VAR | IS_CV ) ) & & Z_REFCOUNT_P ( args ) > 1 ) {
2015-06-05 00:14:16 +08:00
uint32_t i ;
int separate = 0 ;
/* check if any of arguments are going to be passed by reference */
for ( i = 0 ; i < zend_hash_num_elements ( ht ) ; i + + ) {
if ( ARG_SHOULD_BE_SENT_BY_REF ( EX ( call ) - > func , arg_num + i ) ) {
separate = 1 ;
break ;
2014-05-29 22:21:56 +08:00
}
}
2015-06-05 00:14:16 +08:00
if ( separate ) {
2016-04-17 04:33:23 +08:00
SEPARATE_ARRAY ( args ) ;
2015-06-05 00:14:16 +08:00
ht = Z_ARRVAL_P ( args ) ;
}
}
2014-05-29 22:21:56 +08:00
2015-06-05 00:14:16 +08:00
ZEND_HASH_FOREACH_STR_KEY_VAL ( ht , name , arg ) {
if ( name ) {
2015-07-08 01:10:22 +08:00
zend_throw_error ( NULL , " Cannot unpack array with string keys " ) ;
2015-06-05 00:14:16 +08:00
FREE_OP1 ( ) ;
HANDLE_EXCEPTION ( ) ;
}
2013-08-29 17:35:11 +08:00
2015-06-05 00:14:16 +08:00
top = ZEND_CALL_ARG ( EX ( call ) , arg_num ) ;
if ( ARG_SHOULD_BE_SENT_BY_REF ( EX ( call ) - > func , arg_num ) ) {
2018-01-17 23:50:18 +08:00
if ( Z_ISREF_P ( arg ) ) {
Z_ADDREF_P ( arg ) ;
ZVAL_REF ( top , Z_REF_P ( arg ) ) ;
} else if ( OP1_TYPE & ( IS_VAR | IS_CV ) ) {
/* array is already separated above */
ZVAL_MAKE_REF_EX ( arg , 2 ) ;
2015-06-05 00:14:16 +08:00
ZVAL_REF ( top , Z_REF_P ( arg ) ) ;
2013-08-29 17:35:11 +08:00
} else {
2018-01-17 23:50:18 +08:00
Z_TRY_ADDREF_P ( arg ) ;
ZVAL_NEW_REF ( top , arg ) ;
2013-08-29 17:35:11 +08:00
}
2015-06-05 00:14:16 +08:00
} else {
2018-01-17 23:50:18 +08:00
ZVAL_DEREF ( arg ) ;
2015-06-05 00:14:16 +08:00
ZVAL_COPY ( top , arg ) ;
}
2013-08-29 17:35:11 +08:00
2015-06-05 00:14:16 +08:00
ZEND_CALL_NUM_ARGS ( EX ( call ) ) + + ;
arg_num + + ;
} ZEND_HASH_FOREACH_END ( ) ;
2014-04-19 04:08:14 +08:00
2015-06-05 00:14:16 +08:00
} else if ( EXPECTED ( Z_TYPE_P ( args ) = = IS_OBJECT ) ) {
zend_class_entry * ce = Z_OBJCE_P ( args ) ;
zend_object_iterator * iter ;
2013-08-29 17:35:11 +08:00
2015-06-05 00:14:16 +08:00
if ( ! ce | | ! ce - > get_iterator ) {
zend_error ( E_WARNING , " Only arrays and Traversables can be unpacked " ) ;
} else {
2013-08-29 17:35:11 +08:00
2014-12-14 06:06:14 +08:00
iter = ce - > get_iterator ( ce , args , 0 ) ;
2013-08-29 17:35:11 +08:00
if ( UNEXPECTED ( ! iter ) ) {
FREE_OP1 ( ) ;
if ( ! EG ( exception ) ) {
zend_throw_exception_ex (
2015-06-30 18:59:27 +08:00
NULL , 0 , " Object of type %s did not create an Iterator " , ZSTR_VAL ( ce - > name )
2013-08-29 17:35:11 +08:00
) ;
}
HANDLE_EXCEPTION ( ) ;
}
if ( iter - > funcs - > rewind ) {
2014-12-14 06:06:14 +08:00
iter - > funcs - > rewind ( iter ) ;
2013-08-29 17:35:11 +08:00
}
2014-12-14 06:06:14 +08:00
for ( ; iter - > funcs - > valid ( iter ) = = SUCCESS ; + + arg_num ) {
2014-06-30 19:43:45 +08:00
zval * arg , * top ;
2013-08-29 17:35:11 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2016-06-01 23:07:05 +08:00
break ;
2013-08-29 17:35:11 +08:00
}
2014-12-14 06:06:14 +08:00
arg = iter - > funcs - > get_current_data ( iter ) ;
2013-08-29 17:35:11 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2016-06-01 23:07:05 +08:00
break ;
2013-08-29 17:35:11 +08:00
}
if ( iter - > funcs - > get_current_key ) {
zval key ;
2014-12-14 06:06:14 +08:00
iter - > funcs - > get_current_key ( iter , & key ) ;
2013-08-29 17:35:11 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2016-06-01 23:07:05 +08:00
break ;
2013-08-29 17:35:11 +08:00
}
if ( Z_TYPE ( key ) = = IS_STRING ) {
2015-07-08 01:10:22 +08:00
zend_throw_error ( NULL ,
2013-08-29 17:35:11 +08:00
" Cannot unpack Traversable with string keys " ) ;
2014-11-25 06:22:59 +08:00
zend_string_release ( Z_STR ( key ) ) ;
2016-06-01 23:07:05 +08:00
break ;
2013-08-29 17:35:11 +08:00
}
2016-05-06 14:23:37 +08:00
zval_dtor ( & key ) ;
2013-08-29 17:35:11 +08:00
}
2014-06-30 19:43:45 +08:00
if ( ARG_MUST_BE_SENT_BY_REF ( EX ( call ) - > func , arg_num ) ) {
2013-08-29 17:35:11 +08:00
zend_error (
E_WARNING , " Cannot pass by-reference argument %d of %s%s%s() "
" by unpacking a Traversable, passing by-value instead " , arg_num ,
2015-06-30 18:59:27 +08:00
EX ( call ) - > func - > common . scope ? ZSTR_VAL ( EX ( call ) - > func - > common . scope - > name ) : " " ,
2014-06-30 19:43:45 +08:00
EX ( call ) - > func - > common . scope ? " :: " : " " ,
2015-06-30 18:59:27 +08:00
ZSTR_VAL ( EX ( call ) - > func - > common . function_name )
2013-08-29 17:35:11 +08:00
) ;
}
2015-01-03 17:22:58 +08:00
2018-01-10 03:20:31 +08:00
ZVAL_DEREF ( arg ) ;
Z_TRY_ADDREF_P ( arg ) ;
2013-08-29 17:35:11 +08:00
2014-12-14 06:06:14 +08:00
zend_vm_stack_extend_call_frame ( & EX ( call ) , arg_num - 1 , 1 ) ;
2014-06-30 19:43:45 +08:00
top = ZEND_CALL_ARG ( EX ( call ) , arg_num ) ;
ZVAL_COPY_VALUE ( top , arg ) ;
2014-11-28 15:28:49 +08:00
ZEND_CALL_NUM_ARGS ( EX ( call ) ) + + ;
2013-08-29 17:35:11 +08:00
2014-12-14 06:06:14 +08:00
iter - > funcs - > move_forward ( iter ) ;
2013-08-29 17:35:11 +08:00
}
2014-12-14 06:06:14 +08:00
zend_iterator_dtor ( iter ) ;
2013-08-29 17:35:11 +08:00
}
2015-06-05 00:14:16 +08:00
} else if ( EXPECTED ( Z_ISREF_P ( args ) ) ) {
args = Z_REFVAL_P ( args ) ;
ZEND_VM_C_GOTO ( send_again ) ;
} else {
2015-06-05 06:53:32 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( args ) = = IS_UNDEF ) ) {
GET_OP1_UNDEF_CV ( args , BP_VAR_R ) ;
}
2015-06-05 00:14:16 +08:00
zend_error ( E_WARNING , " Only arrays and Traversables can be unpacked " ) ;
2013-08-29 17:35:11 +08:00
}
FREE_OP1 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2013-08-29 17:35:11 +08:00
}
2017-05-30 19:47:21 +08:00
ZEND_VM_HANDLER ( 119 , ZEND_SEND_ARRAY , ANY , ANY , NUM )
2014-07-11 04:32:18 +08:00
{
USE_OPLINE
2017-06-06 21:08:44 +08:00
zend_free_op free_op1 ;
2017-06-26 04:28:42 +08:00
zval * args ;
2014-07-11 04:32:18 +08:00
2015-03-13 01:39:04 +08:00
SAVE_OPLINE ( ) ;
2014-12-08 23:11:14 +08:00
args = GET_OP1_ZVAL_PTR ( BP_VAR_R ) ;
2014-07-11 04:32:18 +08:00
2014-12-08 23:11:14 +08:00
if ( UNEXPECTED ( Z_TYPE_P ( args ) ! = IS_ARRAY ) ) {
if ( ( OP1_TYPE & ( IS_VAR | IS_CV ) ) & & Z_ISREF_P ( args ) ) {
args = Z_REFVAL_P ( args ) ;
if ( EXPECTED ( Z_TYPE_P ( args ) = = IS_ARRAY ) ) {
ZEND_VM_C_GOTO ( send_array ) ;
}
}
2015-03-20 01:30:11 +08:00
zend_internal_type_error ( EX_USES_STRICT_TYPES ( ) , " call_user_func_array() expects parameter 2 to be array, %s given " , zend_get_type_by_const ( Z_TYPE_P ( args ) ) ) ;
2015-04-16 17:16:03 +08:00
if ( ZEND_CALL_INFO ( EX ( call ) ) & ZEND_CALL_CLOSURE ) {
2018-01-12 03:15:45 +08:00
OBJ_RELEASE ( ZEND_CLOSURE_OBJECT ( EX ( call ) - > func ) ) ;
2014-07-11 04:32:18 +08:00
}
2016-04-01 21:17:49 +08:00
if ( Z_TYPE ( EX ( call ) - > This ) = = IS_OBJECT ) {
2014-10-03 23:32:46 +08:00
OBJ_RELEASE ( Z_OBJ ( EX ( call ) - > This ) ) ;
2014-07-11 04:32:18 +08:00
}
EX ( call ) - > func = ( zend_function * ) & zend_pass_function ;
2014-10-03 23:32:46 +08:00
Z_OBJ ( EX ( call ) - > This ) = NULL ;
2016-04-25 19:15:06 +08:00
ZEND_SET_CALL_INFO ( EX ( call ) , 0 , ZEND_CALL_INFO ( EX ( call ) ) & ~ ZEND_CALL_RELEASE_THIS ) ;
2017-05-30 17:25:46 +08:00
FREE_UNFETCHED_OP2 ( ) ;
2014-07-11 04:32:18 +08:00
} else {
2014-12-08 23:11:14 +08:00
uint32_t arg_num ;
HashTable * ht ;
2015-04-03 21:35:06 +08:00
zval * arg , * param ;
2014-07-11 04:32:18 +08:00
2017-05-30 17:25:46 +08:00
2014-12-08 23:11:14 +08:00
ZEND_VM_C_LABEL ( send_array ) :
ht = Z_ARRVAL_P ( args ) ;
2017-05-30 17:25:46 +08:00
if ( OP2_TYPE ! = IS_UNUSED ) {
zend_free_op free_op2 ;
zval * op2 = GET_OP2_ZVAL_PTR_DEREF ( BP_VAR_R ) ;
uint32_t skip = opline - > extended_value ;
uint32_t count = zend_hash_num_elements ( ht ) ;
zend_long len = zval_get_long ( op2 ) ;
if ( len < 0 ) {
len + = ( zend_long ) ( count - skip ) ;
}
if ( skip < count & & len > 0 ) {
if ( len > ( zend_long ) ( count - skip ) ) {
len = ( zend_long ) ( count - skip ) ;
}
zend_vm_stack_extend_call_frame ( & EX ( call ) , 0 , len ) ;
arg_num = 1 ;
param = ZEND_CALL_ARG ( EX ( call ) , 1 ) ;
ZEND_HASH_FOREACH_VAL ( ht , arg ) {
if ( skip > 0 ) {
skip - - ;
continue ;
} else if ( ( zend_long ) ( arg_num - 1 ) > = len ) {
break ;
} else if ( ARG_SHOULD_BE_SENT_BY_REF ( EX ( call ) - > func , arg_num ) ) {
if ( UNEXPECTED ( ! Z_ISREF_P ( arg ) ) ) {
if ( ! ARG_MAY_BE_SENT_BY_REF ( EX ( call ) - > func , arg_num ) ) {
/* By-value send is not allowed -- emit a warning,
* but still perform the call . */
2018-02-16 07:45:31 +08:00
zend_param_must_be_ref ( EX ( call ) - > func , arg_num ) ;
2017-05-30 17:25:46 +08:00
}
}
} else {
if ( Z_ISREF_P ( arg ) & &
! ( EX ( call ) - > func - > common . fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE ) ) {
/* don't separate references for __call */
arg = Z_REFVAL_P ( arg ) ;
}
}
ZVAL_COPY ( param , arg ) ;
ZEND_CALL_NUM_ARGS ( EX ( call ) ) + + ;
arg_num + + ;
param + + ;
} ZEND_HASH_FOREACH_END ( ) ;
}
FREE_OP2 ( ) ;
} else {
zend_vm_stack_extend_call_frame ( & EX ( call ) , 0 , zend_hash_num_elements ( ht ) ) ;
arg_num = 1 ;
param = ZEND_CALL_ARG ( EX ( call ) , 1 ) ;
ZEND_HASH_FOREACH_VAL ( ht , arg ) {
if ( ARG_SHOULD_BE_SENT_BY_REF ( EX ( call ) - > func , arg_num ) ) {
if ( UNEXPECTED ( ! Z_ISREF_P ( arg ) ) ) {
if ( ! ARG_MAY_BE_SENT_BY_REF ( EX ( call ) - > func , arg_num ) ) {
/* By-value send is not allowed -- emit a warning,
* but still perform the call . */
2018-02-16 07:45:31 +08:00
zend_param_must_be_ref ( EX ( call ) - > func , arg_num ) ;
2017-05-30 17:25:46 +08:00
}
}
} else {
if ( Z_ISREF_P ( arg ) & &
! ( EX ( call ) - > func - > common . fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE ) ) {
/* don't separate references for __call */
arg = Z_REFVAL_P ( arg ) ;
2014-07-11 04:32:18 +08:00
}
2015-04-03 21:35:06 +08:00
}
2017-05-30 17:25:46 +08:00
ZVAL_COPY ( param , arg ) ;
ZEND_CALL_NUM_ARGS ( EX ( call ) ) + + ;
arg_num + + ;
param + + ;
} ZEND_HASH_FOREACH_END ( ) ;
}
2014-07-11 04:32:18 +08:00
}
FREE_OP1 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2014-07-11 04:32:18 +08:00
}
2016-09-25 18:30:32 +08:00
ZEND_VM_HANDLER ( 120 , ZEND_SEND_USER , CONST | TMP | VAR | CV , NUM )
2014-07-11 04:32:18 +08:00
{
USE_OPLINE
2015-04-03 21:35:06 +08:00
zval * arg , * param ;
2014-07-11 04:32:18 +08:00
zend_free_op free_op1 ;
2015-03-13 01:39:04 +08:00
SAVE_OPLINE ( ) ;
2016-09-25 18:30:32 +08:00
arg = GET_OP1_ZVAL_PTR_DEREF ( BP_VAR_R ) ;
2014-12-16 23:40:52 +08:00
param = ZEND_CALL_VAR ( EX ( call ) , opline - > result . var ) ;
2014-07-11 04:32:18 +08:00
2016-06-29 02:43:38 +08:00
if ( UNEXPECTED ( ARG_MUST_BE_SENT_BY_REF ( EX ( call ) - > func , opline - > op2 . num ) ) ) {
2018-02-16 07:45:31 +08:00
zend_param_must_be_ref ( EX ( call ) - > func , opline - > op2 . num ) ;
2014-07-11 04:32:18 +08:00
}
2016-09-25 18:30:32 +08:00
2016-04-19 04:45:38 +08:00
ZVAL_COPY ( param , arg ) ;
2014-07-11 04:32:18 +08:00
FREE_OP1 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2014-07-11 04:32:18 +08:00
}
2018-03-23 18:59:47 +08:00
ZEND_VM_HOT_HANDLER ( 63 , ZEND_RECV , NUM , UNUSED | CACHE_SLOT )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2014-08-26 01:28:33 +08:00
uint32_t arg_num = opline - > op1 . num ;
2004-10-23 05:42:14 +08:00
2014-11-28 15:28:49 +08:00
if ( UNEXPECTED ( arg_num > EX_NUM_ARGS ( ) ) ) {
2015-04-16 01:53:27 +08:00
SAVE_OPLINE ( ) ;
2016-06-16 07:32:02 +08:00
zend_missing_arg_error ( execute_data ) ;
HANDLE_EXCEPTION ( ) ;
2014-06-30 19:43:45 +08:00
} else if ( UNEXPECTED ( ( EX ( func ) - > op_array . fn_flags & ZEND_ACC_HAS_TYPE_HINTS ) ! = 0 ) ) {
2017-06-16 06:42:49 +08:00
zval * param = _get_zval_ptr_cv_undef_BP_VAR_W ( opline - > result . var EXECUTE_DATA_CC ) ;
2004-10-23 05:42:14 +08:00
2015-04-16 01:53:27 +08:00
SAVE_OPLINE ( ) ;
2016-04-20 00:26:08 +08:00
if ( UNEXPECTED ( ! zend_verify_arg_type ( EX ( func ) , arg_num , param , NULL , CACHE_ADDR ( opline - > op2 . num ) ) | | EG ( exception ) ) ) {
2015-04-29 04:57:21 +08:00
HANDLE_EXCEPTION ( ) ;
}
2004-10-23 05:42:14 +08:00
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HOT_HANDLER ( 64 , ZEND_RECV_INIT , NUM , CONST , CACHE_SLOT )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2015-04-29 05:40:43 +08:00
uint32_t arg_num ;
2014-11-25 20:40:08 +08:00
zval * param ;
2004-10-23 05:42:14 +08:00
2015-04-29 05:40:43 +08:00
ZEND_VM_REPEATABLE_OPCODE
arg_num = opline - > op1 . num ;
2017-06-16 06:42:49 +08:00
param = _get_zval_ptr_cv_undef_BP_VAR_W ( opline - > result . var EXECUTE_DATA_CC ) ;
2014-11-28 15:28:49 +08:00
if ( arg_num > EX_NUM_ARGS ( ) ) {
2017-10-04 21:53:01 +08:00
ZVAL_COPY ( param , RT_CONSTANT ( opline , opline - > op2 ) ) ;
2017-10-10 15:11:05 +08:00
if ( Z_OPT_TYPE_P ( param ) = = IS_CONSTANT_AST ) {
2015-04-29 04:57:21 +08:00
SAVE_OPLINE ( ) ;
2016-04-28 09:13:34 +08:00
if ( UNEXPECTED ( zval_update_constant_ex ( param , EX ( func ) - > op_array . scope ) ! = SUCCESS ) ) {
2017-10-09 17:24:11 +08:00
zval_ptr_dtor_nogc ( param ) ;
2015-04-02 07:05:25 +08:00
ZVAL_UNDEF ( param ) ;
HANDLE_EXCEPTION ( ) ;
}
2014-03-06 04:15:56 +08:00
}
2004-10-23 05:42:14 +08:00
}
2014-06-30 19:43:45 +08:00
if ( UNEXPECTED ( ( EX ( func ) - > op_array . fn_flags & ZEND_ACC_HAS_TYPE_HINTS ) ! = 0 ) ) {
2017-10-04 21:53:01 +08:00
zval * default_value = RT_CONSTANT ( opline , opline - > op2 ) ;
2015-06-17 17:07:43 +08:00
2015-04-29 04:57:21 +08:00
SAVE_OPLINE ( ) ;
2018-02-06 00:41:47 +08:00
if ( UNEXPECTED ( ! zend_verify_arg_type ( EX ( func ) , arg_num , param , default_value , CACHE_ADDR ( opline - > extended_value ) ) | | EG ( exception ) ) ) {
2015-04-29 04:57:21 +08:00
HANDLE_EXCEPTION ( ) ;
}
2014-04-04 18:36:34 +08:00
}
2008-04-24 23:45:46 +08:00
2015-04-29 05:40:43 +08:00
ZEND_VM_REPEAT_OPCODE ( ZEND_RECV_INIT ) ;
2015-04-29 19:20:44 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 164 , ZEND_RECV_VARIADIC , NUM , UNUSED | CACHE_SLOT )
2013-09-27 00:39:17 +08:00
{
USE_OPLINE
2014-08-26 01:28:33 +08:00
uint32_t arg_num = opline - > op1 . num ;
2014-11-28 15:28:49 +08:00
uint32_t arg_count = EX_NUM_ARGS ( ) ;
2014-02-10 14:04:30 +08:00
zval * params ;
2013-09-27 00:39:17 +08:00
SAVE_OPLINE ( ) ;
2017-06-16 06:42:49 +08:00
params = _get_zval_ptr_cv_undef_BP_VAR_W ( opline - > result . var EXECUTE_DATA_CC ) ;
2013-09-27 00:39:17 +08:00
if ( arg_num < = arg_count ) {
2014-06-30 19:43:45 +08:00
zval * param ;
2013-09-27 00:39:17 +08:00
array_init_size ( params , arg_count - arg_num + 1 ) ;
2018-03-23 05:13:45 +08:00
zend_hash_real_init_packed ( Z_ARRVAL_P ( params ) ) ;
2014-12-24 00:08:28 +08:00
ZEND_HASH_FILL_PACKED ( Z_ARRVAL_P ( params ) ) {
param = EX_VAR_NUM ( EX ( func ) - > op_array . last_var + EX ( func ) - > op_array . T ) ;
if ( UNEXPECTED ( ( EX ( func ) - > op_array . fn_flags & ZEND_ACC_HAS_TYPE_HINTS ) ! = 0 ) ) {
2015-03-20 16:10:29 +08:00
do {
2015-06-17 17:07:43 +08:00
zend_verify_arg_type ( EX ( func ) , arg_num , param , NULL , CACHE_ADDR ( opline - > op2 . num ) ) ;
2014-12-24 00:08:28 +08:00
if ( Z_OPT_REFCOUNTED_P ( param ) ) Z_ADDREF_P ( param ) ;
ZEND_HASH_FILL_ADD ( param ) ;
param + + ;
} while ( + + arg_num < = arg_count ) ;
} else {
do {
if ( Z_OPT_REFCOUNTED_P ( param ) ) Z_ADDREF_P ( param ) ;
ZEND_HASH_FILL_ADD ( param ) ;
param + + ;
} while ( + + arg_num < = arg_count ) ;
}
} ZEND_HASH_FILL_END ( ) ;
2013-09-27 00:39:17 +08:00
} else {
2017-10-24 22:27:31 +08:00
ZVAL_EMPTY_ARRAY ( params ) ;
2013-09-27 00:39:17 +08:00
}
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2013-09-27 00:39:17 +08:00
}
2014-12-05 17:40:47 +08:00
ZEND_VM_HANDLER ( 52 , ZEND_BOOL , CONST | TMPVAR | CV , ANY )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2014-12-05 22:04:15 +08:00
zval * val ;
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 ;
2015-04-16 01:53:27 +08:00
val = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
if ( Z_TYPE_INFO_P ( val ) = = IS_TRUE ) {
2014-12-05 22:04:15 +08:00
ZVAL_TRUE ( EX_VAR ( opline - > result . var ) ) ;
2015-04-16 01:53:27 +08:00
} else if ( EXPECTED ( Z_TYPE_INFO_P ( val ) < = IS_TRUE ) ) {
2015-07-08 23:33:58 +08:00
ZVAL_FALSE ( EX_VAR ( opline - > result . var ) ) ;
2015-12-14 07:32:40 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_INFO_P ( val ) = = IS_UNDEF ) ) {
2015-04-16 01:53:27 +08:00
SAVE_OPLINE ( ) ;
GET_OP1_UNDEF_CV ( val , BP_VAR_R ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2015-04-16 01:53:27 +08:00
}
2014-12-05 22:04:15 +08:00
} else {
2015-04-16 01:53:27 +08:00
SAVE_OPLINE ( ) ;
2014-12-14 06:06:14 +08:00
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , i_zend_is_true ( val ) ) ;
2014-12-05 22:04:15 +08:00
FREE_OP1 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2014-12-05 22:04:15 +08:00
}
2004-10-23 05:42:14 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-12-29 17:57:58 +08:00
ZEND_VM_HANDLER ( 48 , ZEND_CASE , TMPVAR , CONST | TMPVAR | CV )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2015-03-17 23:53:19 +08:00
zval * op1 , * op2 , * result ;
2004-10-23 05:42:14 +08:00
2015-03-17 23:53:19 +08:00
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2015-04-29 09:17:59 +08:00
do {
int result ;
2015-06-05 06:53:32 +08:00
if ( EXPECTED ( Z_TYPE_P ( op1 ) = = IS_LONG ) ) {
if ( EXPECTED ( Z_TYPE_P ( op2 ) = = IS_LONG ) ) {
2015-04-29 09:17:59 +08:00
result = ( Z_LVAL_P ( op1 ) = = Z_LVAL_P ( op2 ) ) ;
2015-06-05 06:53:32 +08:00
} else if ( EXPECTED ( Z_TYPE_P ( op2 ) = = IS_DOUBLE ) ) {
2015-04-29 09:17:59 +08:00
result = ( ( double ) Z_LVAL_P ( op1 ) = = Z_DVAL_P ( op2 ) ) ;
} else {
break ;
}
2015-06-05 06:53:32 +08:00
} else if ( EXPECTED ( Z_TYPE_P ( op1 ) = = IS_DOUBLE ) ) {
if ( EXPECTED ( Z_TYPE_P ( op2 ) = = IS_DOUBLE ) ) {
2015-04-29 09:17:59 +08:00
result = ( Z_DVAL_P ( op1 ) = = Z_DVAL_P ( op2 ) ) ;
2015-06-05 06:53:32 +08:00
} else if ( EXPECTED ( Z_TYPE_P ( op2 ) = = IS_LONG ) ) {
2015-04-29 09:17:59 +08:00
result = ( Z_DVAL_P ( op1 ) = = ( ( double ) Z_LVAL_P ( op2 ) ) ) ;
} else {
break ;
}
} else if ( EXPECTED ( Z_TYPE_P ( op1 ) = = IS_STRING ) ) {
if ( EXPECTED ( Z_TYPE_P ( op2 ) = = IS_STRING ) ) {
2017-12-04 22:17:02 +08:00
result = zend_fast_equal_strings ( Z_STR_P ( op1 ) , Z_STR_P ( op2 ) ) ;
2015-03-17 23:53:19 +08:00
FREE_OP2 ( ) ;
2015-04-29 09:17:59 +08:00
} else {
break ;
2015-03-17 23:53:19 +08:00
}
2015-04-29 09:17:59 +08:00
} else {
break ;
2015-03-17 23:53:19 +08:00
}
2015-04-29 09:17:59 +08:00
ZEND_VM_SMART_BRANCH ( result , 0 ) ;
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
} while ( 0 ) ;
2004-10-23 05:42:14 +08:00
2015-03-17 23:53:19 +08:00
SAVE_OPLINE ( ) ;
2015-06-05 06:53:32 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( op1 ) = = IS_UNDEF ) ) {
2015-03-17 23:53:19 +08:00
op1 = GET_OP1_UNDEF_CV ( op1 , BP_VAR_R ) ;
}
2015-06-05 06:53:32 +08:00
if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( op2 ) = = IS_UNDEF ) ) {
2015-03-17 23:53:19 +08:00
op2 = GET_OP2_UNDEF_CV ( op2 , BP_VAR_R ) ;
}
result = EX_VAR ( opline - > result . var ) ;
compare_function ( result , op1 , op2 ) ;
ZVAL_BOOL ( result , Z_LVAL_P ( result ) = = 0 ) ;
2004-10-23 05:42:14 +08:00
FREE_OP2 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 68 , ZEND_NEW , UNUSED | CLASS_FETCH | CONST | VAR , UNUSED | CACHE_SLOT , NUM )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2016-02-12 03:42:49 +08:00
zval * result ;
2005-06-10 15:56:40 +08:00
zend_function * constructor ;
2014-10-23 15:52:34 +08:00
zend_class_entry * ce ;
2016-03-12 23:00:04 +08:00
zend_execute_data * call ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2014-10-23 15:52:34 +08:00
if ( OP1_TYPE = = IS_CONST ) {
2018-02-06 00:41:47 +08:00
ce = CACHED_PTR ( opline - > op2 . num ) ;
2015-08-28 04:02:15 +08:00
if ( UNEXPECTED ( ce = = NULL ) ) {
2017-10-04 21:53:01 +08:00
ce = zend_fetch_class_by_name ( Z_STR_P ( RT_CONSTANT ( opline , opline - > op1 ) ) , RT_CONSTANT ( opline , opline - > op1 ) + 1 , ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION ) ;
2014-10-23 15:52:34 +08:00
if ( UNEXPECTED ( ce = = NULL ) ) {
2016-09-30 16:00:14 +08:00
ZEND_ASSERT ( EG ( exception ) ) ;
2016-12-07 05:41:07 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2016-09-30 16:00:14 +08:00
HANDLE_EXCEPTION ( ) ;
2014-10-23 15:52:34 +08:00
}
2018-02-06 00:41:47 +08:00
CACHE_PTR ( opline - > op2 . num , ce ) ;
2014-10-23 15:52:34 +08:00
}
2015-10-27 20:47:58 +08:00
} else if ( OP1_TYPE = = IS_UNUSED ) {
ce = zend_fetch_class ( NULL , opline - > op1 . num ) ;
2015-11-16 18:19:22 +08:00
if ( UNEXPECTED ( ce = = NULL ) ) {
ZEND_ASSERT ( EG ( exception ) ) ;
2016-12-07 05:41:07 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2015-11-16 18:19:22 +08:00
HANDLE_EXCEPTION ( ) ;
}
2014-10-23 15:52:34 +08:00
} else {
ce = Z_CE_P ( EX_VAR ( opline - > op1 . var ) ) ;
}
2016-02-12 03:42:49 +08:00
result = EX_VAR ( opline - > result . var ) ;
if ( UNEXPECTED ( object_init_ex ( result , ce ) ! = SUCCESS ) ) {
2016-12-07 05:41:07 +08:00
ZVAL_UNDEF ( result ) ;
2015-03-09 20:57:15 +08:00
HANDLE_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2005-06-10 15:56:40 +08:00
2016-02-12 03:42:49 +08:00
constructor = Z_OBJ_HT_P ( result ) - > get_constructor ( Z_OBJ_P ( result ) ) ;
2005-06-10 15:56:40 +08:00
if ( constructor = = NULL ) {
2016-07-14 05:39:16 +08:00
if ( UNEXPECTED ( EG ( exception ) ) ) {
HANDLE_EXCEPTION ( ) ;
}
2016-03-12 23:00:04 +08:00
/* If there are no arguments, skip over the DO_FCALL opcode. We check if the next
* opcode is DO_FCALL in case EXT instructions are used . */
if ( EXPECTED ( opline - > extended_value = = 0 & & ( opline + 1 ) - > opcode = = ZEND_DO_FCALL ) ) {
ZEND_VM_NEXT_OPCODE_EX ( 1 , 2 ) ;
}
/* Perform a dummy function call */
call = zend_vm_stack_push_call_frame (
ZEND_CALL_FUNCTION , ( zend_function * ) & zend_pass_function ,
opline - > extended_value , NULL , NULL ) ;
2005-06-10 15:56:40 +08:00
} else {
2016-04-05 05:01:00 +08:00
if ( EXPECTED ( constructor - > type = = ZEND_USER_FUNCTION ) & & UNEXPECTED ( ! constructor - > op_array . run_time_cache ) ) {
init_func_run_time_cache ( & constructor - > op_array ) ;
}
2014-06-30 19:43:45 +08:00
/* We are not handling overloaded classes right now */
2016-03-12 23:00:04 +08:00
call = zend_vm_stack_push_call_frame (
2016-02-12 03:42:49 +08:00
ZEND_CALL_FUNCTION | ZEND_CALL_RELEASE_THIS | ZEND_CALL_CTOR ,
2014-10-07 21:12:12 +08:00
constructor ,
opline - > extended_value ,
2014-10-23 15:52:34 +08:00
ce ,
2016-02-12 03:42:49 +08:00
Z_OBJ_P ( result ) ) ;
Z_ADDREF_P ( result ) ;
2005-06-10 15:56:40 +08:00
}
2016-03-12 23:00:04 +08:00
call - > prev_execute_data = EX ( call ) ;
EX ( call ) = call ;
2016-10-18 20:31:49 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
2004-10-23 05:42:14 +08:00
}
2015-12-11 07:31:28 +08:00
ZEND_VM_HANDLER ( 110 , ZEND_CLONE , CONST | TMPVAR | UNUSED | THIS | CV , ANY )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 ;
2010-04-20 19:16:39 +08:00
zval * obj ;
2016-04-28 09:13:34 +08:00
zend_class_entry * ce , * scope ;
2004-10-23 05:42:14 +08:00
zend_function * clone ;
zend_object_clone_obj_t clone_call ;
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2015-06-05 06:53:32 +08:00
obj = GET_OP1_OBJ_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2010-04-20 19:16:39 +08:00
2016-04-01 21:17:49 +08:00
if ( OP1_TYPE = = IS_UNUSED & & UNEXPECTED ( Z_TYPE_P ( obj ) = = IS_UNDEF ) ) {
2017-06-15 21:23:05 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_this_not_in_object_context_helper ) ;
2015-04-01 20:54:03 +08:00
}
2014-12-08 23:11:14 +08:00
do {
if ( OP1_TYPE = = IS_CONST | |
( OP1_TYPE ! = IS_UNUSED & & UNEXPECTED ( Z_TYPE_P ( obj ) ! = IS_OBJECT ) ) ) {
if ( ( OP1_TYPE & ( IS_VAR | IS_CV ) ) & & Z_ISREF_P ( obj ) ) {
2018-01-10 07:22:07 +08:00
obj = Z_REFVAL_P ( obj ) ;
if ( EXPECTED ( Z_TYPE_P ( obj ) = = IS_OBJECT ) ) {
break ;
2014-12-08 23:11:14 +08:00
}
2015-06-05 06:53:32 +08:00
}
2016-12-07 05:41:07 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2015-06-05 06:53:32 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( obj ) = = IS_UNDEF ) ) {
GET_OP1_UNDEF_CV ( obj , BP_VAR_R ) ;
2015-09-08 22:20:52 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
HANDLE_EXCEPTION ( ) ;
}
2014-12-08 23:11:14 +08:00
}
2015-07-08 01:10:22 +08:00
zend_throw_error ( NULL , " __clone method called on non-object " ) ;
2015-03-09 20:57:15 +08:00
FREE_OP1 ( ) ;
HANDLE_EXCEPTION ( ) ;
2013-02-16 22:22:22 +08:00
}
2014-12-08 23:11:14 +08:00
} while ( 0 ) ;
2004-10-23 05:42:14 +08:00
ce = Z_OBJCE_P ( obj ) ;
2015-12-11 05:14:39 +08:00
clone = ce - > clone ;
clone_call = Z_OBJ_HT_P ( obj ) - > clone_obj ;
2010-04-20 19:16:39 +08:00
if ( UNEXPECTED ( clone_call = = NULL ) ) {
2015-12-11 05:14:39 +08:00
zend_throw_error ( NULL , " Trying to clone an uncloneable object of class %s " , ZSTR_VAL ( ce - > name ) ) ;
2015-03-09 20:57:15 +08:00
FREE_OP1 ( ) ;
2016-12-07 05:41:07 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2015-03-09 20:57:15 +08:00
HANDLE_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2015-12-11 05:14:39 +08:00
if ( clone ) {
2004-10-23 05:42:14 +08:00
if ( clone - > op_array . fn_flags & ZEND_ACC_PRIVATE ) {
/* Ensure that if we're calling a private function, we're allowed to do so.
*/
2016-04-28 09:13:34 +08:00
scope = EX ( func ) - > op_array . scope ;
2017-11-07 13:30:34 +08:00
if ( ! zend_check_private ( clone , scope , clone - > common . function_name ) ) {
zend_throw_error ( NULL , " Call to private %s::__clone() from context '%s' " , ZSTR_VAL ( clone - > common . scope - > name ) , scope ? ZSTR_VAL ( scope - > name ) : " " ) ;
2015-03-09 20:57:15 +08:00
FREE_OP1 ( ) ;
2016-12-07 05:41:07 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2015-03-09 20:57:15 +08:00
HANDLE_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
} else if ( ( clone - > common . fn_flags & ZEND_ACC_PROTECTED ) ) {
/* Ensure that if we're calling a protected function, we're allowed to do so.
*/
2016-04-28 09:13:34 +08:00
scope = EX ( func ) - > op_array . scope ;
if ( UNEXPECTED ( ! zend_check_protected ( zend_get_function_root_class ( clone ) , scope ) ) ) {
2017-11-07 13:30:34 +08:00
zend_throw_error ( NULL , " Call to protected %s::__clone() from context '%s' " , ZSTR_VAL ( clone - > common . scope - > name ) , scope ? ZSTR_VAL ( scope - > name ) : " " ) ;
2015-03-09 20:57:15 +08:00
FREE_OP1 ( ) ;
2016-12-07 05:41:07 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2015-03-09 20:57:15 +08:00
HANDLE_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
}
}
2016-12-07 05:41:07 +08:00
ZVAL_OBJ ( EX_VAR ( opline - > result . var ) , clone_call ( obj ) ) ;
2015-12-11 05:14:39 +08:00
2014-12-08 23:11:14 +08:00
FREE_OP1 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 99 , ZEND_FETCH_CONSTANT , UNUSED | CONST_FETCH , CONST , CACHE_SLOT )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2015-10-27 20:47:58 +08:00
zend_constant * c ;
2004-10-23 05:42:14 +08:00
2018-03-30 21:41:02 +08:00
c = CACHED_PTR ( opline - > extended_value ) ;
if ( EXPECTED ( c ! = NULL ) & & EXPECTED ( ! IS_SPECIAL_CACHE_VAL ( c ) ) ) {
/* pass */
2018-02-21 07:49:40 +08:00
} else if ( UNEXPECTED ( ( c = zend_quick_get_constant ( RT_CONSTANT ( opline , opline - > op2 ) + 1 , opline - > op1 . num ) ) = = NULL ) ) {
2016-12-19 20:36:37 +08:00
SAVE_OPLINE ( ) ;
2018-01-31 23:15:25 +08:00
if ( ( opline - > op1 . num & IS_CONSTANT_UNQUALIFIED ) ! = 0 ) {
2017-10-04 21:53:01 +08:00
char * actual = ( char * ) zend_memrchr ( Z_STRVAL_P ( RT_CONSTANT ( opline , opline - > op2 ) ) , ' \\ ' , Z_STRLEN_P ( RT_CONSTANT ( opline , opline - > op2 ) ) ) ;
2015-10-27 20:47:58 +08:00
if ( ! actual ) {
2017-10-04 21:53:01 +08:00
ZVAL_STR_COPY ( EX_VAR ( opline - > result . var ) , Z_STR_P ( RT_CONSTANT ( opline , opline - > op2 ) ) ) ;
2008-11-04 23:58:55 +08:00
} else {
2015-10-27 20:47:58 +08:00
actual + + ;
ZVAL_STRINGL ( EX_VAR ( opline - > result . var ) ,
2017-10-04 21:53:01 +08:00
actual , Z_STRLEN_P ( RT_CONSTANT ( opline , opline - > op2 ) ) - ( actual - Z_STRVAL_P ( RT_CONSTANT ( opline , opline - > op2 ) ) ) ) ;
2007-12-08 01:11:24 +08:00
}
2015-10-27 20:47:58 +08:00
/* non-qualified constant - allow text substitution */
2017-03-05 06:47:19 +08:00
zend_error ( E_WARNING , " Use of undefined constant %s - assumed '%s' (this will throw an Error in a future version of PHP) " ,
2015-10-27 20:47:58 +08:00
Z_STRVAL_P ( EX_VAR ( opline - > result . var ) ) , Z_STRVAL_P ( EX_VAR ( opline - > result . var ) ) ) ;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2010-05-24 22:11:39 +08:00
} else {
2017-10-04 21:53:01 +08:00
zend_throw_error ( NULL , " Undefined constant '%s' " , Z_STRVAL_P ( RT_CONSTANT ( opline , opline - > op2 ) ) ) ;
2016-12-07 05:41:07 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2015-10-27 20:47:58 +08:00
HANDLE_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2015-10-27 20:47:58 +08:00
} else {
2018-02-06 00:41:47 +08:00
CACHE_PTR ( opline - > extended_value , c ) ;
2015-10-27 20:47:58 +08:00
}
2017-10-31 04:13:10 +08:00
ZVAL_COPY_OR_DUP ( EX_VAR ( opline - > result . var ) , & c - > value ) ;
2007-10-03 14:49:15 +08:00
2015-10-27 20:47:58 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 181 , ZEND_FETCH_CLASS_CONSTANT , VAR | CONST | UNUSED | CLASS_FETCH , CONST , CACHE_SLOT )
2015-10-27 20:47:58 +08:00
{
2016-04-28 09:13:34 +08:00
zend_class_entry * ce , * scope ;
2015-12-08 17:40:42 +08:00
zend_class_constant * c ;
2017-11-24 19:01:19 +08:00
zval * value , * zv ;
2015-10-27 20:47:58 +08:00
USE_OPLINE
SAVE_OPLINE ( ) ;
do {
if ( OP1_TYPE = = IS_CONST ) {
2018-02-06 00:41:47 +08:00
if ( EXPECTED ( CACHED_PTR ( opline - > extended_value + sizeof ( void * ) ) ) ) {
value = CACHED_PTR ( opline - > extended_value + sizeof ( void * ) ) ;
2015-10-27 20:47:58 +08:00
break ;
2018-02-06 00:41:47 +08:00
} else if ( EXPECTED ( CACHED_PTR ( opline - > extended_value ) ) ) {
ce = CACHED_PTR ( opline - > extended_value ) ;
2015-10-27 20:47:58 +08:00
} else {
2017-10-04 21:53:01 +08:00
ce = zend_fetch_class_by_name ( Z_STR_P ( RT_CONSTANT ( opline , opline - > op1 ) ) , RT_CONSTANT ( opline , opline - > op1 ) + 1 , ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION ) ;
2015-10-27 20:47:58 +08:00
if ( UNEXPECTED ( ce = = NULL ) ) {
2016-09-30 16:00:14 +08:00
ZEND_ASSERT ( EG ( exception ) ) ;
2016-12-07 05:41:07 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2015-10-27 20:47:58 +08:00
HANDLE_EXCEPTION ( ) ;
2013-07-14 11:47:06 +08:00
}
2015-10-27 20:47:58 +08:00
}
} else {
if ( OP1_TYPE = = IS_UNUSED ) {
ce = zend_fetch_class ( NULL , opline - > op1 . num ) ;
2015-11-15 10:41:55 +08:00
if ( UNEXPECTED ( ce = = NULL ) ) {
ZEND_ASSERT ( EG ( exception ) ) ;
2016-12-07 05:41:07 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2015-11-15 10:41:55 +08:00
HANDLE_EXCEPTION ( ) ;
}
2015-06-02 17:01:34 +08:00
} else {
ce = Z_CE_P ( EX_VAR ( opline - > op1 . var ) ) ;
2010-05-24 22:11:39 +08:00
}
2018-02-06 00:41:47 +08:00
if ( EXPECTED ( CACHED_PTR ( opline - > extended_value ) = = ce ) ) {
value = CACHED_PTR ( opline - > extended_value + sizeof ( void * ) ) ;
2015-10-27 20:47:58 +08:00
break ;
}
}
2017-11-24 19:01:19 +08:00
zv = zend_hash_find_ex ( & ce - > constants_table , Z_STR_P ( RT_CONSTANT ( opline , opline - > op2 ) ) , 1 ) ;
if ( EXPECTED ( zv ! = NULL ) ) {
c = Z_PTR_P ( zv ) ;
2016-04-28 09:13:34 +08:00
scope = EX ( func ) - > op_array . scope ;
if ( ! zend_verify_const_access ( c , scope ) ) {
2017-10-04 21:53:01 +08:00
zend_throw_error ( NULL , " Cannot access %s const %s::%s " , zend_visibility_string ( Z_ACCESS_FLAGS ( c - > value ) ) , ZSTR_VAL ( ce - > name ) , Z_STRVAL_P ( RT_CONSTANT ( opline , opline - > op2 ) ) ) ;
2016-12-07 05:41:07 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2015-12-08 17:40:42 +08:00
HANDLE_EXCEPTION ( ) ;
}
value = & c - > value ;
2017-10-10 15:11:05 +08:00
if ( Z_TYPE_P ( value ) = = IS_CONSTANT_AST ) {
2017-03-16 02:06:34 +08:00
zval_update_constant_ex ( value , c - > ce ) ;
2015-10-27 20:47:58 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2016-12-07 05:41:07 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2015-10-27 20:47:58 +08:00
HANDLE_EXCEPTION ( ) ;
2015-06-02 17:01:34 +08:00
}
2015-10-27 20:47:58 +08:00
}
2018-02-06 00:41:47 +08:00
CACHE_POLYMORPHIC_PTR ( opline - > extended_value , ce , value ) ;
2007-09-29 03:52:53 +08:00
} else {
2017-10-04 21:53:01 +08:00
zend_throw_error ( NULL , " Undefined class constant '%s' " , Z_STRVAL_P ( RT_CONSTANT ( opline , opline - > op2 ) ) ) ;
2016-12-07 05:41:07 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2015-10-27 20:47:58 +08:00
HANDLE_EXCEPTION ( ) ;
2007-09-29 03:52:53 +08:00
}
2015-10-27 20:47:58 +08:00
} while ( 0 ) ;
2017-10-31 04:13:10 +08:00
ZVAL_COPY_OR_DUP ( EX_VAR ( opline - > result . var ) , value ) ;
2015-10-27 20:47:58 +08:00
2014-04-12 00:21:46 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
2004-10-23 05:42:14 +08:00
}
2015-12-11 07:31:28 +08:00
ZEND_VM_HANDLER ( 72 , ZEND_ADD_ARRAY_ELEMENT , CONST | TMP | VAR | CV , CONST | TMPVAR | UNUSED | NEXT | CV , REF )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
zend_free_op free_op1 ;
2014-03-09 19:42:08 +08:00
zval * expr_ptr , new_expr ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2014-04-23 06:47:41 +08:00
if ( ( OP1_TYPE = = IS_VAR | | OP1_TYPE = = IS_CV ) & &
2015-06-05 00:13:40 +08:00
UNEXPECTED ( opline - > extended_value & ZEND_ARRAY_ELEMENT_REF ) ) {
2014-03-04 16:27:50 +08:00
expr_ptr = GET_OP1_ZVAL_PTR_PTR ( BP_VAR_W ) ;
2017-12-26 18:30:25 +08:00
if ( Z_ISREF_P ( expr_ptr ) ) {
Z_ADDREF_P ( expr_ptr ) ;
} else {
ZVAL_MAKE_REF_EX ( expr_ptr , 2 ) ;
}
2014-04-23 06:47:41 +08:00
FREE_OP1_VAR_PTR ( ) ;
2004-10-23 05:42:14 +08:00
} else {
2014-04-15 05:16:09 +08:00
expr_ptr = GET_OP1_ZVAL_PTR ( BP_VAR_R ) ;
2014-09-22 16:47:10 +08:00
if ( OP1_TYPE = = IS_TMP_VAR ) {
2015-06-05 00:13:40 +08:00
/* pass */
2014-03-09 19:42:08 +08:00
} else if ( OP1_TYPE = = IS_CONST ) {
2017-11-01 10:25:10 +08:00
Z_TRY_ADDREF_P ( expr_ptr ) ;
2015-04-03 06:32:20 +08:00
} else if ( OP1_TYPE = = IS_CV ) {
ZVAL_DEREF ( expr_ptr ) ;
2017-11-01 10:25:10 +08:00
Z_TRY_ADDREF_P ( expr_ptr ) ;
2015-04-03 06:32:20 +08:00
} else /* if (OP1_TYPE == IS_VAR) */ {
if ( UNEXPECTED ( Z_ISREF_P ( expr_ptr ) ) ) {
zend_refcounted * ref = Z_COUNTED_P ( expr_ptr ) ;
expr_ptr = Z_REFVAL_P ( expr_ptr ) ;
2017-10-27 06:28:58 +08:00
if ( UNEXPECTED ( GC_DELREF ( ref ) = = 0 ) ) {
2015-04-03 06:32:20 +08:00
ZVAL_COPY_VALUE ( & new_expr , expr_ptr ) ;
expr_ptr = & new_expr ;
efree_size ( ref , sizeof ( zend_reference ) ) ;
} else if ( Z_OPT_REFCOUNTED_P ( expr_ptr ) ) {
Z_ADDREF_P ( expr_ptr ) ;
}
}
2004-10-23 05:42:14 +08:00
}
}
2010-04-20 19:16:39 +08:00
if ( OP2_TYPE ! = IS_UNUSED ) {
zend_free_op free_op2 ;
2015-06-05 06:53:32 +08:00
zval * offset = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2014-04-23 06:47:41 +08:00
zend_string * str ;
2014-08-26 01:24:55 +08:00
zend_ulong hval ;
2011-03-16 13:25:02 +08:00
2014-03-26 22:07:31 +08:00
ZEND_VM_C_LABEL ( add_again ) :
2015-06-05 00:13:40 +08:00
if ( EXPECTED ( Z_TYPE_P ( offset ) = = IS_STRING ) ) {
str = Z_STR_P ( offset ) ;
if ( OP2_TYPE ! = IS_CONST ) {
if ( ZEND_HANDLE_NUMERIC ( str , hval ) ) {
ZEND_VM_C_GOTO ( num_index ) ;
2010-04-20 18:57:45 +08:00
}
2015-06-05 00:13:40 +08:00
}
2015-01-03 17:22:58 +08:00
ZEND_VM_C_LABEL ( str_index ) :
2015-06-05 00:13:40 +08:00
zend_hash_update ( Z_ARRVAL_P ( EX_VAR ( opline - > result . var ) ) , str , expr_ptr ) ;
} else if ( EXPECTED ( Z_TYPE_P ( offset ) = = IS_LONG ) ) {
hval = Z_LVAL_P ( offset ) ;
ZEND_VM_C_LABEL ( num_index ) :
zend_hash_index_update ( Z_ARRVAL_P ( EX_VAR ( opline - > result . var ) ) , hval , expr_ptr ) ;
} else if ( ( OP2_TYPE & ( IS_VAR | IS_CV ) ) & & EXPECTED ( Z_TYPE_P ( offset ) = = IS_REFERENCE ) ) {
offset = Z_REFVAL_P ( offset ) ;
ZEND_VM_C_GOTO ( add_again ) ;
} else if ( Z_TYPE_P ( offset ) = = IS_NULL ) {
2015-06-29 21:44:54 +08:00
str = ZSTR_EMPTY_ALLOC ( ) ;
2015-06-05 00:13:40 +08:00
ZEND_VM_C_GOTO ( str_index ) ;
} else if ( Z_TYPE_P ( offset ) = = IS_DOUBLE ) {
hval = zend_dval_to_lval ( Z_DVAL_P ( offset ) ) ;
ZEND_VM_C_GOTO ( num_index ) ;
} else if ( Z_TYPE_P ( offset ) = = IS_FALSE ) {
hval = 0 ;
ZEND_VM_C_GOTO ( num_index ) ;
} else if ( Z_TYPE_P ( offset ) = = IS_TRUE ) {
hval = 1 ;
ZEND_VM_C_GOTO ( num_index ) ;
2015-06-05 06:53:32 +08:00
} else if ( OP2_TYPE = = IS_CV & & Z_TYPE_P ( offset ) = = IS_UNDEF ) {
GET_OP2_UNDEF_CV ( offset , BP_VAR_R ) ;
2015-06-29 21:44:54 +08:00
str = ZSTR_EMPTY_ALLOC ( ) ;
2015-06-05 06:53:32 +08:00
ZEND_VM_C_GOTO ( str_index ) ;
2015-06-05 00:13:40 +08:00
} else {
2018-02-16 07:45:31 +08:00
zend_illegal_offset ( ) ;
2017-10-09 17:24:11 +08:00
zval_ptr_dtor_nogc ( expr_ptr ) ;
2004-10-23 05:42:14 +08:00
}
FREE_OP2 ( ) ;
} else {
2016-09-29 04:36:36 +08:00
if ( ! zend_hash_next_index_insert ( Z_ARRVAL_P ( EX_VAR ( opline - > result . var ) ) , expr_ptr ) ) {
2018-02-16 07:45:31 +08:00
zend_cannot_add_element ( ) ;
2017-10-09 17:24:11 +08:00
zval_ptr_dtor_nogc ( expr_ptr ) ;
2016-09-29 04:33:40 +08:00
}
2004-10-23 05:42:14 +08:00
}
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2017-05-18 18:18:08 +08:00
ZEND_VM_HANDLER ( 71 , ZEND_INIT_ARRAY , CONST | TMP | VAR | CV , CONST | TMPVAR | UNUSED | NEXT | CV , ARRAY_INIT | REF )
2004-10-23 05:42:14 +08:00
{
2014-04-23 06:47:41 +08:00
zval * array ;
2014-08-26 01:28:33 +08:00
uint32_t size ;
2010-04-20 19:16:39 +08:00
USE_OPLINE
2006-09-18 22:23:52 +08:00
2014-04-23 06:47:41 +08:00
array = EX_VAR ( opline - > result . var ) ;
if ( OP1_TYPE ! = IS_UNUSED ) {
size = opline - > extended_value > > ZEND_ARRAY_SIZE_SHIFT ;
2017-10-24 22:27:31 +08:00
ZVAL_ARR ( array , zend_new_array ( size ) ) ;
2014-04-23 03:33:49 +08:00
/* Explicitly initialize array as not-packed if flag is set */
2014-04-23 06:47:41 +08:00
if ( opline - > extended_value & ZEND_ARRAY_NOT_PACKED ) {
2018-03-23 05:13:45 +08:00
zend_hash_real_init_mixed ( Z_ARRVAL_P ( array ) ) ;
2014-04-23 03:33:49 +08:00
}
2017-10-24 22:27:31 +08:00
ZEND_VM_DISPATCH_TO_HANDLER ( ZEND_ADD_ARRAY_ELEMENT ) ;
} else {
ZVAL_EMPTY_ARRAY ( array ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
2014-04-23 03:33:49 +08:00
}
2004-10-23 05:42:14 +08:00
}
2015-10-29 04:25:05 +08:00
ZEND_VM_HANDLER ( 21 , ZEND_CAST , CONST | TMP | VAR | CV , ANY , TYPE )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 ;
2010-04-20 19:16:39 +08:00
zval * expr ;
2014-02-10 14:04:30 +08:00
zval * result = EX_VAR ( opline - > result . var ) ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2014-12-08 23:11:14 +08:00
expr = GET_OP1_ZVAL_PTR ( BP_VAR_R ) ;
2014-03-06 18:23:16 +08:00
2004-10-23 05:42:14 +08:00
switch ( opline - > extended_value ) {
case IS_NULL :
2014-04-25 21:21:26 +08:00
ZVAL_NULL ( result ) ;
2004-10-23 05:42:14 +08:00
break ;
2014-04-30 22:32:42 +08:00
case _IS_BOOL :
2014-12-14 06:06:14 +08:00
ZVAL_BOOL ( result , zend_is_true ( expr ) ) ;
2004-10-23 05:42:14 +08:00
break ;
2014-08-26 01:24:55 +08:00
case IS_LONG :
ZVAL_LONG ( result , zval_get_long ( expr ) ) ;
2004-10-23 05:42:14 +08:00
break ;
case IS_DOUBLE :
2014-04-25 21:21:26 +08:00
ZVAL_DOUBLE ( result , zval_get_double ( expr ) ) ;
2004-10-23 05:42:14 +08:00
break ;
2014-04-25 21:21:26 +08:00
case IS_STRING :
ZVAL_STR ( result , zval_get_string ( expr ) ) ;
break ;
default :
2014-12-08 23:11:14 +08:00
if ( OP1_TYPE & ( IS_VAR | IS_CV ) ) {
ZVAL_DEREF ( expr ) ;
}
2014-04-25 21:21:26 +08:00
/* If value is already of correct type, return it directly */
if ( Z_TYPE_P ( expr ) = = opline - > extended_value ) {
2010-04-20 19:16:39 +08:00
ZVAL_COPY_VALUE ( result , expr ) ;
2014-04-25 21:21:26 +08:00
if ( OP1_TYPE = = IS_CONST ) {
2016-05-17 13:45:06 +08:00
if ( UNEXPECTED ( Z_OPT_REFCOUNTED_P ( result ) ) ) Z_ADDREF_P ( result ) ;
2014-06-05 20:04:11 +08:00
} else if ( OP1_TYPE ! = IS_TMP_VAR ) {
2016-05-17 13:45:06 +08:00
if ( Z_OPT_REFCOUNTED_P ( result ) ) Z_ADDREF_P ( result ) ;
2007-10-03 16:02:36 +08:00
}
2014-04-25 21:21:26 +08:00
2014-10-13 20:51:53 +08:00
FREE_OP1_IF_VAR ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2014-04-25 21:21:26 +08:00
if ( opline - > extended_value = = IS_ARRAY ) {
2014-06-05 20:04:11 +08:00
if ( Z_TYPE_P ( expr ) ! = IS_OBJECT ) {
if ( Z_TYPE_P ( expr ) ! = IS_NULL ) {
2017-10-24 22:27:31 +08:00
ZVAL_ARR ( result , zend_new_array ( 8 ) ) ;
2014-06-05 20:04:11 +08:00
expr = zend_hash_index_add_new ( Z_ARRVAL_P ( result ) , 0 , expr ) ;
if ( OP1_TYPE = = IS_CONST ) {
2016-05-17 13:45:06 +08:00
if ( UNEXPECTED ( Z_OPT_REFCOUNTED_P ( expr ) ) ) Z_ADDREF_P ( expr ) ;
2014-10-13 21:19:23 +08:00
} else {
2014-06-05 20:04:11 +08:00
if ( Z_OPT_REFCOUNTED_P ( expr ) ) Z_ADDREF_P ( expr ) ;
}
2017-10-24 22:27:31 +08:00
} else {
ZVAL_EMPTY_ARRAY ( result ) ;
2014-06-05 20:04:11 +08:00
}
} else {
ZVAL_COPY_VALUE ( result , expr ) ;
2014-10-13 21:19:23 +08:00
Z_ADDREF_P ( result ) ;
2014-06-05 20:04:11 +08:00
convert_to_array ( result ) ;
}
2014-04-25 21:21:26 +08:00
} else {
2014-06-05 20:04:11 +08:00
if ( Z_TYPE_P ( expr ) ! = IS_ARRAY ) {
object_init ( result ) ;
if ( Z_TYPE_P ( expr ) ! = IS_NULL ) {
2017-03-04 17:39:13 +08:00
expr = zend_hash_add_new ( Z_OBJPROP_P ( result ) , ZSTR_KNOWN ( ZEND_STR_SCALAR ) , expr ) ;
2014-06-05 20:04:11 +08:00
if ( OP1_TYPE = = IS_CONST ) {
2016-05-17 13:45:06 +08:00
if ( UNEXPECTED ( Z_OPT_REFCOUNTED_P ( expr ) ) ) Z_ADDREF_P ( expr ) ;
2014-10-13 21:19:23 +08:00
} else {
2014-06-05 20:04:11 +08:00
if ( Z_OPT_REFCOUNTED_P ( expr ) ) Z_ADDREF_P ( expr ) ;
}
}
} else {
2015-06-12 01:41:43 +08:00
ZVAL_COPY ( result , expr ) ;
2014-06-05 20:04:11 +08:00
convert_to_object ( result ) ;
}
2014-04-25 21:21:26 +08:00
}
2004-10-23 05:42:14 +08:00
}
2014-10-13 21:19:23 +08:00
2014-04-25 21:21:26 +08:00
FREE_OP1 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2015-10-29 04:25:05 +08:00
ZEND_VM_HANDLER ( 73 , ZEND_INCLUDE_OR_EVAL , CONST | TMPVAR | CV , ANY , EVAL )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2016-04-13 20:29:01 +08:00
zend_op_array * new_op_array ;
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 ;
2010-04-20 19:16:39 +08:00
zval * inc_filename ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2016-04-13 20:29:01 +08:00
inc_filename = GET_OP1_ZVAL_PTR ( BP_VAR_R ) ;
new_op_array = zend_include_or_eval ( inc_filename , opline - > extended_value ) ;
2008-06-11 21:18:41 +08:00
FREE_OP1 ( ) ;
2010-04-20 19:16:39 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2016-07-14 18:14:15 +08:00
if ( new_op_array ! = ZEND_FAKE_OP_ARRAY & & new_op_array ! = NULL ) {
destroy_op_array ( new_op_array ) ;
efree_size ( new_op_array , sizeof ( zend_op_array ) ) ;
}
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2010-04-20 19:16:39 +08:00
HANDLE_EXCEPTION ( ) ;
2016-04-13 20:29:01 +08:00
} else if ( new_op_array = = ZEND_FAKE_OP_ARRAY ) {
if ( RETURN_VALUE_USED ( opline ) ) {
ZVAL_TRUE ( EX_VAR ( opline - > result . var ) ) ;
}
2010-04-20 19:16:39 +08:00
} else if ( EXPECTED ( new_op_array ! = NULL ) ) {
2014-02-12 18:29:51 +08:00
zval * return_value = NULL ;
2014-07-07 19:50:44 +08:00
zend_execute_data * call ;
2014-02-12 18:29:51 +08:00
2010-04-20 19:16:39 +08:00
if ( RETURN_VALUE_USED ( opline ) ) {
2014-02-12 18:29:51 +08:00
return_value = EX_VAR ( opline - > result . var ) ;
2017-04-15 18:04:56 +08:00
ZVAL_NULL ( return_value ) ;
2010-04-20 19:16:39 +08:00
}
2004-10-23 05:42:14 +08:00
2016-04-28 09:13:34 +08:00
new_op_array - > scope = EX ( func ) - > op_array . scope ;
2014-11-28 15:21:18 +08:00
2016-04-28 20:17:24 +08:00
call = zend_vm_stack_push_call_frame ( ZEND_CALL_NESTED_CODE | ZEND_CALL_HAS_SYMBOL_TABLE ,
2016-04-01 21:17:49 +08:00
( zend_function * ) new_op_array , 0 ,
Z_TYPE ( EX ( This ) ) ! = IS_OBJECT ? Z_CE ( EX ( This ) ) : NULL ,
Z_TYPE ( EX ( This ) ) = = IS_OBJECT ? Z_OBJ ( EX ( This ) ) : NULL ) ;
2004-10-23 05:42:14 +08:00
2016-04-28 20:17:24 +08:00
if ( EX_CALL_INFO ( ) & ZEND_CALL_HAS_SYMBOL_TABLE ) {
2014-07-07 19:50:44 +08:00
call - > symbol_table = EX ( symbol_table ) ;
2014-07-04 22:03:45 +08:00
} else {
2014-12-14 06:06:14 +08:00
call - > symbol_table = zend_rebuild_symbol_table ( ) ;
2008-04-29 16:15:20 +08:00
}
2014-07-07 19:50:44 +08:00
call - > prev_execute_data = execute_data ;
2016-04-13 20:29:01 +08:00
i_init_code_execute_data ( call , new_op_array , return_value ) ;
2012-11-30 17:39:23 +08:00
if ( EXPECTED ( zend_execute_ex = = execute_ex ) ) {
2008-06-11 21:18:41 +08:00
ZEND_VM_ENTER ( ) ;
} else {
2014-11-28 15:33:03 +08:00
ZEND_ADD_CALL_FLAG ( call , ZEND_CALL_TOP ) ;
2014-12-14 06:06:14 +08:00
zend_execute_ex ( call ) ;
2015-05-18 17:44:40 +08:00
zend_vm_stack_free_call_frame ( call ) ;
2008-06-11 21:18:41 +08:00
}
2004-10-23 05:42:14 +08:00
2015-08-04 06:00:10 +08:00
destroy_op_array ( new_op_array ) ;
efree_size ( new_op_array , sizeof ( zend_op_array ) ) ;
2010-04-20 19:16:39 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2016-12-12 15:55:32 +08:00
zend_rethrow_exception ( execute_data ) ;
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2010-04-20 19:16:39 +08:00
HANDLE_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2010-04-20 19:16:39 +08:00
} else if ( RETURN_VALUE_USED ( opline ) ) {
2016-04-13 20:29:01 +08:00
ZVAL_FALSE ( EX_VAR ( opline - > result . var ) ) ;
2004-10-23 05:42:14 +08:00
}
2016-04-20 16:06:52 +08:00
ZEND_VM_SET_OPCODE ( opline + 1 ) ;
ZEND_VM_CONTINUE ( ) ;
2004-10-23 05:42:14 +08:00
}
2017-07-17 19:11:50 +08:00
ZEND_VM_HANDLER ( 196 , ZEND_UNSET_CV , CV , UNUSED )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2017-07-17 19:11:50 +08:00
zval * var = EX_VAR ( opline - > op1 . var ) ;
2014-09-22 18:41:44 +08:00
2017-07-17 19:11:50 +08:00
if ( Z_REFCOUNTED_P ( var ) ) {
zend_refcounted * garbage = Z_COUNTED_P ( var ) ;
2014-09-22 18:41:44 +08:00
2017-07-17 19:11:50 +08:00
ZVAL_UNDEF ( var ) ;
2017-07-18 04:17:16 +08:00
SAVE_OPLINE ( ) ;
2017-10-27 06:28:58 +08:00
if ( ! GC_DELREF ( garbage ) ) {
2017-07-17 19:11:50 +08:00
zval_dtor_func ( garbage ) ;
2014-09-22 18:41:44 +08:00
} else {
2017-07-17 19:11:50 +08:00
gc_check_possible_root ( garbage ) ;
2014-09-22 18:41:44 +08:00
}
2017-07-18 04:17:16 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2017-07-17 19:11:50 +08:00
} else {
ZVAL_UNDEF ( var ) ;
2008-04-29 16:15:20 +08:00
}
2017-07-17 19:11:50 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
}
ZEND_VM_HANDLER ( 74 , ZEND_UNSET_VAR , CONST | TMPVAR | CV , UNUSED , VAR_FETCH )
{
USE_OPLINE
2017-11-16 22:09:32 +08:00
zval * varname ;
zend_string * name , * tmp_name ;
2017-07-17 19:11:50 +08:00
HashTable * target_symbol_table ;
zend_free_op free_op1 ;
SAVE_OPLINE ( ) ;
2008-04-29 16:15:20 +08:00
2015-06-05 06:53:32 +08:00
varname = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2004-10-23 05:42:14 +08:00
2017-11-16 22:09:32 +08:00
if ( OP1_TYPE = = IS_CONST ) {
name = Z_STR_P ( varname ) ;
} else if ( EXPECTED ( Z_TYPE_P ( varname ) = = IS_STRING ) ) {
name = Z_STR_P ( varname ) ;
tmp_name = NULL ;
} else {
2015-06-05 06:53:32 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( varname ) = = IS_UNDEF ) ) {
varname = GET_OP1_UNDEF_CV ( varname , BP_VAR_R ) ;
}
2017-11-16 22:09:32 +08:00
name = zval_get_tmp_string ( varname , & tmp_name ) ;
2004-10-23 05:42:14 +08:00
}
2018-01-31 18:47:43 +08:00
target_symbol_table = zend_get_target_symbol_table ( opline - > extended_value EXECUTE_DATA_CC ) ;
2017-11-16 22:09:32 +08:00
zend_hash_del_ind ( target_symbol_table , name ) ;
2010-05-06 18:27:35 +08:00
2017-11-16 22:09:32 +08:00
if ( OP1_TYPE ! = IS_CONST ) {
zend_tmp_string_release ( tmp_name ) ;
2015-10-27 20:47:58 +08:00
}
FREE_OP1 ( ) ;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 179 , ZEND_UNSET_STATIC_PROP , CONST | TMPVAR | CV , UNUSED | CLASS_FETCH | CONST | VAR , CACHE_SLOT )
2015-10-27 20:47:58 +08:00
{
USE_OPLINE
2017-11-16 22:09:32 +08:00
zval * varname ;
zend_string * name , * tmp_name ;
2015-10-27 20:47:58 +08:00
zend_class_entry * ce ;
zend_free_op free_op1 ;
SAVE_OPLINE ( ) ;
if ( OP2_TYPE = = IS_CONST ) {
2018-02-06 00:41:47 +08:00
ce = CACHED_PTR ( opline - > extended_value ) ;
2015-10-27 20:47:58 +08:00
if ( UNEXPECTED ( ce = = NULL ) ) {
2017-10-04 21:53:01 +08:00
ce = zend_fetch_class_by_name ( Z_STR_P ( RT_CONSTANT ( opline , opline - > op2 ) ) , RT_CONSTANT ( opline , opline - > op2 ) + 1 , ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION ) ;
2015-08-28 04:02:15 +08:00
if ( UNEXPECTED ( ce = = NULL ) ) {
2016-09-30 16:00:14 +08:00
ZEND_ASSERT ( EG ( exception ) ) ;
2018-02-06 00:41:47 +08:00
FREE_UNFETCHED_OP1 ( ) ;
2015-10-27 20:47:58 +08:00
HANDLE_EXCEPTION ( ) ;
2010-05-24 22:11:39 +08:00
}
2018-02-06 00:41:47 +08:00
/*CACHE_PTR(opline->extended_value, ce);*/
2010-05-06 18:27:35 +08:00
}
2015-10-27 20:47:58 +08:00
} else if ( OP2_TYPE = = IS_UNUSED ) {
ce = zend_fetch_class ( NULL , opline - > op2 . num ) ;
2015-11-16 18:19:22 +08:00
if ( UNEXPECTED ( ce = = NULL ) ) {
ZEND_ASSERT ( EG ( exception ) ) ;
2018-02-06 00:41:47 +08:00
FREE_UNFETCHED_OP1 ( ) ;
2015-11-16 18:19:22 +08:00
HANDLE_EXCEPTION ( ) ;
}
2004-10-23 05:42:14 +08:00
} else {
2015-10-27 20:47:58 +08:00
ce = Z_CE_P ( EX_VAR ( opline - > op2 . var ) ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
varname = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
if ( OP1_TYPE = = IS_CONST ) {
name = Z_STR_P ( varname ) ;
} else if ( EXPECTED ( Z_TYPE_P ( varname ) = = IS_STRING ) ) {
name = Z_STR_P ( varname ) ;
tmp_name = NULL ;
} else {
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( varname ) = = IS_UNDEF ) ) {
varname = GET_OP1_UNDEF_CV ( varname , BP_VAR_R ) ;
}
name = zval_get_tmp_string ( varname , & tmp_name ) ;
}
2017-11-16 22:09:32 +08:00
zend_std_unset_static_property ( ce , name ) ;
2004-10-23 05:42:14 +08:00
2017-11-16 22:09:32 +08:00
if ( OP1_TYPE ! = IS_CONST ) {
zend_tmp_string_release ( tmp_name ) ;
2004-10-23 05:42:14 +08:00
}
FREE_OP1 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2016-06-16 07:30:23 +08:00
ZEND_VM_HANDLER ( 75 , ZEND_UNSET_DIM , VAR | CV , CONST | TMPVAR | CV )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 , free_op2 ;
2014-02-10 14:04:30 +08:00
zval * container ;
2010-04-20 19:16:39 +08:00
zval * offset ;
2014-08-26 01:24:55 +08:00
zend_ulong hval ;
2015-06-05 00:14:16 +08:00
zend_string * key ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2016-04-13 06:19:20 +08:00
container = GET_OP1_OBJ_ZVAL_PTR_PTR_UNDEF ( BP_VAR_UNSET ) ;
2015-06-05 06:53:32 +08:00
offset = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2011-03-16 13:25:02 +08:00
2015-06-05 06:53:32 +08:00
do {
2016-06-16 07:30:23 +08:00
if ( EXPECTED ( Z_TYPE_P ( container ) = = IS_ARRAY ) ) {
2015-06-05 06:53:32 +08:00
HashTable * ht ;
2014-12-09 20:15:24 +08:00
2015-06-05 06:53:32 +08:00
ZEND_VM_C_LABEL ( unset_dim_array ) :
SEPARATE_ARRAY ( container ) ;
ht = Z_ARRVAL_P ( container ) ;
2014-03-26 22:07:31 +08:00
ZEND_VM_C_LABEL ( offset_again ) :
2015-06-05 06:53:32 +08:00
if ( EXPECTED ( Z_TYPE_P ( offset ) = = IS_STRING ) ) {
key = Z_STR_P ( offset ) ;
if ( OP2_TYPE ! = IS_CONST ) {
if ( ZEND_HANDLE_NUMERIC ( key , hval ) ) {
ZEND_VM_C_GOTO ( num_index_dim ) ;
}
2014-10-10 20:36:12 +08:00
}
2015-06-05 00:14:16 +08:00
ZEND_VM_C_LABEL ( str_index_dim ) :
2015-06-05 06:53:32 +08:00
if ( ht = = & EG ( symbol_table ) ) {
zend_delete_global_variable ( key ) ;
} else {
zend_hash_del ( ht , key ) ;
}
} else if ( EXPECTED ( Z_TYPE_P ( offset ) = = IS_LONG ) ) {
hval = Z_LVAL_P ( offset ) ;
ZEND_VM_C_LABEL ( num_index_dim ) :
zend_hash_index_del ( ht , hval ) ;
} else if ( ( OP2_TYPE & ( IS_VAR | IS_CV ) ) & & EXPECTED ( Z_TYPE_P ( offset ) = = IS_REFERENCE ) ) {
offset = Z_REFVAL_P ( offset ) ;
ZEND_VM_C_GOTO ( offset_again ) ;
} else if ( Z_TYPE_P ( offset ) = = IS_DOUBLE ) {
hval = zend_dval_to_lval ( Z_DVAL_P ( offset ) ) ;
ZEND_VM_C_GOTO ( num_index_dim ) ;
} else if ( Z_TYPE_P ( offset ) = = IS_NULL ) {
2015-06-29 21:44:54 +08:00
key = ZSTR_EMPTY_ALLOC ( ) ;
2015-06-05 06:53:32 +08:00
ZEND_VM_C_GOTO ( str_index_dim ) ;
} else if ( Z_TYPE_P ( offset ) = = IS_FALSE ) {
hval = 0 ;
ZEND_VM_C_GOTO ( num_index_dim ) ;
} else if ( Z_TYPE_P ( offset ) = = IS_TRUE ) {
hval = 1 ;
ZEND_VM_C_GOTO ( num_index_dim ) ;
} else if ( Z_TYPE_P ( offset ) = = IS_RESOURCE ) {
hval = Z_RES_HANDLE_P ( offset ) ;
ZEND_VM_C_GOTO ( num_index_dim ) ;
} else if ( OP2_TYPE = = IS_CV & & Z_TYPE_P ( offset ) = = IS_UNDEF ) {
GET_OP2_UNDEF_CV ( offset , BP_VAR_R ) ;
2015-06-29 21:44:54 +08:00
key = ZSTR_EMPTY_ALLOC ( ) ;
2015-06-05 06:53:32 +08:00
ZEND_VM_C_GOTO ( str_index_dim ) ;
2015-06-05 00:14:16 +08:00
} else {
2015-06-05 06:53:32 +08:00
zend_error ( E_WARNING , " Illegal offset type in unset " ) ;
}
break ;
2016-06-16 07:30:23 +08:00
} else if ( Z_ISREF_P ( container ) ) {
2015-06-05 06:53:32 +08:00
container = Z_REFVAL_P ( container ) ;
if ( EXPECTED ( Z_TYPE_P ( container ) = = IS_ARRAY ) ) {
ZEND_VM_C_GOTO ( unset_dim_array ) ;
2015-06-05 00:14:16 +08:00
}
2005-06-16 20:17:39 +08:00
}
2016-04-13 06:19:20 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( container ) = = IS_UNDEF ) ) {
container = GET_OP1_UNDEF_CV ( container , BP_VAR_R ) ;
}
2015-06-05 06:53:32 +08:00
if ( OP2_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( offset ) = = IS_UNDEF ) ) {
offset = GET_OP2_UNDEF_CV ( offset , BP_VAR_R ) ;
2015-03-09 20:57:15 +08:00
}
2016-06-16 07:30:23 +08:00
if ( EXPECTED ( Z_TYPE_P ( container ) = = IS_OBJECT ) ) {
2015-06-05 06:53:32 +08:00
if ( UNEXPECTED ( Z_OBJ_HT_P ( container ) - > unset_dimension = = NULL ) ) {
2018-02-16 07:45:31 +08:00
zend_use_object_as_array ( ) ;
2015-06-05 06:53:32 +08:00
} else {
Z_OBJ_HT_P ( container ) - > unset_dimension ( container , offset ) ;
}
} else if ( OP1_TYPE ! = IS_UNUSED & & UNEXPECTED ( Z_TYPE_P ( container ) = = IS_STRING ) ) {
2015-07-08 01:10:22 +08:00
zend_throw_error ( NULL , " Cannot unset string offsets " ) ;
2015-06-05 06:53:32 +08:00
}
} while ( 0 ) ;
2015-03-09 20:57:15 +08:00
FREE_OP2 ( ) ;
2005-06-16 20:17:39 +08:00
FREE_OP1_VAR_PTR ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2005-06-16 20:17:39 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 76 , ZEND_UNSET_OBJ , VAR | UNUSED | THIS | CV , CONST | TMPVAR | CV , CACHE_SLOT )
2005-06-16 20:17:39 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2005-06-16 20:17:39 +08:00
zend_free_op free_op1 , free_op2 ;
2014-02-10 14:04:30 +08:00
zval * container ;
2010-04-20 19:16:39 +08:00
zval * offset ;
SAVE_OPLINE ( ) ;
2014-03-04 16:27:50 +08:00
container = GET_OP1_OBJ_ZVAL_PTR_PTR ( BP_VAR_UNSET ) ;
2016-04-01 21:17:49 +08:00
if ( OP1_TYPE = = IS_UNUSED & & UNEXPECTED ( Z_TYPE_P ( container ) = = IS_UNDEF ) ) {
2017-06-15 21:23:05 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_this_not_in_object_context_helper ) ;
2015-04-01 20:54:03 +08:00
}
2010-04-20 19:16:39 +08:00
offset = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
2005-06-16 20:17:39 +08:00
2015-01-03 17:22:58 +08:00
do {
2014-12-09 06:09:44 +08:00
if ( OP1_TYPE ! = IS_UNUSED & & UNEXPECTED ( Z_TYPE_P ( container ) ! = IS_OBJECT ) ) {
if ( Z_ISREF_P ( container ) ) {
container = Z_REFVAL_P ( container ) ;
if ( Z_TYPE_P ( container ) ! = IS_OBJECT ) {
break ;
}
} else {
break ;
}
}
2014-04-04 23:01:53 +08:00
if ( Z_OBJ_HT_P ( container ) - > unset_property ) {
2018-02-06 00:41:47 +08:00
Z_OBJ_HT_P ( container ) - > unset_property ( container , offset , ( ( OP2_TYPE = = IS_CONST ) ? CACHE_ADDR ( opline - > extended_value ) : NULL ) ) ;
2005-06-16 20:17:39 +08:00
} else {
2017-12-22 21:35:52 +08:00
zend_wrong_property_unset ( offset ) ;
2004-10-23 05:42:14 +08:00
}
2014-12-09 06:09:44 +08:00
} while ( 0 ) ;
2014-04-16 01:56:30 +08:00
FREE_OP2 ( ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1_VAR_PTR ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2015-10-30 03:50:45 +08:00
ZEND_VM_HANDLER ( 77 , ZEND_FE_RESET_R , CONST | TMP | VAR | CV , JMP_ADDR )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 ;
2015-02-12 18:57:12 +08:00
zval * array_ptr , * result ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2015-02-12 18:57:12 +08:00
array_ptr = GET_OP1_ZVAL_PTR_DEREF ( BP_VAR_R ) ;
if ( EXPECTED ( Z_TYPE_P ( array_ptr ) = = IS_ARRAY ) ) {
result = EX_VAR ( opline - > result . var ) ;
ZVAL_COPY_VALUE ( result , array_ptr ) ;
if ( OP1_TYPE ! = IS_TMP_VAR & & Z_OPT_REFCOUNTED_P ( result ) ) {
Z_ADDREF_P ( array_ptr ) ;
}
Z_FE_POS_P ( result ) = 0 ;
FREE_OP1_IF_VAR ( ) ;
2016-12-02 20:58:47 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
2015-02-12 18:57:12 +08:00
} else if ( OP1_TYPE ! = IS_CONST & & EXPECTED ( Z_TYPE_P ( array_ptr ) = = IS_OBJECT ) ) {
if ( ! Z_OBJCE_P ( array_ptr ) - > get_iterator ) {
result = EX_VAR ( opline - > result . var ) ;
ZVAL_COPY_VALUE ( result , array_ptr ) ;
if ( OP1_TYPE ! = IS_TMP_VAR ) {
2014-02-10 14:04:30 +08:00
Z_ADDREF_P ( array_ptr ) ;
2004-10-23 05:42:14 +08:00
}
2016-06-08 04:18:52 +08:00
if ( Z_OBJ_P ( array_ptr ) - > properties
& & UNEXPECTED ( GC_REFCOUNT ( Z_OBJ_P ( array_ptr ) - > properties ) > 1 ) ) {
if ( EXPECTED ( ! ( GC_FLAGS ( Z_OBJ_P ( array_ptr ) - > properties ) & IS_ARRAY_IMMUTABLE ) ) ) {
2017-10-27 06:28:58 +08:00
GC_DELREF ( Z_OBJ_P ( array_ptr ) - > properties ) ;
2016-06-08 04:18:52 +08:00
}
Z_OBJ_P ( array_ptr ) - > properties = zend_array_dup ( Z_OBJ_P ( array_ptr ) - > properties ) ;
}
2017-06-21 03:26:46 +08:00
Z_FE_ITER_P ( EX_VAR ( opline - > result . var ) ) = zend_hash_iterator_add ( Z_OBJPROP_P ( array_ptr ) , 0 ) ;
2015-02-12 18:57:12 +08:00
FREE_OP1_IF_VAR ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
} else {
2015-02-12 18:57:12 +08:00
zend_class_entry * ce = Z_OBJCE_P ( array_ptr ) ;
zend_object_iterator * iter = ce - > get_iterator ( ce , array_ptr , 0 ) ;
zend_bool is_empty ;
if ( UNEXPECTED ( ! iter ) | | UNEXPECTED ( EG ( exception ) ) ) {
FREE_OP1 ( ) ;
2016-07-15 04:29:04 +08:00
if ( iter ) {
OBJ_RELEASE ( & iter - > std ) ;
}
2015-02-12 18:57:12 +08:00
if ( ! EG ( exception ) ) {
2015-06-30 18:59:27 +08:00
zend_throw_exception_ex ( NULL , 0 , " Object of type %s did not create an Iterator " , ZSTR_VAL ( ce - > name ) ) ;
2009-08-17 15:40:43 +08:00
}
2016-12-07 05:41:07 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2015-02-12 18:57:12 +08:00
HANDLE_EXCEPTION ( ) ;
2009-08-17 15:40:43 +08:00
}
2015-02-12 18:57:12 +08:00
iter - > index = 0 ;
if ( iter - > funcs - > rewind ) {
iter - > funcs - > rewind ( iter ) ;
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
OBJ_RELEASE ( & iter - > std ) ;
FREE_OP1 ( ) ;
2016-12-07 05:41:07 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2015-02-12 18:57:12 +08:00
HANDLE_EXCEPTION ( ) ;
2013-05-17 17:15:09 +08:00
}
2006-10-03 17:05:14 +08:00
}
2015-02-12 18:57:12 +08:00
is_empty = iter - > funcs - > valid ( iter ) ! = SUCCESS ;
2016-12-02 16:58:36 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
OBJ_RELEASE ( & iter - > std ) ;
FREE_OP1 ( ) ;
2016-12-07 05:41:07 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2016-12-02 16:58:36 +08:00
HANDLE_EXCEPTION ( ) ;
}
iter - > index = - 1 ; /* will be set to 0 before using next handler */
ZVAL_OBJ ( EX_VAR ( opline - > result . var ) , & iter - > std ) ;
Z_FE_ITER_P ( EX_VAR ( opline - > result . var ) ) = ( uint32_t ) - 1 ;
2015-02-12 18:57:12 +08:00
FREE_OP1 ( ) ;
2016-12-07 05:41:07 +08:00
if ( UNEXPECTED ( EG ( exception ) ) ) {
HANDLE_EXCEPTION ( ) ;
} else if ( is_empty ) {
ZEND_VM_SET_OPCODE ( OP_JMP_ADDR ( opline , opline - > op2 ) ) ;
ZEND_VM_CONTINUE ( ) ;
2014-05-29 22:21:56 +08:00
} else {
2016-12-07 05:41:07 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
2013-05-17 17:15:09 +08:00
}
2004-10-23 05:42:14 +08:00
}
2015-02-12 18:57:12 +08:00
} else {
zend_error ( E_WARNING , " Invalid argument supplied for foreach() " ) ;
2016-12-02 16:58:36 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
Z_FE_ITER_P ( EX_VAR ( opline - > result . var ) ) = ( uint32_t ) - 1 ;
2015-02-12 18:57:12 +08:00
FREE_OP1 ( ) ;
ZEND_VM_JMP ( OP_JMP_ADDR ( opline , opline - > op2 ) ) ;
2004-10-23 05:42:14 +08:00
}
2015-02-12 18:57:12 +08:00
}
2004-10-23 05:42:14 +08:00
2015-10-30 03:50:45 +08:00
ZEND_VM_HANDLER ( 125 , ZEND_FE_RESET_RW , CONST | TMP | VAR | CV , JMP_ADDR )
2015-02-12 18:57:12 +08:00
{
USE_OPLINE
zend_free_op free_op1 ;
zval * array_ptr , * array_ref ;
2004-10-23 05:42:14 +08:00
2015-02-12 18:57:12 +08:00
SAVE_OPLINE ( ) ;
2004-10-23 05:42:14 +08:00
2015-02-12 18:57:12 +08:00
if ( OP1_TYPE = = IS_VAR | | OP1_TYPE = = IS_CV ) {
array_ref = array_ptr = GET_OP1_ZVAL_PTR_PTR ( BP_VAR_R ) ;
if ( Z_ISREF_P ( array_ref ) ) {
array_ptr = Z_REFVAL_P ( array_ref ) ;
2013-05-17 17:15:09 +08:00
}
2015-02-12 18:57:12 +08:00
} else {
array_ref = array_ptr = GET_OP1_ZVAL_PTR ( BP_VAR_R ) ;
}
if ( EXPECTED ( Z_TYPE_P ( array_ptr ) = = IS_ARRAY ) ) {
if ( OP1_TYPE = = IS_VAR | | OP1_TYPE = = IS_CV ) {
if ( array_ptr = = array_ref ) {
ZVAL_NEW_REF ( array_ref , array_ref ) ;
array_ptr = Z_REFVAL_P ( array_ref ) ;
}
Z_ADDREF_P ( array_ref ) ;
ZVAL_COPY_VALUE ( EX_VAR ( opline - > result . var ) , array_ref ) ;
2004-10-23 05:42:14 +08:00
} else {
2015-12-18 06:21:48 +08:00
array_ref = EX_VAR ( opline - > result . var ) ;
ZVAL_NEW_REF ( array_ref , array_ptr ) ;
array_ptr = Z_REFVAL_P ( array_ref ) ;
2013-05-17 17:15:09 +08:00
}
2015-02-12 18:57:12 +08:00
if ( OP1_TYPE = = IS_CONST ) {
2018-01-17 22:56:04 +08:00
ZVAL_ARR ( array_ptr , zend_array_dup ( Z_ARRVAL_P ( array_ptr ) ) ) ;
2004-10-23 05:42:14 +08:00
} else {
2015-02-12 18:57:12 +08:00
SEPARATE_ARRAY ( array_ptr ) ;
}
2017-06-21 03:26:46 +08:00
Z_FE_ITER_P ( EX_VAR ( opline - > result . var ) ) = zend_hash_iterator_add ( Z_ARRVAL_P ( array_ptr ) , 0 ) ;
2004-10-23 05:42:14 +08:00
2017-11-25 05:57:45 +08:00
if ( OP1_TYPE = = IS_VAR ) {
FREE_OP1_VAR_PTR ( ) ;
}
2016-12-02 20:58:47 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
2015-02-12 18:57:12 +08:00
} else if ( OP1_TYPE ! = IS_CONST & & EXPECTED ( Z_TYPE_P ( array_ptr ) = = IS_OBJECT ) ) {
if ( ! Z_OBJCE_P ( array_ptr ) - > get_iterator ) {
if ( OP1_TYPE = = IS_VAR | | OP1_TYPE = = IS_CV ) {
if ( array_ptr = = array_ref ) {
ZVAL_NEW_REF ( array_ref , array_ref ) ;
array_ptr = Z_REFVAL_P ( array_ref ) ;
}
Z_ADDREF_P ( array_ref ) ;
ZVAL_COPY_VALUE ( EX_VAR ( opline - > result . var ) , array_ref ) ;
} else {
array_ptr = EX_VAR ( opline - > result . var ) ;
ZVAL_COPY_VALUE ( array_ptr , array_ref ) ;
}
2016-06-08 04:18:52 +08:00
if ( Z_OBJ_P ( array_ptr ) - > properties
& & UNEXPECTED ( GC_REFCOUNT ( Z_OBJ_P ( array_ptr ) - > properties ) > 1 ) ) {
if ( EXPECTED ( ! ( GC_FLAGS ( Z_OBJ_P ( array_ptr ) - > properties ) & IS_ARRAY_IMMUTABLE ) ) ) {
2017-10-27 06:28:58 +08:00
GC_DELREF ( Z_OBJ_P ( array_ptr ) - > properties ) ;
2016-06-08 04:18:52 +08:00
}
Z_OBJ_P ( array_ptr ) - > properties = zend_array_dup ( Z_OBJ_P ( array_ptr ) - > properties ) ;
}
2017-06-21 03:26:46 +08:00
Z_FE_ITER_P ( EX_VAR ( opline - > result . var ) ) = zend_hash_iterator_add ( Z_OBJPROP_P ( array_ptr ) , 0 ) ;
2004-10-23 05:42:14 +08:00
2017-11-25 05:57:45 +08:00
if ( OP1_TYPE = = IS_VAR ) {
FREE_OP1_VAR_PTR ( ) ;
}
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2015-02-12 18:57:12 +08:00
} else {
zend_class_entry * ce = Z_OBJCE_P ( array_ptr ) ;
zend_object_iterator * iter = ce - > get_iterator ( ce , array_ptr , 1 ) ;
zend_bool is_empty ;
if ( UNEXPECTED ( ! iter ) | | UNEXPECTED ( EG ( exception ) ) ) {
if ( OP1_TYPE = = IS_VAR ) {
FREE_OP1_VAR_PTR ( ) ;
} else {
FREE_OP1 ( ) ;
}
if ( ! EG ( exception ) ) {
2015-06-30 18:59:27 +08:00
zend_throw_exception_ex ( NULL , 0 , " Object of type %s did not create an Iterator " , ZSTR_VAL ( ce - > name ) ) ;
2015-02-12 18:57:12 +08:00
}
2016-12-07 05:41:07 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2015-02-12 18:57:12 +08:00
HANDLE_EXCEPTION ( ) ;
}
iter - > index = 0 ;
if ( iter - > funcs - > rewind ) {
iter - > funcs - > rewind ( iter ) ;
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
OBJ_RELEASE ( & iter - > std ) ;
if ( OP1_TYPE = = IS_VAR ) {
FREE_OP1_VAR_PTR ( ) ;
} else {
FREE_OP1 ( ) ;
}
2016-12-07 05:41:07 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2015-02-12 18:57:12 +08:00
HANDLE_EXCEPTION ( ) ;
}
}
is_empty = iter - > funcs - > valid ( iter ) ! = SUCCESS ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2015-02-12 18:57:12 +08:00
OBJ_RELEASE ( & iter - > std ) ;
if ( OP1_TYPE = = IS_VAR ) {
2013-05-17 17:15:09 +08:00
FREE_OP1_VAR_PTR ( ) ;
2015-02-12 18:57:12 +08:00
} else {
FREE_OP1 ( ) ;
2013-05-17 17:15:09 +08:00
}
2016-12-07 05:41:07 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2010-04-20 19:16:39 +08:00
HANDLE_EXCEPTION ( ) ;
2005-04-27 14:47:08 +08:00
}
2016-12-02 16:58:36 +08:00
iter - > index = - 1 ; /* will be set to 0 before using next handler */
ZVAL_OBJ ( EX_VAR ( opline - > result . var ) , & iter - > std ) ;
Z_FE_ITER_P ( EX_VAR ( opline - > result . var ) ) = ( uint32_t ) - 1 ;
2015-02-12 18:57:12 +08:00
if ( OP1_TYPE = = IS_VAR ) {
2013-05-17 17:15:09 +08:00
FREE_OP1_VAR_PTR ( ) ;
2015-02-12 18:57:12 +08:00
} else {
FREE_OP1 ( ) ;
}
2016-12-07 05:41:07 +08:00
if ( UNEXPECTED ( EG ( exception ) ) ) {
HANDLE_EXCEPTION ( ) ;
} else if ( is_empty ) {
ZEND_VM_SET_OPCODE ( OP_JMP_ADDR ( opline , opline - > op2 ) ) ;
ZEND_VM_CONTINUE ( ) ;
2015-02-12 18:57:12 +08:00
} else {
2016-12-07 05:41:07 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
2013-05-17 17:15:09 +08:00
}
2005-04-27 14:47:08 +08:00
}
2015-02-12 18:57:12 +08:00
} else {
zend_error ( E_WARNING , " Invalid argument supplied for foreach() " ) ;
2016-12-02 16:58:36 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
Z_FE_ITER_P ( EX_VAR ( opline - > result . var ) ) = ( uint32_t ) - 1 ;
2015-02-12 18:57:12 +08:00
if ( OP1_TYPE = = IS_VAR ) {
FREE_OP1_VAR_PTR ( ) ;
} else {
FREE_OP1 ( ) ;
}
ZEND_VM_JMP ( OP_JMP_ADDR ( opline , opline - > op2 ) ) ;
}
}
2015-10-30 19:53:53 +08:00
ZEND_VM_HANDLER ( 78 , ZEND_FE_FETCH_R , VAR , ANY , JMP_ADDR )
2015-02-12 18:57:12 +08:00
{
USE_OPLINE
zval * array ;
zval * value ;
2015-05-13 17:55:42 +08:00
uint32_t value_type ;
2015-02-12 18:57:12 +08:00
HashTable * fe_ht ;
HashPosition pos ;
Bucket * p ;
2014-09-16 05:34:27 +08:00
2015-02-12 18:57:12 +08:00
array = EX_VAR ( opline - > op1 . var ) ;
SAVE_OPLINE ( ) ;
if ( EXPECTED ( Z_TYPE_P ( array ) = = IS_ARRAY ) ) {
fe_ht = Z_ARRVAL_P ( array ) ;
2015-05-13 17:55:42 +08:00
pos = Z_FE_POS_P ( array ) ;
2015-04-28 17:41:39 +08:00
p = fe_ht - > arData + pos ;
2014-09-16 05:34:27 +08:00
while ( 1 ) {
2015-02-12 18:57:12 +08:00
if ( UNEXPECTED ( pos > = fe_ht - > nNumUsed ) ) {
/* reached end of iteration */
2015-05-13 17:55:42 +08:00
ZEND_VM_C_GOTO ( fe_fetch_r_exit ) ;
2005-02-05 22:01:59 +08:00
}
2015-02-12 18:57:12 +08:00
value = & p - > val ;
2015-05-13 17:55:42 +08:00
value_type = Z_TYPE_INFO_P ( value ) ;
2017-06-21 03:26:46 +08:00
if ( EXPECTED ( value_type ! = IS_UNDEF ) ) {
if ( UNEXPECTED ( value_type = = IS_INDIRECT ) ) {
value = Z_INDIRECT_P ( value ) ;
value_type = Z_TYPE_INFO_P ( value ) ;
if ( EXPECTED ( value_type ! = IS_UNDEF ) ) {
break ;
}
} else {
break ;
2015-02-12 18:57:12 +08:00
}
2014-09-16 05:34:27 +08:00
}
2017-06-21 03:26:46 +08:00
pos + + ;
p + + ;
2015-02-12 18:57:12 +08:00
}
2015-05-13 17:55:42 +08:00
Z_FE_POS_P ( array ) = pos + 1 ;
2015-12-24 00:02:14 +08:00
if ( opline - > result_type & ( IS_TMP_VAR | IS_CV ) ) {
2015-02-12 18:57:12 +08:00
if ( ! p - > key ) {
2015-05-13 17:55:42 +08:00
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , p - > h ) ;
2015-02-12 18:57:12 +08:00
} else {
2015-05-13 17:55:42 +08:00
ZVAL_STR_COPY ( EX_VAR ( opline - > result . var ) , p - > key ) ;
2014-09-16 05:34:27 +08:00
}
2005-02-05 22:01:59 +08:00
}
2015-02-12 18:57:12 +08:00
} else if ( EXPECTED ( Z_TYPE_P ( array ) = = IS_OBJECT ) ) {
zend_object_iterator * iter ;
if ( ( iter = zend_iterator_unwrap ( array ) ) = = NULL ) {
/* plain object */
2018-01-10 07:22:07 +08:00
fe_ht = Z_OBJPROP_P ( array ) ;
2015-05-13 17:55:42 +08:00
pos = zend_hash_iterator_pos ( Z_FE_ITER_P ( array ) , fe_ht ) ;
2015-04-28 17:41:39 +08:00
p = fe_ht - > arData + pos ;
2015-02-12 18:57:12 +08:00
while ( 1 ) {
if ( UNEXPECTED ( pos > = fe_ht - > nNumUsed ) ) {
/* reached end of iteration */
2015-05-13 17:55:42 +08:00
ZEND_VM_C_GOTO ( fe_fetch_r_exit ) ;
2015-02-12 18:57:12 +08:00
}
value = & p - > val ;
2015-05-13 17:55:42 +08:00
value_type = Z_TYPE_INFO_P ( value ) ;
2017-06-21 03:26:46 +08:00
if ( EXPECTED ( value_type ! = IS_UNDEF ) ) {
if ( UNEXPECTED ( value_type = = IS_INDIRECT ) ) {
value = Z_INDIRECT_P ( value ) ;
value_type = Z_TYPE_INFO_P ( value ) ;
if ( EXPECTED ( value_type ! = IS_UNDEF )
& & EXPECTED ( zend_check_property_access ( Z_OBJ_P ( array ) , p - > key ) = = SUCCESS ) ) {
break ;
}
} else {
break ;
2016-11-23 04:01:15 +08:00
}
2015-02-12 18:57:12 +08:00
}
2017-06-21 03:26:46 +08:00
pos + + ;
p + + ;
2015-02-12 18:57:12 +08:00
}
2015-12-24 00:02:14 +08:00
if ( opline - > result_type & ( IS_TMP_VAR | IS_CV ) ) {
2015-02-12 18:57:12 +08:00
if ( UNEXPECTED ( ! p - > key ) ) {
2015-05-13 17:55:42 +08:00
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , p - > h ) ;
2015-06-30 18:59:27 +08:00
} else if ( ZSTR_VAL ( p - > key ) [ 0 ] ) {
2015-05-13 17:55:42 +08:00
ZVAL_STR_COPY ( EX_VAR ( opline - > result . var ) , p - > key ) ;
2015-02-12 18:57:12 +08:00
} else {
const char * class_name , * prop_name ;
size_t prop_name_len ;
zend_unmangle_property_name_ex (
p - > key , & class_name , & prop_name , & prop_name_len ) ;
2015-05-13 17:55:42 +08:00
ZVAL_STRINGL ( EX_VAR ( opline - > result . var ) , prop_name , prop_name_len ) ;
2015-02-12 18:57:12 +08:00
}
}
2018-03-22 07:41:49 +08:00
EG ( ht_iterators ) [ Z_FE_ITER_P ( array ) ] . pos = pos + 1 ;
2015-02-12 18:57:12 +08:00
} else {
2015-05-13 17:55:42 +08:00
if ( EXPECTED ( + + iter - > index > 0 ) ) {
2015-02-12 18:57:12 +08:00
/* This could cause an endless loop if index becomes zero again.
* In case that ever happens we need an additional flag . */
iter - > funcs - > move_forward ( iter ) ;
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2015-02-12 18:57:12 +08:00
HANDLE_EXCEPTION ( ) ;
}
2015-05-13 17:55:42 +08:00
if ( UNEXPECTED ( iter - > funcs - > valid ( iter ) = = FAILURE ) ) {
/* reached end of iteration */
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2015-05-13 17:55:42 +08:00
HANDLE_EXCEPTION ( ) ;
}
ZEND_VM_C_GOTO ( fe_fetch_r_exit ) ;
2015-02-12 18:57:12 +08:00
}
}
value = iter - > funcs - > get_current_data ( iter ) ;
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2015-02-12 18:57:12 +08:00
HANDLE_EXCEPTION ( ) ;
}
if ( ! value ) {
/* failure in get_current_data */
2015-05-13 17:55:42 +08:00
ZEND_VM_C_GOTO ( fe_fetch_r_exit ) ;
2015-02-12 18:57:12 +08:00
}
2015-12-24 00:02:14 +08:00
if ( opline - > result_type & ( IS_TMP_VAR | IS_CV ) ) {
2015-02-12 18:57:12 +08:00
if ( iter - > funcs - > get_current_key ) {
2015-05-13 17:55:42 +08:00
iter - > funcs - > get_current_key ( iter , EX_VAR ( opline - > result . var ) ) ;
2015-02-12 18:57:12 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2015-02-12 18:57:12 +08:00
HANDLE_EXCEPTION ( ) ;
}
} else {
2015-05-13 17:55:42 +08:00
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , iter - > index ) ;
2015-02-12 18:57:12 +08:00
}
}
2015-05-13 17:55:42 +08:00
value_type = Z_TYPE_INFO_P ( value ) ;
2015-02-12 18:57:12 +08:00
}
2004-10-23 05:42:14 +08:00
} else {
zend_error ( E_WARNING , " Invalid argument supplied for foreach() " ) ;
2015-09-09 16:54:44 +08:00
if ( UNEXPECTED ( EG ( exception ) ) ) {
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2015-09-09 16:54:44 +08:00
HANDLE_EXCEPTION ( ) ;
2015-05-13 17:55:42 +08:00
}
2015-09-09 16:54:44 +08:00
ZEND_VM_C_LABEL ( fe_fetch_r_exit ) :
ZEND_VM_SET_RELATIVE_OPCODE ( opline , opline - > extended_value ) ;
2015-05-13 17:55:42 +08:00
ZEND_VM_CONTINUE ( ) ;
2005-02-05 22:01:59 +08:00
}
2015-05-13 17:55:42 +08:00
if ( EXPECTED ( OP2_TYPE = = IS_CV ) ) {
2017-06-16 06:42:49 +08:00
zval * variable_ptr = _get_zval_ptr_cv_undef_BP_VAR_W ( opline - > op2 . var EXECUTE_DATA_CC ) ;
2015-05-13 17:55:42 +08:00
zend_assign_to_variable ( variable_ptr , value , IS_CV ) ;
} else {
zval * res = EX_VAR ( opline - > op2 . var ) ;
zend_refcounted * gc = Z_COUNTED_P ( value ) ;
ZVAL_COPY_VALUE_EX ( res , value , gc , value_type ) ;
2018-02-16 20:37:04 +08:00
if ( Z_TYPE_INFO_REFCOUNTED ( value_type ) ) {
2017-10-27 06:28:58 +08:00
GC_ADDREF ( gc ) ;
2015-05-13 17:55:42 +08:00
}
}
2017-06-25 22:45:17 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2015-10-30 19:53:53 +08:00
ZEND_VM_HANDLER ( 126 , ZEND_FE_FETCH_RW , VAR , ANY , JMP_ADDR )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2015-02-12 18:57:12 +08:00
zval * array ;
2014-02-10 14:04:30 +08:00
zval * value ;
2015-05-13 17:55:42 +08:00
uint32_t value_type ;
2004-10-23 05:42:14 +08:00
HashTable * fe_ht ;
2014-09-16 05:34:27 +08:00
HashPosition pos ;
Bucket * p ;
2014-03-06 03:22:50 +08:00
2015-02-12 18:57:12 +08:00
array = EX_VAR ( opline - > op1 . var ) ;
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2015-02-12 18:57:12 +08:00
ZVAL_DEREF ( array ) ;
2014-09-16 05:34:27 +08:00
if ( EXPECTED ( Z_TYPE_P ( array ) = = IS_ARRAY ) ) {
2015-12-21 20:57:53 +08:00
pos = zend_hash_iterator_pos_ex ( Z_FE_ITER_P ( EX_VAR ( opline - > op1 . var ) ) , array ) ;
2014-09-16 05:34:27 +08:00
fe_ht = Z_ARRVAL_P ( array ) ;
2015-04-28 17:41:39 +08:00
p = fe_ht - > arData + pos ;
2014-09-16 05:34:27 +08:00
while ( 1 ) {
if ( UNEXPECTED ( pos > = fe_ht - > nNumUsed ) ) {
/* reached end of iteration */
2015-05-13 17:55:42 +08:00
ZEND_VM_C_GOTO ( fe_fetch_w_exit ) ;
2014-09-16 05:34:27 +08:00
}
value = & p - > val ;
2015-05-13 17:55:42 +08:00
value_type = Z_TYPE_INFO_P ( value ) ;
2017-06-21 03:26:46 +08:00
if ( EXPECTED ( value_type ! = IS_UNDEF ) ) {
if ( UNEXPECTED ( value_type = = IS_INDIRECT ) ) {
value = Z_INDIRECT_P ( value ) ;
value_type = Z_TYPE_INFO_P ( value ) ;
if ( EXPECTED ( value_type ! = IS_UNDEF ) ) {
break ;
}
} else {
break ;
2014-09-16 05:34:27 +08:00
}
}
2017-06-21 03:26:46 +08:00
pos + + ;
p + + ;
2015-02-12 18:57:12 +08:00
}
2015-12-24 00:02:14 +08:00
if ( opline - > result_type & ( IS_TMP_VAR | IS_CV ) ) {
2015-02-12 18:57:12 +08:00
if ( ! p - > key ) {
2015-05-13 17:55:42 +08:00
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , p - > h ) ;
2014-09-16 05:34:27 +08:00
} else {
2015-05-13 17:55:42 +08:00
ZVAL_STR_COPY ( EX_VAR ( opline - > result . var ) , p - > key ) ;
2014-09-16 05:34:27 +08:00
}
}
2018-03-22 07:41:49 +08:00
EG ( ht_iterators ) [ Z_FE_ITER_P ( EX_VAR ( opline - > op1 . var ) ) ] . pos = pos + 1 ;
2014-09-16 05:34:27 +08:00
} else if ( EXPECTED ( Z_TYPE_P ( array ) = = IS_OBJECT ) ) {
zend_object_iterator * iter ;
2015-01-03 17:22:58 +08:00
2014-12-14 06:06:14 +08:00
if ( ( iter = zend_iterator_unwrap ( array ) ) = = NULL ) {
2014-09-16 05:34:27 +08:00
/* plain object */
2015-01-03 17:22:58 +08:00
2018-01-10 07:22:07 +08:00
fe_ht = Z_OBJPROP_P ( array ) ;
2015-02-12 18:57:12 +08:00
pos = zend_hash_iterator_pos ( Z_FE_ITER_P ( EX_VAR ( opline - > op1 . var ) ) , fe_ht ) ;
2015-04-28 17:41:39 +08:00
p = fe_ht - > arData + pos ;
2014-03-26 22:07:31 +08:00
while ( 1 ) {
2014-09-16 05:34:27 +08:00
if ( UNEXPECTED ( pos > = fe_ht - > nNumUsed ) ) {
2004-10-23 05:42:14 +08:00
/* reached end of iteration */
2015-05-13 17:55:42 +08:00
ZEND_VM_C_GOTO ( fe_fetch_w_exit ) ;
2004-10-23 05:42:14 +08:00
}
2014-03-26 22:07:31 +08:00
2014-09-16 05:34:27 +08:00
value = & p - > val ;
2015-05-13 17:55:42 +08:00
value_type = Z_TYPE_INFO_P ( value ) ;
2017-06-21 03:26:46 +08:00
if ( EXPECTED ( value_type ! = IS_UNDEF ) ) {
if ( UNEXPECTED ( value_type = = IS_INDIRECT ) ) {
value = Z_INDIRECT_P ( value ) ;
value_type = Z_TYPE_INFO_P ( value ) ;
if ( EXPECTED ( value_type ! = IS_UNDEF )
& & EXPECTED ( zend_check_property_access ( Z_OBJ_P ( array ) , p - > key ) = = SUCCESS ) ) {
break ;
}
} else {
break ;
2014-03-26 22:07:31 +08:00
}
}
2014-09-16 05:34:27 +08:00
pos + + ;
2015-04-28 17:41:39 +08:00
p + + ;
2014-03-26 22:07:31 +08:00
}
2015-12-24 00:02:14 +08:00
if ( opline - > result_type & ( IS_TMP_VAR | IS_CV ) ) {
2015-02-12 18:57:12 +08:00
if ( UNEXPECTED ( ! p - > key ) ) {
2015-05-13 17:55:42 +08:00
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , p - > h ) ;
2015-06-30 18:59:27 +08:00
} else if ( ZSTR_VAL ( p - > key ) [ 0 ] ) {
2015-05-13 17:55:42 +08:00
ZVAL_STR_COPY ( EX_VAR ( opline - > result . var ) , p - > key ) ;
2015-02-12 18:57:12 +08:00
} else {
const char * class_name , * prop_name ;
size_t prop_name_len ;
zend_unmangle_property_name_ex (
p - > key , & class_name , & prop_name , & prop_name_len ) ;
2015-05-13 17:55:42 +08:00
ZVAL_STRINGL ( EX_VAR ( opline - > result . var ) , prop_name , prop_name_len ) ;
2015-02-12 18:57:12 +08:00
}
2004-10-23 05:42:14 +08:00
}
2018-03-22 07:41:49 +08:00
EG ( ht_iterators ) [ Z_FE_ITER_P ( EX_VAR ( opline - > op1 . var ) ) ] . pos = pos + 1 ;
2014-09-16 05:34:27 +08:00
} else {
2015-05-13 17:55:42 +08:00
if ( + + iter - > index > 0 ) {
2004-10-23 05:42:14 +08:00
/* This could cause an endless loop if index becomes zero again.
* In case that ever happens we need an additional flag . */
2014-12-14 06:06:14 +08:00
iter - > funcs - > move_forward ( iter ) ;
2010-04-20 19:16:39 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2010-04-20 19:16:39 +08:00
HANDLE_EXCEPTION ( ) ;
2005-04-27 14:47:08 +08:00
}
2015-05-13 17:55:42 +08:00
if ( UNEXPECTED ( iter - > funcs - > valid ( iter ) = = FAILURE ) ) {
/* reached end of iteration */
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2015-05-13 17:55:42 +08:00
HANDLE_EXCEPTION ( ) ;
}
ZEND_VM_C_GOTO ( fe_fetch_w_exit ) ;
2005-04-27 14:47:08 +08:00
}
2004-10-23 05:42:14 +08:00
}
2014-12-14 06:06:14 +08:00
value = iter - > funcs - > get_current_data ( iter ) ;
2010-04-20 19:16:39 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2010-04-20 19:16:39 +08:00
HANDLE_EXCEPTION ( ) ;
2005-06-06 16:24:05 +08:00
}
2004-10-23 05:42:14 +08:00
if ( ! value ) {
/* failure in get_current_data */
2015-05-13 17:55:42 +08:00
ZEND_VM_C_GOTO ( fe_fetch_w_exit ) ;
2004-10-23 05:42:14 +08:00
}
2015-12-24 00:02:14 +08:00
if ( opline - > result_type & ( IS_TMP_VAR | IS_CV ) ) {
2004-10-23 05:42:14 +08:00
if ( iter - > funcs - > get_current_key ) {
2015-05-13 17:55:42 +08:00
iter - > funcs - > get_current_key ( iter , EX_VAR ( opline - > result . var ) ) ;
2010-04-20 19:16:39 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2010-04-20 19:16:39 +08:00
HANDLE_EXCEPTION ( ) ;
2005-04-27 14:47:08 +08:00
}
2004-10-23 05:42:14 +08:00
} else {
2015-05-13 17:55:42 +08:00
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , iter - > index ) ;
2004-10-23 05:42:14 +08:00
}
}
2015-05-13 17:55:42 +08:00
value_type = Z_TYPE_INFO_P ( value ) ;
2014-09-16 05:34:27 +08:00
}
2014-06-05 20:04:11 +08:00
} else {
2014-09-16 05:34:27 +08:00
zend_error ( E_WARNING , " Invalid argument supplied for foreach() " ) ;
2015-09-09 16:54:44 +08:00
if ( UNEXPECTED ( EG ( exception ) ) ) {
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2015-09-09 16:54:44 +08:00
HANDLE_EXCEPTION ( ) ;
2015-05-13 17:55:42 +08:00
}
2015-09-09 16:54:44 +08:00
ZEND_VM_C_LABEL ( fe_fetch_w_exit ) :
ZEND_VM_SET_RELATIVE_OPCODE ( opline , opline - > extended_value ) ;
2015-05-13 17:55:42 +08:00
ZEND_VM_CONTINUE ( ) ;
}
if ( EXPECTED ( ( value_type & Z_TYPE_MASK ) ! = IS_REFERENCE ) ) {
zend_refcounted * gc = Z_COUNTED_P ( value ) ;
zval * ref ;
ZVAL_NEW_EMPTY_REF ( value ) ;
ref = Z_REFVAL_P ( value ) ;
ZVAL_COPY_VALUE_EX ( ref , value , gc , value_type ) ;
2005-02-08 00:09:54 +08:00
}
2015-05-13 17:55:42 +08:00
if ( EXPECTED ( OP2_TYPE = = IS_CV ) ) {
2017-06-16 06:42:49 +08:00
zval * variable_ptr = _get_zval_ptr_cv_undef_BP_VAR_W ( opline - > op2 . var EXECUTE_DATA_CC ) ;
2015-05-13 17:55:42 +08:00
if ( EXPECTED ( variable_ptr ! = value ) ) {
zend_reference * ref ;
ref = Z_REF_P ( value ) ;
2017-10-27 06:28:58 +08:00
GC_ADDREF ( ref ) ;
2015-05-13 17:55:42 +08:00
zval_ptr_dtor ( variable_ptr ) ;
ZVAL_REF ( variable_ptr , ref ) ;
}
} else {
Z_ADDREF_P ( value ) ;
ZVAL_REF ( EX_VAR ( opline - > op2 . var ) , Z_REF_P ( value ) ) ;
}
2017-06-25 22:45:17 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-03-22 18:03:45 +08:00
ZEND_VM_HOT_HANDLER ( 197 , ZEND_ISSET_ISEMPTY_CV , CV , UNUSED , ISSET , SPEC ( ISSET ) )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2014-02-10 14:04:30 +08:00
zval * value ;
2015-04-29 09:17:59 +08:00
int result ;
2004-10-23 05:42:14 +08:00
2017-07-17 19:11:50 +08:00
value = EX_VAR ( opline - > op1 . var ) ;
if ( opline - > extended_value & ZEND_ISSET ) {
result =
Z_TYPE_P ( value ) > IS_NULL & &
( ! Z_ISREF_P ( value ) | | Z_TYPE_P ( Z_REFVAL_P ( value ) ) ! = IS_NULL ) ;
2018-01-31 03:06:05 +08:00
} else {
2015-04-29 09:17:59 +08:00
SAVE_OPLINE ( ) ;
2017-07-17 19:11:50 +08:00
result = ! i_zend_is_true ( value ) ;
if ( UNEXPECTED ( EG ( exception ) ) ) {
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
HANDLE_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2017-07-17 19:11:50 +08:00
}
ZEND_VM_SMART_BRANCH ( result , 0 ) ;
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
ZEND_VM_SET_NEXT_OPCODE ( opline + 1 ) ;
ZEND_VM_CONTINUE ( ) ;
}
2008-04-29 16:15:20 +08:00
2017-07-17 19:11:50 +08:00
ZEND_VM_HANDLER ( 114 , ZEND_ISSET_ISEMPTY_VAR , CONST | TMPVAR | CV , UNUSED , VAR_FETCH | ISSET )
{
USE_OPLINE
zval * value ;
int result ;
zend_free_op free_op1 ;
2017-11-16 22:09:32 +08:00
zval * varname ;
zend_string * name , * tmp_name ;
2017-07-17 19:11:50 +08:00
HashTable * target_symbol_table ;
2008-04-29 16:15:20 +08:00
2017-07-17 19:11:50 +08:00
SAVE_OPLINE ( ) ;
varname = GET_OP1_ZVAL_PTR ( BP_VAR_IS ) ;
2017-11-16 22:09:32 +08:00
if ( OP1_TYPE = = IS_CONST ) {
name = Z_STR_P ( varname ) ;
} else {
name = zval_get_tmp_string ( varname , & tmp_name ) ;
2017-07-17 19:11:50 +08:00
}
2004-10-23 05:42:14 +08:00
2018-01-31 18:47:43 +08:00
target_symbol_table = zend_get_target_symbol_table ( opline - > extended_value EXECUTE_DATA_CC ) ;
2017-11-24 19:01:19 +08:00
value = zend_hash_find_ex_ind ( target_symbol_table , name , OP1_TYPE = = IS_CONST ) ;
2004-10-23 05:42:14 +08:00
2017-11-16 22:09:32 +08:00
if ( OP1_TYPE ! = IS_CONST ) {
zend_tmp_string_release ( tmp_name ) ;
2017-07-17 19:11:50 +08:00
}
FREE_OP1 ( ) ;
if ( opline - > extended_value & ZEND_ISSET ) {
result = value & & Z_TYPE_P ( value ) > IS_NULL & &
( ! Z_ISREF_P ( value ) | | Z_TYPE_P ( Z_REFVAL_P ( value ) ) ! = IS_NULL ) ;
2018-01-31 03:06:05 +08:00
} else {
2017-07-17 19:11:50 +08:00
result = ! value | | ! i_zend_is_true ( value ) ;
2014-10-17 04:17:13 +08:00
}
2017-07-17 19:11:50 +08:00
ZEND_VM_SMART_BRANCH ( result , 1 ) ;
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 180 , ZEND_ISSET_ISEMPTY_STATIC_PROP , CONST | TMPVAR | CV , UNUSED | CLASS_FETCH | CONST | VAR , ISSET | CACHE_SLOT )
2015-10-27 20:47:58 +08:00
{
USE_OPLINE
zval * value ;
int result ;
zend_free_op free_op1 ;
2017-11-16 22:09:32 +08:00
zval * varname ;
zend_string * name , * tmp_name ;
2015-10-27 20:47:58 +08:00
zend_class_entry * ce ;
SAVE_OPLINE ( ) ;
if ( OP2_TYPE = = IS_CONST ) {
2018-02-06 00:41:47 +08:00
if ( OP1_TYPE = = IS_CONST & & EXPECTED ( ( ce = CACHED_PTR ( opline - > extended_value & ~ ZEND_ISSET ) ) ! = NULL ) ) {
value = CACHED_PTR ( ( opline - > extended_value & ~ ZEND_ISSET ) + sizeof ( void * ) ) ;
2015-10-27 20:47:58 +08:00
ZEND_VM_C_GOTO ( is_static_prop_return ) ;
2018-02-06 00:41:47 +08:00
} else if ( UNEXPECTED ( ( ce = CACHED_PTR ( opline - > extended_value & ~ ZEND_ISSET ) ) = = NULL ) ) {
2017-10-04 21:53:01 +08:00
ce = zend_fetch_class_by_name ( Z_STR_P ( RT_CONSTANT ( opline , opline - > op2 ) ) , RT_CONSTANT ( opline , opline - > op2 ) + 1 , ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION ) ;
2015-10-27 20:47:58 +08:00
if ( UNEXPECTED ( ce = = NULL ) ) {
2016-09-30 16:00:14 +08:00
ZEND_ASSERT ( EG ( exception ) ) ;
2016-12-07 05:41:07 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2016-09-30 16:00:14 +08:00
HANDLE_EXCEPTION ( ) ;
2015-10-27 20:47:58 +08:00
}
2018-02-06 00:41:47 +08:00
if ( OP1_TYPE ! = IS_CONST ) {
CACHE_PTR ( opline - > extended_value & ~ ZEND_ISSET , ce ) ;
}
2015-10-27 20:47:58 +08:00
}
} else {
if ( OP2_TYPE = = IS_UNUSED ) {
ce = zend_fetch_class ( NULL , opline - > op2 . num ) ;
2015-11-16 18:19:22 +08:00
if ( UNEXPECTED ( ce = = NULL ) ) {
ZEND_ASSERT ( EG ( exception ) ) ;
2018-02-06 00:41:47 +08:00
FREE_UNFETCHED_OP1 ( ) ;
2016-12-07 05:41:07 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2015-11-16 18:19:22 +08:00
HANDLE_EXCEPTION ( ) ;
}
2015-10-27 20:47:58 +08:00
} else {
ce = Z_CE_P ( EX_VAR ( opline - > op2 . var ) ) ;
}
if ( OP1_TYPE = = IS_CONST & &
2018-02-06 00:41:47 +08:00
EXPECTED ( CACHED_PTR ( opline - > extended_value & ~ ZEND_ISSET ) = = ce ) ) {
2017-05-10 18:27:37 +08:00
2018-02-06 00:41:47 +08:00
value = CACHED_PTR ( ( opline - > extended_value & ~ ZEND_ISSET ) + sizeof ( void * ) ) ;
2015-10-27 20:47:58 +08:00
ZEND_VM_C_GOTO ( is_static_prop_return ) ;
}
}
2018-02-06 00:41:47 +08:00
varname = GET_OP1_ZVAL_PTR ( BP_VAR_IS ) ;
if ( OP1_TYPE = = IS_CONST ) {
name = Z_STR_P ( varname ) ;
} else {
name = zval_get_tmp_string ( varname , & tmp_name ) ;
}
2017-11-16 22:09:32 +08:00
value = zend_std_get_static_property ( ce , name , 1 ) ;
2015-10-27 20:47:58 +08:00
if ( OP1_TYPE = = IS_CONST & & value ) {
2018-02-06 00:41:47 +08:00
CACHE_POLYMORPHIC_PTR ( opline - > extended_value & ~ ZEND_ISSET , ce , value ) ;
2018-01-04 12:41:57 +08:00
}
2015-10-27 20:47:58 +08:00
2017-11-16 22:09:32 +08:00
if ( OP1_TYPE ! = IS_CONST ) {
zend_tmp_string_release ( tmp_name ) ;
2015-10-27 20:47:58 +08:00
}
FREE_OP1 ( ) ;
ZEND_VM_C_LABEL ( is_static_prop_return ) :
if ( opline - > extended_value & ZEND_ISSET ) {
result = value & & Z_TYPE_P ( value ) > IS_NULL & &
( ! Z_ISREF_P ( value ) | | Z_TYPE_P ( Z_REFVAL_P ( value ) ) ! = IS_NULL ) ;
2018-01-31 03:06:05 +08:00
} else {
2015-10-27 20:47:58 +08:00
result = ! value | | ! i_zend_is_true ( value ) ;
}
ZEND_VM_SMART_BRANCH ( result , 1 ) ;
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
}
2016-06-16 07:30:23 +08:00
ZEND_VM_HANDLER ( 115 , ZEND_ISSET_ISEMPTY_DIM_OBJ , CONST | TMPVAR | CV , CONST | TMPVAR | CV , ISSET )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2010-07-16 19:44:30 +08:00
zend_free_op free_op1 , free_op2 ;
2013-10-28 18:44:07 +08:00
zval * container ;
2014-04-07 18:56:34 +08:00
int result ;
2014-08-26 01:24:55 +08:00
zend_ulong hval ;
2010-07-16 19:44:30 +08:00
zval * offset ;
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2016-04-13 06:19:20 +08:00
container = GET_OP1_OBJ_ZVAL_PTR_UNDEF ( BP_VAR_IS ) ;
2015-06-05 06:53:32 +08:00
offset = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2015-04-02 08:56:42 +08:00
2016-06-16 07:30:23 +08:00
if ( EXPECTED ( Z_TYPE_P ( container ) = = IS_ARRAY ) ) {
2015-06-01 22:22:04 +08:00
HashTable * ht ;
2014-06-05 22:42:17 +08:00
zval * value ;
2014-04-07 18:56:34 +08:00
zend_string * str ;
2004-10-23 05:42:14 +08:00
2015-06-01 22:22:04 +08:00
ZEND_VM_C_LABEL ( isset_dim_obj_array ) :
ht = Z_ARRVAL_P ( container ) ;
2014-03-26 22:07:31 +08:00
ZEND_VM_C_LABEL ( isset_again ) :
2014-06-05 22:42:17 +08:00
if ( EXPECTED ( Z_TYPE_P ( offset ) = = IS_STRING ) ) {
str = Z_STR_P ( offset ) ;
if ( OP2_TYPE ! = IS_CONST ) {
if ( ZEND_HANDLE_NUMERIC ( str , hval ) ) {
ZEND_VM_C_GOTO ( num_index_prop ) ;
2010-04-20 18:57:45 +08:00
}
2014-06-05 22:42:17 +08:00
}
2017-11-24 19:01:19 +08:00
value = zend_hash_find_ex_ind ( ht , str , OP2_TYPE = = IS_CONST ) ;
2014-08-26 01:24:55 +08:00
} else if ( EXPECTED ( Z_TYPE_P ( offset ) = = IS_LONG ) ) {
hval = Z_LVAL_P ( offset ) ;
2014-06-05 22:42:17 +08:00
ZEND_VM_C_LABEL ( num_index_prop ) :
value = zend_hash_index_find ( ht , hval ) ;
2015-06-05 00:14:16 +08:00
} else if ( ( OP2_TYPE & ( IS_VAR | IS_CV ) ) & & EXPECTED ( Z_ISREF_P ( offset ) ) ) {
offset = Z_REFVAL_P ( offset ) ;
ZEND_VM_C_GOTO ( isset_again ) ;
2014-06-05 22:42:17 +08:00
} else {
2018-02-20 19:42:53 +08:00
value = zend_find_array_dim_slow ( ht , offset EXECUTE_DATA_CC ) ;
2010-07-16 19:44:30 +08:00
}
if ( opline - > extended_value & ZEND_ISSET ) {
2014-04-07 18:56:34 +08:00
/* > IS_NULL means not IS_UNDEF and not IS_NULL */
2014-08-15 02:44:25 +08:00
result = value ! = NULL & & Z_TYPE_P ( value ) > IS_NULL & &
( ! Z_ISREF_P ( value ) | | Z_TYPE_P ( Z_REFVAL_P ( value ) ) ! = IS_NULL ) ;
2018-01-31 03:06:05 +08:00
} else {
2014-12-14 06:06:14 +08:00
result = ( value = = NULL | | ! i_zend_is_true ( value ) ) ;
2010-07-16 19:44:30 +08:00
}
2015-06-01 22:22:04 +08:00
ZEND_VM_C_GOTO ( isset_dim_obj_exit ) ;
2018-02-20 19:42:53 +08:00
} else if ( ( OP1_TYPE & ( IS_VAR | IS_CV ) ) & & EXPECTED ( Z_ISREF_P ( container ) ) ) {
2015-06-01 22:22:04 +08:00
container = Z_REFVAL_P ( container ) ;
if ( EXPECTED ( Z_TYPE_P ( container ) = = IS_ARRAY ) ) {
ZEND_VM_C_GOTO ( isset_dim_obj_array ) ;
}
}
2015-06-05 06:53:32 +08:00
2018-02-20 19:42:53 +08:00
if ( opline - > extended_value & ZEND_ISSET ) {
result = zend_isset_dim_slow ( container , offset EXECUTE_DATA_CC ) ;
2010-07-16 19:44:30 +08:00
} else {
2018-02-20 19:42:53 +08:00
result = zend_isempty_dim_slow ( container , offset EXECUTE_DATA_CC ) ;
2004-10-23 05:42:14 +08:00
}
2015-06-01 22:22:04 +08:00
ZEND_VM_C_LABEL ( isset_dim_obj_exit ) :
2014-04-16 01:56:30 +08:00
FREE_OP2 ( ) ;
2014-06-01 02:05:03 +08:00
FREE_OP1 ( ) ;
2015-04-29 09:17:59 +08:00
ZEND_VM_SMART_BRANCH ( result , 1 ) ;
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 148 , ZEND_ISSET_ISEMPTY_PROP_OBJ , CONST | TMPVAR | UNUSED | THIS | CV , CONST | TMPVAR | CV , ISSET | CACHE_SLOT )
2004-10-23 05:42:14 +08:00
{
2014-04-22 04:32:29 +08:00
USE_OPLINE
zend_free_op free_op1 , free_op2 ;
zval * container ;
int result ;
zval * offset ;
SAVE_OPLINE ( ) ;
2014-12-08 23:11:14 +08:00
container = GET_OP1_OBJ_ZVAL_PTR ( BP_VAR_IS ) ;
2014-04-22 04:32:29 +08:00
2016-04-01 21:17:49 +08:00
if ( OP1_TYPE = = IS_UNUSED & & UNEXPECTED ( Z_TYPE_P ( container ) = = IS_UNDEF ) ) {
2017-06-15 21:23:05 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_this_not_in_object_context_helper ) ;
2015-04-01 20:54:03 +08:00
}
2015-04-02 08:56:42 +08:00
offset = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
2015-06-03 23:44:25 +08:00
if ( OP1_TYPE = = IS_CONST | |
( OP1_TYPE ! = IS_UNUSED & & UNEXPECTED ( Z_TYPE_P ( container ) ! = IS_OBJECT ) ) ) {
2014-12-08 23:11:14 +08:00
if ( ( OP1_TYPE & ( IS_VAR | IS_CV ) ) & & Z_ISREF_P ( container ) ) {
container = Z_REFVAL_P ( container ) ;
if ( UNEXPECTED ( Z_TYPE_P ( container ) ! = IS_OBJECT ) ) {
ZEND_VM_C_GOTO ( isset_no_object ) ;
}
2014-04-22 04:32:29 +08:00
} else {
2014-12-08 23:11:14 +08:00
ZEND_VM_C_GOTO ( isset_no_object ) ;
2014-04-22 04:32:29 +08:00
}
2014-12-08 23:11:14 +08:00
}
if ( UNEXPECTED ( ! Z_OBJ_HT_P ( container ) - > has_property ) ) {
2017-12-22 21:35:52 +08:00
zend_wrong_property_check ( offset ) ;
2014-12-08 23:11:14 +08:00
ZEND_VM_C_LABEL ( isset_no_object ) :
result = ( ( opline - > extended_value & ZEND_ISSET ) = = 0 ) ;
} else {
2015-06-03 21:27:38 +08:00
result =
( ( opline - > extended_value & ZEND_ISSET ) = = 0 ) ^
2018-02-06 00:41:47 +08:00
Z_OBJ_HT_P ( container ) - > has_property ( container , offset , ( opline - > extended_value & ZEND_ISSET ) = = 0 , ( ( OP2_TYPE = = IS_CONST ) ? CACHE_ADDR ( opline - > extended_value & ~ ZEND_ISSET ) : NULL ) ) ;
2014-04-22 04:32:29 +08:00
}
FREE_OP2 ( ) ;
2014-06-01 02:05:03 +08:00
FREE_OP1 ( ) ;
2015-04-29 09:17:59 +08:00
ZEND_VM_SMART_BRANCH ( result , 1 ) ;
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2014-12-08 23:11:14 +08:00
ZEND_VM_HANDLER ( 79 , ZEND_EXIT , CONST | TMPVAR | UNUSED | CV , ANY )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
SAVE_OPLINE ( ) ;
2004-10-23 05:42:14 +08:00
if ( OP1_TYPE ! = IS_UNUSED ) {
zend_free_op free_op1 ;
2015-08-12 07:58:21 +08:00
zval * ptr = GET_OP1_ZVAL_PTR ( BP_VAR_R ) ;
do {
if ( Z_TYPE_P ( ptr ) = = IS_LONG ) {
EG ( exit_status ) = Z_LVAL_P ( ptr ) ;
} else {
if ( ( OP1_TYPE & ( IS_VAR | IS_CV ) ) & & Z_ISREF_P ( ptr ) ) {
ptr = Z_REFVAL_P ( ptr ) ;
if ( Z_TYPE_P ( ptr ) = = IS_LONG ) {
EG ( exit_status ) = Z_LVAL_P ( ptr ) ;
break ;
}
}
zend_print_variable ( ptr ) ;
}
} while ( 0 ) ;
2004-10-23 05:42:14 +08:00
FREE_OP1 ( ) ;
}
zend_bailout ( ) ;
2010-04-20 19:16:39 +08:00
ZEND_VM_NEXT_OPCODE ( ) ; /* Never reached */
2004-10-23 05:42:14 +08:00
}
ZEND_VM_HANDLER ( 57 , ZEND_BEGIN_SILENCE , ANY , ANY )
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2006-05-12 05:07:39 +08:00
2014-09-03 19:17:50 +08:00
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , EG ( error_reporting ) ) ;
2006-05-12 05:07:39 +08:00
2014-09-03 19:17:50 +08:00
if ( EG ( error_reporting ) ) {
do {
2014-09-03 02:13:24 +08:00
EG ( error_reporting ) = 0 ;
2014-09-03 19:17:50 +08:00
if ( ! EG ( error_reporting_ini_entry ) ) {
2017-11-24 19:01:19 +08:00
zval * zv = zend_hash_find_ex ( EG ( ini_directives ) , ZSTR_KNOWN ( ZEND_STR_ERROR_REPORTING ) , 1 ) ;
if ( zv ) {
EG ( error_reporting_ini_entry ) = ( zend_ini_entry * ) Z_PTR_P ( zv ) ;
2014-09-03 19:17:50 +08:00
} else {
break ;
}
}
2010-08-18 21:58:13 +08:00
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 ) ;
}
2017-03-04 17:39:13 +08:00
if ( EXPECTED ( zend_hash_add_ptr ( EG ( modified_ini_directives ) , ZSTR_KNOWN ( ZEND_STR_ERROR_REPORTING ) , EG ( error_reporting_ini_entry ) ) ! = NULL ) ) {
2010-08-18 21:58:13 +08:00
EG ( error_reporting_ini_entry ) - > orig_value = EG ( error_reporting_ini_entry ) - > value ;
EG ( error_reporting_ini_entry ) - > orig_modifiable = EG ( error_reporting_ini_entry ) - > modifiable ;
EG ( error_reporting_ini_entry ) - > modified = 1 ;
}
}
2014-09-03 19:17:50 +08:00
} while ( 0 ) ;
}
2004-10-23 05:42:14 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
}
ZEND_VM_HANDLER ( 58 , ZEND_END_SILENCE , TMP , ANY )
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
2014-09-03 19:17:50 +08:00
if ( ! EG ( error_reporting ) & & Z_LVAL_P ( EX_VAR ( opline - > op1 . var ) ) ! = 0 ) {
EG ( error_reporting ) = Z_LVAL_P ( EX_VAR ( opline - > op1 . var ) ) ;
}
2004-10-23 05:42:14 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
}
2015-10-30 03:50:45 +08:00
ZEND_VM_HANDLER ( 152 , ZEND_JMP_SET , CONST | TMP | VAR | CV , JMP_ADDR )
2007-11-21 17:41:35 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2007-11-21 17:41:35 +08:00
zend_free_op free_op1 ;
2010-04-20 19:16:39 +08:00
zval * value ;
2015-04-16 01:53:27 +08:00
zval * ref = NULL ;
2016-12-07 05:41:07 +08:00
int ret ;
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2014-09-11 23:12:12 +08:00
value = GET_OP1_ZVAL_PTR ( BP_VAR_R ) ;
2011-10-19 03:42:42 +08:00
2014-09-11 23:12:12 +08:00
if ( ( OP1_TYPE = = IS_VAR | | OP1_TYPE = = IS_CV ) & & Z_ISREF_P ( value ) ) {
2015-04-16 01:53:27 +08:00
if ( OP1_TYPE = = IS_VAR ) {
ref = value ;
}
2014-09-11 23:12:12 +08:00
value = Z_REFVAL_P ( value ) ;
}
2016-12-07 05:41:07 +08:00
ret = i_zend_is_true ( value ) ;
if ( UNEXPECTED ( EG ( exception ) ) ) {
FREE_OP1 ( ) ;
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
HANDLE_EXCEPTION ( ) ;
}
if ( ret ) {
2016-05-17 13:45:06 +08:00
zval * result = EX_VAR ( opline - > result . var ) ;
ZVAL_COPY_VALUE ( result , value ) ;
2014-06-05 20:04:11 +08:00
if ( OP1_TYPE = = IS_CONST ) {
2016-05-17 13:45:06 +08:00
if ( UNEXPECTED ( Z_OPT_REFCOUNTED_P ( result ) ) ) Z_ADDREF_P ( result ) ;
2014-06-05 20:04:11 +08:00
} else if ( OP1_TYPE = = IS_CV ) {
2016-05-17 13:45:06 +08:00
if ( Z_OPT_REFCOUNTED_P ( result ) ) Z_ADDREF_P ( result ) ;
2015-04-16 01:53:27 +08:00
} else if ( OP1_TYPE = = IS_VAR & & ref ) {
2015-08-13 18:56:29 +08:00
zend_reference * r = Z_REF_P ( ref ) ;
2017-10-27 06:28:58 +08:00
if ( UNEXPECTED ( GC_DELREF ( r ) = = 0 ) ) {
2015-08-13 18:56:29 +08:00
efree_size ( r , sizeof ( zend_reference ) ) ;
2016-05-17 13:45:06 +08:00
} else if ( Z_OPT_REFCOUNTED_P ( result ) ) {
Z_ADDREF_P ( result ) ;
2015-04-16 01:53:27 +08:00
}
2011-10-19 03:42:42 +08:00
}
2016-12-07 05:41:07 +08:00
ZEND_VM_SET_OPCODE ( OP_JMP_ADDR ( opline , opline - > op2 ) ) ;
ZEND_VM_CONTINUE ( ) ;
2007-11-21 17:41:35 +08:00
}
FREE_OP1 ( ) ;
2016-12-07 05:41:07 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
2007-11-21 17:41:35 +08:00
}
2015-10-30 03:50:45 +08:00
ZEND_VM_HANDLER ( 169 , ZEND_COALESCE , CONST | TMP | VAR | CV , JMP_ADDR )
2014-09-17 02:14:46 +08:00
{
USE_OPLINE
zend_free_op free_op1 ;
zval * value ;
2015-04-16 01:53:27 +08:00
zval * ref = NULL ;
2014-09-17 02:14:46 +08:00
SAVE_OPLINE ( ) ;
value = GET_OP1_ZVAL_PTR ( BP_VAR_IS ) ;
if ( ( OP1_TYPE = = IS_VAR | | OP1_TYPE = = IS_CV ) & & Z_ISREF_P ( value ) ) {
2015-04-16 01:53:27 +08:00
if ( OP1_TYPE = = IS_VAR ) {
ref = value ;
}
2014-09-17 02:14:46 +08:00
value = Z_REFVAL_P ( value ) ;
}
if ( Z_TYPE_P ( value ) > IS_NULL ) {
2016-05-17 13:45:06 +08:00
zval * result = EX_VAR ( opline - > result . var ) ;
ZVAL_COPY_VALUE ( result , value ) ;
2014-09-17 02:14:46 +08:00
if ( OP1_TYPE = = IS_CONST ) {
2016-05-17 13:45:06 +08:00
if ( UNEXPECTED ( Z_OPT_REFCOUNTED_P ( result ) ) ) Z_ADDREF_P ( result ) ;
2014-09-17 02:14:46 +08:00
} else if ( OP1_TYPE = = IS_CV ) {
2016-05-17 13:45:06 +08:00
if ( Z_OPT_REFCOUNTED_P ( result ) ) Z_ADDREF_P ( result ) ;
2015-04-16 01:53:27 +08:00
} else if ( OP1_TYPE = = IS_VAR & & ref ) {
2015-08-13 18:56:29 +08:00
zend_reference * r = Z_REF_P ( ref ) ;
2017-10-27 06:28:58 +08:00
if ( UNEXPECTED ( GC_DELREF ( r ) = = 0 ) ) {
2015-08-13 18:56:29 +08:00
efree_size ( r , sizeof ( zend_reference ) ) ;
2016-05-17 13:45:06 +08:00
} else if ( Z_OPT_REFCOUNTED_P ( result ) ) {
Z_ADDREF_P ( result ) ;
2015-04-16 01:53:27 +08:00
}
2014-09-17 02:14:46 +08:00
}
2016-12-06 15:21:44 +08:00
ZEND_VM_SET_OPCODE ( OP_JMP_ADDR ( opline , opline - > op2 ) ) ;
ZEND_VM_CONTINUE ( ) ;
2014-09-17 02:14:46 +08:00
}
FREE_OP1 ( ) ;
2016-12-02 21:04:18 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
2014-09-17 02:14:46 +08:00
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_HANDLER ( 22 , ZEND_QM_ASSIGN , CONST | TMP | VAR | CV , ANY )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 ;
2010-04-20 19:16:39 +08:00
zval * value ;
2016-05-04 00:12:56 +08:00
zval * result = EX_VAR ( opline - > result . var ) ;
2004-10-23 05:42:14 +08:00
2015-04-16 01:53:27 +08:00
value = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( value ) = = IS_UNDEF ) ) {
SAVE_OPLINE ( ) ;
2015-07-08 23:33:58 +08:00
GET_OP1_UNDEF_CV ( value , BP_VAR_R ) ;
2016-05-04 00:12:56 +08:00
ZVAL_NULL ( result ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2015-04-16 01:53:27 +08:00
}
2011-10-19 03:42:42 +08:00
2016-05-04 00:12:56 +08:00
if ( OP1_TYPE = = IS_CV ) {
ZVAL_DEREF ( value ) ;
ZVAL_COPY ( result , value ) ;
} else if ( OP1_TYPE = = IS_VAR ) {
if ( UNEXPECTED ( Z_ISREF_P ( value ) ) ) {
ZVAL_COPY_VALUE ( result , Z_REFVAL_P ( value ) ) ;
2015-04-16 01:53:27 +08:00
if ( UNEXPECTED ( Z_DELREF_P ( value ) = = 0 ) ) {
efree_size ( Z_REF_P ( value ) , sizeof ( zend_reference ) ) ;
2016-05-04 00:12:56 +08:00
} else if ( Z_OPT_REFCOUNTED_P ( result ) ) {
Z_ADDREF_P ( result ) ;
2015-04-16 01:53:27 +08:00
}
2016-05-04 00:12:56 +08:00
} else {
ZVAL_COPY_VALUE ( result , value ) ;
2015-04-16 01:53:27 +08:00
}
2014-09-11 23:12:12 +08:00
} else {
2016-05-04 00:12:56 +08:00
ZVAL_COPY_VALUE ( result , value ) ;
2014-09-11 23:12:12 +08:00
if ( OP1_TYPE = = IS_CONST ) {
2016-05-17 13:45:06 +08:00
if ( UNEXPECTED ( Z_OPT_REFCOUNTED_P ( result ) ) ) {
Z_ADDREF_P ( result ) ;
2014-09-11 23:12:12 +08:00
}
2011-10-19 03:42:42 +08:00
}
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
2004-10-23 05:42:14 +08:00
ZEND_VM_HANDLER ( 101 , ZEND_EXT_STMT , ANY , ANY )
{
2015-07-08 23:33:58 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
if ( ! EG ( no_extensions ) ) {
2015-04-16 01:53:27 +08:00
SAVE_OPLINE ( ) ;
2016-05-04 16:25:59 +08:00
zend_llist_apply_with_argument ( & zend_extensions , ( llist_apply_with_arg_func_t ) zend_extension_statement_handler , execute_data ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
ZEND_VM_HANDLER ( 102 , ZEND_EXT_FCALL_BEGIN , ANY , ANY )
{
2015-07-08 23:33:58 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
if ( ! EG ( no_extensions ) ) {
2015-04-16 01:53:27 +08:00
SAVE_OPLINE ( ) ;
2016-05-04 16:25:59 +08:00
zend_llist_apply_with_argument ( & zend_extensions , ( llist_apply_with_arg_func_t ) zend_extension_fcall_begin_handler , execute_data ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
ZEND_VM_HANDLER ( 103 , ZEND_EXT_FCALL_END , ANY , ANY )
{
2015-07-08 23:33:58 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
if ( ! EG ( no_extensions ) ) {
2015-04-16 01:53:27 +08:00
SAVE_OPLINE ( ) ;
2016-05-04 16:25:59 +08:00
zend_llist_apply_with_argument ( & zend_extensions , ( llist_apply_with_arg_func_t ) zend_extension_fcall_end_handler , execute_data ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
ZEND_VM_HANDLER ( 139 , ZEND_DECLARE_CLASS , ANY , ANY )
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2014-12-14 06:06:14 +08:00
Z_CE_P ( EX_VAR ( opline - > result . var ) ) = do_bind_class ( & EX ( func ) - > op_array , opline , EG ( class_table ) , 0 ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2015-12-20 20:42:26 +08:00
ZEND_VM_HANDLER ( 140 , ZEND_DECLARE_INHERITED_CLASS , ANY , VAR )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2015-12-20 20:42:26 +08:00
Z_CE_P ( EX_VAR ( opline - > result . var ) ) = do_bind_inherited_class ( & EX ( func ) - > op_array , opline , EG ( class_table ) , Z_CE_P ( EX_VAR ( opline - > op2 . var ) ) , 0 ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2015-12-20 20:42:26 +08:00
ZEND_VM_HANDLER ( 145 , ZEND_DECLARE_INHERITED_CLASS_DELAYED , ANY , VAR )
2008-03-18 16:36:30 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2014-02-10 14:04:30 +08:00
zval * zce , * orig_zce ;
2008-03-18 16:36:30 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2017-11-24 19:01:19 +08:00
if ( ( zce = zend_hash_find_ex ( EG ( class_table ) , Z_STR_P ( RT_CONSTANT ( opline , opline - > op1 ) ) , 1 ) ) = = NULL | |
( ( orig_zce = zend_hash_find_ex ( EG ( class_table ) , Z_STR_P ( RT_CONSTANT ( opline , opline - > op1 ) + 1 ) , 1 ) ) ! = NULL & &
2014-02-10 14:04:30 +08:00
Z_CE_P ( zce ) ! = Z_CE_P ( orig_zce ) ) ) {
2015-12-20 20:42:26 +08:00
do_bind_inherited_class ( & EX ( func ) - > op_array , opline , EG ( class_table ) , Z_CE_P ( EX_VAR ( opline - > op2 . var ) ) , 0 ) ;
2008-03-18 16:36:30 +08:00
}
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2008-03-18 16:36:30 +08:00
}
2015-12-20 20:42:26 +08:00
ZEND_VM_HANDLER ( 171 , ZEND_DECLARE_ANON_CLASS , ANY , ANY , JMP_ADDR )
2015-04-27 17:24:39 +08:00
{
2017-11-24 19:01:19 +08:00
zval * zv ;
2015-04-27 17:24:39 +08:00
zend_class_entry * ce ;
USE_OPLINE
SAVE_OPLINE ( ) ;
2017-11-24 19:01:19 +08:00
zv = zend_hash_find_ex ( EG ( class_table ) , Z_STR_P ( RT_CONSTANT ( opline , opline - > op1 ) ) , 1 ) ;
ZEND_ASSERT ( zv ! = NULL ) ;
ce = Z_CE_P ( zv ) ;
2015-04-27 17:24:39 +08:00
Z_CE_P ( EX_VAR ( opline - > result . var ) ) = ce ;
if ( ce - > ce_flags & ZEND_ACC_ANON_BOUND ) {
2015-12-20 20:42:26 +08:00
ZEND_VM_SET_RELATIVE_OPCODE ( opline , opline - > extended_value ) ;
ZEND_VM_CONTINUE ( ) ;
2015-04-27 17:24:39 +08:00
}
if ( ! ( ce - > ce_flags & ( ZEND_ACC_INTERFACE | ZEND_ACC_IMPLEMENT_INTERFACES | ZEND_ACC_IMPLEMENT_TRAITS ) ) ) {
zend_verify_abstract_class ( ce ) ;
}
ce - > ce_flags | = ZEND_ACC_ANON_BOUND ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2015-04-27 17:24:39 +08:00
}
2015-12-20 20:42:26 +08:00
ZEND_VM_HANDLER ( 172 , ZEND_DECLARE_ANON_INHERITED_CLASS , ANY , VAR , JMP_ADDR )
2015-04-27 17:24:39 +08:00
{
2017-11-24 19:01:19 +08:00
zval * zv ;
2015-04-27 17:24:39 +08:00
zend_class_entry * ce ;
USE_OPLINE
SAVE_OPLINE ( ) ;
2017-11-24 19:01:19 +08:00
zv = zend_hash_find_ex ( EG ( class_table ) , Z_STR_P ( RT_CONSTANT ( opline , opline - > op1 ) ) , 1 ) ;
ZEND_ASSERT ( zv ! = NULL ) ;
ce = Z_CE_P ( zv ) ;
2015-04-27 17:24:39 +08:00
Z_CE_P ( EX_VAR ( opline - > result . var ) ) = ce ;
if ( ce - > ce_flags & ZEND_ACC_ANON_BOUND ) {
2015-12-20 20:42:26 +08:00
ZEND_VM_SET_RELATIVE_OPCODE ( opline , opline - > extended_value ) ;
ZEND_VM_CONTINUE ( ) ;
2015-04-27 17:24:39 +08:00
}
2015-12-20 20:42:26 +08:00
zend_do_inheritance ( ce , Z_CE_P ( EX_VAR ( opline - > op2 . var ) ) ) ;
2015-04-27 17:24:39 +08:00
ce - > ce_flags | = ZEND_ACC_ANON_BOUND ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2015-04-27 17:24:39 +08:00
}
2004-10-23 05:42:14 +08:00
ZEND_VM_HANDLER ( 141 , ZEND_DECLARE_FUNCTION , ANY , ANY )
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
SAVE_OPLINE ( ) ;
2014-12-14 06:06:14 +08:00
do_bind_function ( & EX ( func ) - > op_array , opline , EG ( function_table ) , 0 ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2015-10-29 04:25:05 +08:00
ZEND_VM_HANDLER ( 105 , ZEND_TICKS , ANY , ANY , NUM )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
2014-12-13 02:57:34 +08:00
if ( ( uint32_t ) + + EG ( ticks_count ) > = opline - > extended_value ) {
EG ( ticks_count ) = 0 ;
2004-10-23 05:42:14 +08:00
if ( zend_ticks_function ) {
2015-04-16 01:53:27 +08:00
SAVE_OPLINE ( ) ;
2014-12-14 06:06:14 +08:00
zend_ticks_function ( opline - > extended_value ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 138 , ZEND_INSTANCEOF , TMPVAR | CV , UNUSED | CLASS_FETCH | CONST | VAR , CACHE_SLOT )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
zend_free_op free_op1 ;
2010-04-20 19:16:39 +08:00
zval * expr ;
2004-10-23 05:42:14 +08:00
zend_bool result ;
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2015-06-05 06:53:32 +08:00
expr = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2011-03-16 13:25:02 +08:00
2014-12-05 23:23:39 +08:00
ZEND_VM_C_LABEL ( try_instanceof ) :
2014-10-09 19:58:14 +08:00
if ( Z_TYPE_P ( expr ) = = IS_OBJECT ) {
2014-10-22 21:23:43 +08:00
zend_class_entry * ce ;
if ( OP2_TYPE = = IS_CONST ) {
2018-02-06 00:41:47 +08:00
ce = CACHED_PTR ( opline - > extended_value ) ;
2015-08-28 04:02:15 +08:00
if ( UNEXPECTED ( ce = = NULL ) ) {
2017-10-04 21:53:01 +08:00
ce = zend_fetch_class_by_name ( Z_STR_P ( RT_CONSTANT ( opline , opline - > op2 ) ) , RT_CONSTANT ( opline , opline - > op2 ) + 1 , ZEND_FETCH_CLASS_NO_AUTOLOAD ) ;
2016-09-30 13:19:11 +08:00
if ( EXPECTED ( ce ) ) {
2018-02-06 00:41:47 +08:00
CACHE_PTR ( opline - > extended_value , ce ) ;
2014-10-22 21:23:43 +08:00
}
}
2015-10-27 20:47:58 +08:00
} else if ( OP2_TYPE = = IS_UNUSED ) {
ce = zend_fetch_class ( NULL , opline - > op2 . num ) ;
2015-11-16 18:19:22 +08:00
if ( UNEXPECTED ( ce = = NULL ) ) {
ZEND_ASSERT ( EG ( exception ) ) ;
2015-12-15 00:50:20 +08:00
FREE_OP1 ( ) ;
2016-12-07 05:41:07 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2015-11-16 18:19:22 +08:00
HANDLE_EXCEPTION ( ) ;
}
2014-10-22 21:23:43 +08:00
} else {
ce = Z_CE_P ( EX_VAR ( opline - > op2 . var ) ) ;
}
2015-01-14 20:06:26 +08:00
result = ce & & instanceof_function ( Z_OBJCE_P ( expr ) , ce ) ;
2014-12-05 23:23:39 +08:00
} else if ( ( OP1_TYPE & ( IS_VAR | IS_CV ) ) & & Z_TYPE_P ( expr ) = = IS_REFERENCE ) {
expr = Z_REFVAL_P ( expr ) ;
ZEND_VM_C_GOTO ( try_instanceof ) ;
2004-10-23 05:42:14 +08:00
} else {
2015-06-05 06:53:32 +08:00
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( expr ) = = IS_UNDEF ) ) {
GET_OP1_UNDEF_CV ( expr , BP_VAR_R ) ;
}
2004-10-23 05:42:14 +08:00
result = 0 ;
}
FREE_OP1 ( ) ;
2015-04-29 21:43:23 +08:00
ZEND_VM_SMART_BRANCH ( result , 1 ) ;
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
ZEND_VM_HANDLER ( 104 , ZEND_EXT_NOP , ANY , ANY )
{
2015-07-08 23:33:58 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
}
ZEND_VM_HANDLER ( 0 , ZEND_NOP , ANY , ANY )
{
2015-07-08 23:33:58 +08:00
USE_OPLINE
2004-10-23 05:42:14 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 144 , ZEND_ADD_INTERFACE , ANY , CONST , CACHE_SLOT )
2004-10-23 05:42:14 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2014-02-10 14:04:30 +08:00
zend_class_entry * ce = Z_CE_P ( EX_VAR ( opline - > op1 . var ) ) ;
2010-04-20 19:16:39 +08:00
zend_class_entry * iface ;
SAVE_OPLINE ( ) ;
2018-02-06 00:41:47 +08:00
iface = CACHED_PTR ( opline - > extended_value ) ;
2015-08-28 04:02:15 +08:00
if ( UNEXPECTED ( iface = = NULL ) ) {
2017-10-04 21:53:01 +08:00
iface = zend_fetch_class_by_name ( Z_STR_P ( RT_CONSTANT ( opline , opline - > op2 ) ) , RT_CONSTANT ( opline , opline - > op2 ) + 1 , ZEND_FETCH_CLASS_INTERFACE ) ;
2010-05-24 22:11:39 +08:00
if ( UNEXPECTED ( iface = = NULL ) ) {
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2009-11-02 05:26:03 +08:00
}
2018-02-06 00:41:47 +08:00
CACHE_PTR ( opline - > extended_value , iface ) ;
2010-05-24 22:11:39 +08:00
}
if ( UNEXPECTED ( ( iface - > ce_flags & ZEND_ACC_INTERFACE ) = = 0 ) ) {
2015-06-30 18:59:27 +08:00
zend_error_noreturn ( E_ERROR , " %s cannot implement %s - it is not an interface " , ZSTR_VAL ( ce - > name ) , ZSTR_VAL ( iface - > name ) ) ;
2004-10-23 05:42:14 +08:00
}
2014-12-14 06:06:14 +08:00
zend_do_implement_interface ( ce , iface ) ;
2004-10-23 05:42:14 +08:00
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 154 , ZEND_ADD_TRAIT , ANY , ANY , CACHE_SLOT )
Implemented Traits for PHP as proposed in the RFC [TRAITS]
# RFC http://wiki.php.net/rfc/horizontalreuse#traits_-_reuse_of_behavior
# Ok, here we go, I guess that will result in more discussion, which is fine
# by me. But now, the patch is here, and properly archived.
#
# See below a list of notes to the patch, it also includes a list of
# points which should be fixed
#
# Internals of the Traits Patch
# -----------------------------
#
# Open TODOs
# """"""""""
#
# - Reflection API
# - support for traits for internal classes
# - currently destroy_zend_class does not handle that case
#
# Introduced Structures
# """""""""""""""""""""
#
# Data structures to encode the composition information specified in the
# source:
# - zend_trait_method_reference
# - zend_trait_precedence
# - zend_trait_alias
#
# Changes
# """""""
#
# zend_class_entry
# - uses NULL terminated lists of pointers for
# - trait_aliases
# - trait_precedences
# - do you prefer an explicit counter?
# - the information is only necessary during class composition
# but might be interesting for reflection
# - did not want to blow up class further with not really necessary length counters
#
# added keywords
# - trait
# - insteadof
#
# Added opcodes
# ZEND_ADD_TRAIT
# - similar to ZEND_ADD_INTERFACE
# - adds the trait to the list of traits of a class, no actual composition done
# ZEND_BIND_TRAITS
# - emitted in zend_do_end_class_declaration
# - concludes the class definition and will initiate the trait composition
# when the class definition is encountered during runtime
#
# Added Flags
# ZEND_ACC_TRAIT = 0x120
# ZEND_ACC_IMPLEMENT_TRAITS = 0x400000
# ZEND_FETCH_CLASS_TRAIT = 14
#
# zend_vm_execute.h
# - not sure whether the handler initialization (ZEND_ADD_TRAIT_SPEC_HANDLER,
# ZEND_BIND_TRAITS_SPEC_HANDLER) is correct, maybe it should be more selective
#
# zend_compile.c
# - refactored do_inherit_method_check
# split into do_inherit_method_check and do_inheritance_check_on_method
# - added helper functions use a '_' as prefix and are not mentioned in the
# headers
# - _copy_functions
# prepare hash-maps of functions which should be merged into a class
# here the aliases are handled
# - _merge_functions
# builds a hash-table of the methods which need to be added to a class
# does the conflict detection
# - reused php_runkit_function_copy_ctor
# - it is not identical with the original code anymore, needed to update it
# think I fixed some bugs, not sure whether all have been reported back to runkit
# - has to be renamed, left the name for the moment, to make its origin obvious
# - here might be optimization potential
# - not sure whether everything needs to be copied
# - copying the literals might be broken
# - added it since the literals array is freed by efree and gave problems
# with doubled frees
# - all immutable parts of the zend_op array should not be copied
# - am not sure which parts are immutable
# - and not sure how to avoid doubled frees on the same arrays on shutdown
# - _merge_functions_to_class
# does the final merging with the target class to handle inherited
# and overridden methods
# - small helper for NULL terminated lists
# zend_init_list, zend_add_to_list
#
# zend_language_parser.y
# - reused class definition for traits
# - there should be something with regard to properties
# - if they get explicitly defined, it might be worthwhile to
# check that there are no collisions with other traits in a composition
# (however, I would not introduce elaborate language features to control that
# but a notice for such conflicts might be nice to the developers)
2010-04-23 06:05:56 +08:00
{
2011-05-06 00:02:11 +08:00
USE_OPLINE
2014-02-10 14:04:30 +08:00
zend_class_entry * ce = Z_CE_P ( EX_VAR ( opline - > op1 . var ) ) ;
2010-05-24 22:11:39 +08:00
zend_class_entry * trait ;
2011-05-06 00:02:11 +08:00
SAVE_OPLINE ( ) ;
2018-02-06 00:41:47 +08:00
trait = CACHED_PTR ( opline - > extended_value ) ;
2015-08-28 04:02:15 +08:00
if ( UNEXPECTED ( trait = = NULL ) ) {
2017-10-04 21:53:01 +08:00
trait = zend_fetch_class_by_name ( Z_STR_P ( RT_CONSTANT ( opline , opline - > op2 ) ) ,
RT_CONSTANT ( opline , opline - > op2 ) + 1 ,
2014-12-14 06:06:14 +08:00
ZEND_FETCH_CLASS_TRAIT ) ;
2010-05-24 22:11:39 +08:00
if ( UNEXPECTED ( trait = = NULL ) ) {
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2010-05-24 22:11:39 +08:00
}
2015-02-13 06:19:14 +08:00
if ( ! ( trait - > ce_flags & ZEND_ACC_TRAIT ) ) {
2015-06-30 18:59:27 +08:00
zend_error_noreturn ( E_ERROR , " %s cannot use %s - it is not a trait " , ZSTR_VAL ( ce - > name ) , ZSTR_VAL ( trait - > name ) ) ;
Implemented Traits for PHP as proposed in the RFC [TRAITS]
# RFC http://wiki.php.net/rfc/horizontalreuse#traits_-_reuse_of_behavior
# Ok, here we go, I guess that will result in more discussion, which is fine
# by me. But now, the patch is here, and properly archived.
#
# See below a list of notes to the patch, it also includes a list of
# points which should be fixed
#
# Internals of the Traits Patch
# -----------------------------
#
# Open TODOs
# """"""""""
#
# - Reflection API
# - support for traits for internal classes
# - currently destroy_zend_class does not handle that case
#
# Introduced Structures
# """""""""""""""""""""
#
# Data structures to encode the composition information specified in the
# source:
# - zend_trait_method_reference
# - zend_trait_precedence
# - zend_trait_alias
#
# Changes
# """""""
#
# zend_class_entry
# - uses NULL terminated lists of pointers for
# - trait_aliases
# - trait_precedences
# - do you prefer an explicit counter?
# - the information is only necessary during class composition
# but might be interesting for reflection
# - did not want to blow up class further with not really necessary length counters
#
# added keywords
# - trait
# - insteadof
#
# Added opcodes
# ZEND_ADD_TRAIT
# - similar to ZEND_ADD_INTERFACE
# - adds the trait to the list of traits of a class, no actual composition done
# ZEND_BIND_TRAITS
# - emitted in zend_do_end_class_declaration
# - concludes the class definition and will initiate the trait composition
# when the class definition is encountered during runtime
#
# Added Flags
# ZEND_ACC_TRAIT = 0x120
# ZEND_ACC_IMPLEMENT_TRAITS = 0x400000
# ZEND_FETCH_CLASS_TRAIT = 14
#
# zend_vm_execute.h
# - not sure whether the handler initialization (ZEND_ADD_TRAIT_SPEC_HANDLER,
# ZEND_BIND_TRAITS_SPEC_HANDLER) is correct, maybe it should be more selective
#
# zend_compile.c
# - refactored do_inherit_method_check
# split into do_inherit_method_check and do_inheritance_check_on_method
# - added helper functions use a '_' as prefix and are not mentioned in the
# headers
# - _copy_functions
# prepare hash-maps of functions which should be merged into a class
# here the aliases are handled
# - _merge_functions
# builds a hash-table of the methods which need to be added to a class
# does the conflict detection
# - reused php_runkit_function_copy_ctor
# - it is not identical with the original code anymore, needed to update it
# think I fixed some bugs, not sure whether all have been reported back to runkit
# - has to be renamed, left the name for the moment, to make its origin obvious
# - here might be optimization potential
# - not sure whether everything needs to be copied
# - copying the literals might be broken
# - added it since the literals array is freed by efree and gave problems
# with doubled frees
# - all immutable parts of the zend_op array should not be copied
# - am not sure which parts are immutable
# - and not sure how to avoid doubled frees on the same arrays on shutdown
# - _merge_functions_to_class
# does the final merging with the target class to handle inherited
# and overridden methods
# - small helper for NULL terminated lists
# zend_init_list, zend_add_to_list
#
# zend_language_parser.y
# - reused class definition for traits
# - there should be something with regard to properties
# - if they get explicitly defined, it might be worthwhile to
# check that there are no collisions with other traits in a composition
# (however, I would not introduce elaborate language features to control that
# but a notice for such conflicts might be nice to the developers)
2010-04-23 06:05:56 +08:00
}
2018-02-06 00:41:47 +08:00
CACHE_PTR ( opline - > extended_value , trait ) ;
Implemented Traits for PHP as proposed in the RFC [TRAITS]
# RFC http://wiki.php.net/rfc/horizontalreuse#traits_-_reuse_of_behavior
# Ok, here we go, I guess that will result in more discussion, which is fine
# by me. But now, the patch is here, and properly archived.
#
# See below a list of notes to the patch, it also includes a list of
# points which should be fixed
#
# Internals of the Traits Patch
# -----------------------------
#
# Open TODOs
# """"""""""
#
# - Reflection API
# - support for traits for internal classes
# - currently destroy_zend_class does not handle that case
#
# Introduced Structures
# """""""""""""""""""""
#
# Data structures to encode the composition information specified in the
# source:
# - zend_trait_method_reference
# - zend_trait_precedence
# - zend_trait_alias
#
# Changes
# """""""
#
# zend_class_entry
# - uses NULL terminated lists of pointers for
# - trait_aliases
# - trait_precedences
# - do you prefer an explicit counter?
# - the information is only necessary during class composition
# but might be interesting for reflection
# - did not want to blow up class further with not really necessary length counters
#
# added keywords
# - trait
# - insteadof
#
# Added opcodes
# ZEND_ADD_TRAIT
# - similar to ZEND_ADD_INTERFACE
# - adds the trait to the list of traits of a class, no actual composition done
# ZEND_BIND_TRAITS
# - emitted in zend_do_end_class_declaration
# - concludes the class definition and will initiate the trait composition
# when the class definition is encountered during runtime
#
# Added Flags
# ZEND_ACC_TRAIT = 0x120
# ZEND_ACC_IMPLEMENT_TRAITS = 0x400000
# ZEND_FETCH_CLASS_TRAIT = 14
#
# zend_vm_execute.h
# - not sure whether the handler initialization (ZEND_ADD_TRAIT_SPEC_HANDLER,
# ZEND_BIND_TRAITS_SPEC_HANDLER) is correct, maybe it should be more selective
#
# zend_compile.c
# - refactored do_inherit_method_check
# split into do_inherit_method_check and do_inheritance_check_on_method
# - added helper functions use a '_' as prefix and are not mentioned in the
# headers
# - _copy_functions
# prepare hash-maps of functions which should be merged into a class
# here the aliases are handled
# - _merge_functions
# builds a hash-table of the methods which need to be added to a class
# does the conflict detection
# - reused php_runkit_function_copy_ctor
# - it is not identical with the original code anymore, needed to update it
# think I fixed some bugs, not sure whether all have been reported back to runkit
# - has to be renamed, left the name for the moment, to make its origin obvious
# - here might be optimization potential
# - not sure whether everything needs to be copied
# - copying the literals might be broken
# - added it since the literals array is freed by efree and gave problems
# with doubled frees
# - all immutable parts of the zend_op array should not be copied
# - am not sure which parts are immutable
# - and not sure how to avoid doubled frees on the same arrays on shutdown
# - _merge_functions_to_class
# does the final merging with the target class to handle inherited
# and overridden methods
# - small helper for NULL terminated lists
# zend_init_list, zend_add_to_list
#
# zend_language_parser.y
# - reused class definition for traits
# - there should be something with regard to properties
# - if they get explicitly defined, it might be worthwhile to
# check that there are no collisions with other traits in a composition
# (however, I would not introduce elaborate language features to control that
# but a notice for such conflicts might be nice to the developers)
2010-04-23 06:05:56 +08:00
}
2014-12-14 06:06:14 +08:00
zend_do_implement_trait ( ce , trait ) ;
2010-05-24 22:11:39 +08:00
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
Implemented Traits for PHP as proposed in the RFC [TRAITS]
# RFC http://wiki.php.net/rfc/horizontalreuse#traits_-_reuse_of_behavior
# Ok, here we go, I guess that will result in more discussion, which is fine
# by me. But now, the patch is here, and properly archived.
#
# See below a list of notes to the patch, it also includes a list of
# points which should be fixed
#
# Internals of the Traits Patch
# -----------------------------
#
# Open TODOs
# """"""""""
#
# - Reflection API
# - support for traits for internal classes
# - currently destroy_zend_class does not handle that case
#
# Introduced Structures
# """""""""""""""""""""
#
# Data structures to encode the composition information specified in the
# source:
# - zend_trait_method_reference
# - zend_trait_precedence
# - zend_trait_alias
#
# Changes
# """""""
#
# zend_class_entry
# - uses NULL terminated lists of pointers for
# - trait_aliases
# - trait_precedences
# - do you prefer an explicit counter?
# - the information is only necessary during class composition
# but might be interesting for reflection
# - did not want to blow up class further with not really necessary length counters
#
# added keywords
# - trait
# - insteadof
#
# Added opcodes
# ZEND_ADD_TRAIT
# - similar to ZEND_ADD_INTERFACE
# - adds the trait to the list of traits of a class, no actual composition done
# ZEND_BIND_TRAITS
# - emitted in zend_do_end_class_declaration
# - concludes the class definition and will initiate the trait composition
# when the class definition is encountered during runtime
#
# Added Flags
# ZEND_ACC_TRAIT = 0x120
# ZEND_ACC_IMPLEMENT_TRAITS = 0x400000
# ZEND_FETCH_CLASS_TRAIT = 14
#
# zend_vm_execute.h
# - not sure whether the handler initialization (ZEND_ADD_TRAIT_SPEC_HANDLER,
# ZEND_BIND_TRAITS_SPEC_HANDLER) is correct, maybe it should be more selective
#
# zend_compile.c
# - refactored do_inherit_method_check
# split into do_inherit_method_check and do_inheritance_check_on_method
# - added helper functions use a '_' as prefix and are not mentioned in the
# headers
# - _copy_functions
# prepare hash-maps of functions which should be merged into a class
# here the aliases are handled
# - _merge_functions
# builds a hash-table of the methods which need to be added to a class
# does the conflict detection
# - reused php_runkit_function_copy_ctor
# - it is not identical with the original code anymore, needed to update it
# think I fixed some bugs, not sure whether all have been reported back to runkit
# - has to be renamed, left the name for the moment, to make its origin obvious
# - here might be optimization potential
# - not sure whether everything needs to be copied
# - copying the literals might be broken
# - added it since the literals array is freed by efree and gave problems
# with doubled frees
# - all immutable parts of the zend_op array should not be copied
# - am not sure which parts are immutable
# - and not sure how to avoid doubled frees on the same arrays on shutdown
# - _merge_functions_to_class
# does the final merging with the target class to handle inherited
# and overridden methods
# - small helper for NULL terminated lists
# zend_init_list, zend_add_to_list
#
# zend_language_parser.y
# - reused class definition for traits
# - there should be something with regard to properties
# - if they get explicitly defined, it might be worthwhile to
# check that there are no collisions with other traits in a composition
# (however, I would not introduce elaborate language features to control that
# but a notice for such conflicts might be nice to the developers)
2010-04-23 06:05:56 +08:00
}
ZEND_VM_HANDLER ( 155 , ZEND_BIND_TRAITS , ANY , ANY )
{
2011-05-06 00:02:11 +08:00
USE_OPLINE
2014-02-10 14:04:30 +08:00
zend_class_entry * ce = Z_CE_P ( EX_VAR ( opline - > op1 . var ) ) ;
2011-03-16 13:25:02 +08:00
2011-05-06 00:02:11 +08:00
SAVE_OPLINE ( ) ;
2014-12-14 06:06:14 +08:00
zend_do_bind_traits ( ce ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
Implemented Traits for PHP as proposed in the RFC [TRAITS]
# RFC http://wiki.php.net/rfc/horizontalreuse#traits_-_reuse_of_behavior
# Ok, here we go, I guess that will result in more discussion, which is fine
# by me. But now, the patch is here, and properly archived.
#
# See below a list of notes to the patch, it also includes a list of
# points which should be fixed
#
# Internals of the Traits Patch
# -----------------------------
#
# Open TODOs
# """"""""""
#
# - Reflection API
# - support for traits for internal classes
# - currently destroy_zend_class does not handle that case
#
# Introduced Structures
# """""""""""""""""""""
#
# Data structures to encode the composition information specified in the
# source:
# - zend_trait_method_reference
# - zend_trait_precedence
# - zend_trait_alias
#
# Changes
# """""""
#
# zend_class_entry
# - uses NULL terminated lists of pointers for
# - trait_aliases
# - trait_precedences
# - do you prefer an explicit counter?
# - the information is only necessary during class composition
# but might be interesting for reflection
# - did not want to blow up class further with not really necessary length counters
#
# added keywords
# - trait
# - insteadof
#
# Added opcodes
# ZEND_ADD_TRAIT
# - similar to ZEND_ADD_INTERFACE
# - adds the trait to the list of traits of a class, no actual composition done
# ZEND_BIND_TRAITS
# - emitted in zend_do_end_class_declaration
# - concludes the class definition and will initiate the trait composition
# when the class definition is encountered during runtime
#
# Added Flags
# ZEND_ACC_TRAIT = 0x120
# ZEND_ACC_IMPLEMENT_TRAITS = 0x400000
# ZEND_FETCH_CLASS_TRAIT = 14
#
# zend_vm_execute.h
# - not sure whether the handler initialization (ZEND_ADD_TRAIT_SPEC_HANDLER,
# ZEND_BIND_TRAITS_SPEC_HANDLER) is correct, maybe it should be more selective
#
# zend_compile.c
# - refactored do_inherit_method_check
# split into do_inherit_method_check and do_inheritance_check_on_method
# - added helper functions use a '_' as prefix and are not mentioned in the
# headers
# - _copy_functions
# prepare hash-maps of functions which should be merged into a class
# here the aliases are handled
# - _merge_functions
# builds a hash-table of the methods which need to be added to a class
# does the conflict detection
# - reused php_runkit_function_copy_ctor
# - it is not identical with the original code anymore, needed to update it
# think I fixed some bugs, not sure whether all have been reported back to runkit
# - has to be renamed, left the name for the moment, to make its origin obvious
# - here might be optimization potential
# - not sure whether everything needs to be copied
# - copying the literals might be broken
# - added it since the literals array is freed by efree and gave problems
# with doubled frees
# - all immutable parts of the zend_op array should not be copied
# - am not sure which parts are immutable
# - and not sure how to avoid doubled frees on the same arrays on shutdown
# - _merge_functions_to_class
# does the final merging with the target class to handle inherited
# and overridden methods
# - small helper for NULL terminated lists
# zend_init_list, zend_add_to_list
#
# zend_language_parser.y
# - reused class definition for traits
# - there should be something with regard to properties
# - if they get explicitly defined, it might be worthwhile to
# check that there are no collisions with other traits in a composition
# (however, I would not introduce elaborate language features to control that
# but a notice for such conflicts might be nice to the developers)
2010-04-23 06:05:56 +08:00
}
2016-05-25 06:25:12 +08:00
ZEND_VM_HELPER ( zend_dispatch_try_catch_finally_helper , ANY , ANY , uint32_t try_catch_offset , uint32_t op_num )
{
2016-05-28 20:38:11 +08:00
/* May be NULL during generator closing (only finally blocks are executed) */
2016-05-25 06:25:12 +08:00
zend_object * ex = EG ( exception ) ;
/* Walk try/catch/finally structures upwards, performing the necessary actions */
while ( try_catch_offset ! = ( uint32_t ) - 1 ) {
zend_try_catch_element * try_catch =
& EX ( func ) - > op_array . try_catch_array [ try_catch_offset ] ;
2016-05-28 20:38:11 +08:00
if ( op_num < try_catch - > catch_op & & ex ) {
2016-05-25 06:25:12 +08:00
/* Go to catch block */
cleanup_live_vars ( execute_data , op_num , try_catch - > catch_op ) ;
ZEND_VM_SET_OPCODE ( & EX ( func ) - > op_array . opcodes [ try_catch - > catch_op ] ) ;
ZEND_VM_CONTINUE ( ) ;
} else if ( op_num < try_catch - > finally_op ) {
/* Go to finally block */
zval * fast_call = EX_VAR ( EX ( func ) - > op_array . opcodes [ try_catch - > finally_end ] . op1 . var ) ;
cleanup_live_vars ( execute_data , op_num , try_catch - > finally_op ) ;
Z_OBJ_P ( fast_call ) = EG ( exception ) ;
EG ( exception ) = NULL ;
2018-01-23 17:56:22 +08:00
Z_OPLINE_NUM_P ( fast_call ) = ( uint32_t ) - 1 ;
2016-05-25 06:25:12 +08:00
ZEND_VM_SET_OPCODE ( & EX ( func ) - > op_array . opcodes [ try_catch - > finally_op ] ) ;
ZEND_VM_CONTINUE ( ) ;
} else if ( op_num < try_catch - > finally_end ) {
zval * fast_call = EX_VAR ( EX ( func ) - > op_array . opcodes [ try_catch - > finally_end ] . op1 . var ) ;
2016-06-08 07:20:45 +08:00
/* cleanup incomplete RETURN statement */
2018-01-23 17:56:22 +08:00
if ( Z_OPLINE_NUM_P ( fast_call ) ! = ( uint32_t ) - 1
& & ( EX ( func ) - > op_array . opcodes [ Z_OPLINE_NUM_P ( fast_call ) ] . op2_type & ( IS_TMP_VAR | IS_VAR ) ) ) {
zval * return_value = EX_VAR ( EX ( func ) - > op_array . opcodes [ Z_OPLINE_NUM_P ( fast_call ) ] . op2 . var ) ;
2016-06-08 07:20:45 +08:00
zval_ptr_dtor ( return_value ) ;
}
/* Chain potential exception from wrapping finally block */
2016-05-25 06:25:12 +08:00
if ( Z_OBJ_P ( fast_call ) ) {
2016-05-28 20:38:11 +08:00
if ( ex ) {
zend_exception_set_previous ( ex , Z_OBJ_P ( fast_call ) ) ;
} else {
EG ( exception ) = Z_OBJ_P ( fast_call ) ;
}
2016-05-25 06:25:12 +08:00
ex = Z_OBJ_P ( fast_call ) ;
}
}
try_catch_offset - - ;
}
/* Uncaught exception */
cleanup_live_vars ( execute_data , op_num , 0 ) ;
if ( UNEXPECTED ( ( EX_CALL_INFO ( ) & ZEND_CALL_GENERATOR ) ! = 0 ) ) {
2017-06-16 06:42:49 +08:00
zend_generator * generator = zend_get_running_generator ( EXECUTE_DATA_C ) ;
2016-05-25 06:25:12 +08:00
zend_generator_close ( generator , 1 ) ;
ZEND_VM_RETURN ( ) ;
} else {
ZEND_VM_DISPATCH_TO_HELPER ( zend_leave_helper ) ;
}
}
2004-10-23 05:42:14 +08:00
ZEND_VM_HANDLER ( 149 , ZEND_HANDLE_EXCEPTION , ANY , ANY )
{
2016-12-07 05:41:07 +08:00
const zend_op * throw_op = EG ( opline_before_exception ) ;
uint32_t throw_op_num = throw_op - EX ( func ) - > op_array . opcodes ;
2016-06-21 21:55:17 +08:00
int i , current_try_catch_offset = - 1 ;
2008-01-24 17:41:39 +08:00
2018-02-17 04:25:49 +08:00
if ( ( throw_op - > opcode = = ZEND_FREE | | throw_op - > opcode = = ZEND_FE_FREE )
& & throw_op - > extended_value & ZEND_FREE_ON_RETURN ) {
/* exceptions thrown because of loop var destruction on return/break/...
* are logically thrown at the end of the foreach loop , so adjust the
* throw_op_num .
*/
const zend_live_range * range = find_live_range (
& EX ( func ) - > op_array , throw_op_num , throw_op - > op1 . var ) ;
throw_op_num = range - > end ;
2015-07-10 19:30:25 +08:00
}
2016-05-25 06:25:12 +08:00
/* Find the innermost try/catch/finally the exception was thrown in */
2015-11-11 16:12:44 +08:00
for ( i = 0 ; i < EX ( func ) - > op_array . last_try_catch ; i + + ) {
2016-05-25 06:25:12 +08:00
zend_try_catch_element * try_catch = & EX ( func ) - > op_array . try_catch_array [ i ] ;
if ( try_catch - > try_op > throw_op_num ) {
2004-10-23 05:42:14 +08:00
/* further blocks will not be relevant... */
break ;
2012-10-05 14:14:20 +08:00
}
2016-05-25 06:25:12 +08:00
if ( throw_op_num < try_catch - > catch_op | | throw_op_num < try_catch - > finally_end ) {
current_try_catch_offset = i ;
2013-12-13 00:15:50 +08:00
}
2004-10-23 05:42:14 +08:00
}
2016-05-25 06:25:12 +08:00
cleanup_unfinished_calls ( execute_data , throw_op_num ) ;
2014-11-27 14:56:43 +08:00
2016-12-07 05:41:07 +08:00
if ( throw_op - > result_type & ( IS_VAR | IS_TMP_VAR ) ) {
switch ( throw_op - > opcode ) {
case ZEND_ADD_ARRAY_ELEMENT :
2017-08-14 17:11:25 +08:00
case ZEND_ROPE_INIT :
2016-12-07 05:41:07 +08:00
case ZEND_ROPE_ADD :
break ; /* exception while building structures, live range handling will free those */
case ZEND_FETCH_CLASS :
case ZEND_DECLARE_CLASS :
case ZEND_DECLARE_INHERITED_CLASS :
case ZEND_DECLARE_ANON_CLASS :
case ZEND_DECLARE_ANON_INHERITED_CLASS :
break ; /* return value is zend_class_entry pointer */
default :
zval_ptr_dtor_nogc ( EX_VAR ( throw_op - > result . var ) ) ;
}
}
2016-05-25 06:25:12 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_dispatch_try_catch_finally_helper , try_catch_offset , current_try_catch_offset , op_num , throw_op_num ) ;
2004-10-23 05:42:14 +08:00
}
ZEND_VM_HANDLER ( 146 , ZEND_VERIFY_ABSTRACT_CLASS , ANY , ANY )
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
SAVE_OPLINE ( ) ;
2014-12-14 06:06:14 +08:00
zend_verify_abstract_class ( Z_CE_P ( EX_VAR ( opline - > op1 . var ) ) ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2004-10-23 05:42:14 +08:00
}
2005-06-10 17:54:38 +08:00
ZEND_VM_HANDLER ( 150 , ZEND_USER_OPCODE , ANY , ANY )
2006-05-12 05:07:39 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
int ret ;
2011-03-16 13:25:02 +08:00
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
2015-03-13 01:39:04 +08:00
ret = zend_user_opcode_handlers [ opline - > opcode ] ( execute_data ) ;
2015-10-26 21:01:20 +08:00
opline = EX ( opline ) ;
2005-06-16 14:00:48 +08:00
switch ( ret ) {
2005-06-10 17:54:38 +08:00
case ZEND_USER_OPCODE_CONTINUE :
ZEND_VM_CONTINUE ( ) ;
case ZEND_USER_OPCODE_RETURN :
2016-05-16 17:42:13 +08:00
if ( UNEXPECTED ( ( EX_CALL_INFO ( ) & ZEND_CALL_GENERATOR ) ! = 0 ) ) {
2017-06-16 06:42:49 +08:00
zend_generator * generator = zend_get_running_generator ( EXECUTE_DATA_C ) ;
2015-02-20 03:17:37 +08:00
zend_generator_close ( generator , 1 ) ;
ZEND_VM_RETURN ( ) ;
2012-12-11 21:25:32 +08:00
} else {
ZEND_VM_DISPATCH_TO_HELPER ( zend_leave_helper ) ;
}
2009-08-18 18:12:32 +08:00
case ZEND_USER_OPCODE_ENTER :
ZEND_VM_ENTER ( ) ;
case ZEND_USER_OPCODE_LEAVE :
ZEND_VM_LEAVE ( ) ;
2005-06-10 17:54:38 +08:00
case ZEND_USER_OPCODE_DISPATCH :
2010-04-20 19:16:39 +08:00
ZEND_VM_DISPATCH ( opline - > opcode , opline ) ;
2005-06-10 17:54:38 +08:00
default :
2010-04-20 19:16:39 +08:00
ZEND_VM_DISPATCH ( ( zend_uchar ) ( ret & 0xff ) , opline ) ;
2005-06-10 17:54:38 +08:00
}
}
2007-09-29 03:52:53 +08:00
ZEND_VM_HANDLER ( 143 , ZEND_DECLARE_CONST , CONST , CONST )
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2007-09-29 03:52:53 +08:00
zend_free_op free_op1 , free_op2 ;
2010-04-20 19:16:39 +08:00
zval * name ;
zval * val ;
2007-09-29 03:52:53 +08:00
zend_constant c ;
2010-04-20 19:16:39 +08:00
SAVE_OPLINE ( ) ;
name = GET_OP1_ZVAL_PTR ( BP_VAR_R ) ;
val = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
2016-05-03 00:22:15 +08:00
ZVAL_COPY ( & c . value , val ) ;
2014-04-04 07:55:27 +08:00
if ( Z_OPT_CONSTANT ( c . value ) ) {
2016-04-28 09:13:34 +08:00
if ( UNEXPECTED ( zval_update_constant_ex ( & c . value , EX ( func ) - > op_array . scope ) ! = SUCCESS ) ) {
2017-10-09 17:24:11 +08:00
zval_ptr_dtor_nogc ( & c . value ) ;
2015-04-02 07:05:25 +08:00
FREE_OP1 ( ) ;
FREE_OP2 ( ) ;
HANDLE_EXCEPTION ( ) ;
}
2007-09-29 03:52:53 +08:00
}
2017-12-07 17:26:48 +08:00
c . flags = CONST_CS ; /* non persistent, case sensitive */
2017-12-07 17:00:41 +08:00
c . name = zend_string_copy ( Z_STR_P ( name ) ) ;
2007-09-29 03:52:53 +08:00
c . module_number = PHP_USER_CONSTANT ;
2014-12-14 06:06:14 +08:00
if ( zend_register_constant ( & c ) = = FAILURE ) {
2007-09-29 03:52:53 +08:00
}
FREE_OP1 ( ) ;
FREE_OP2 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2007-09-29 03:52:53 +08:00
}
2010-04-20 18:57:45 +08:00
ZEND_VM_HANDLER ( 153 , ZEND_DECLARE_LAMBDA_FUNCTION , CONST , UNUSED )
2008-07-14 17:49:03 +08:00
{
2010-04-20 19:16:39 +08:00
USE_OPLINE
2014-02-10 14:04:30 +08:00
zval * zfunc ;
2016-04-01 21:17:49 +08:00
zval * object ;
zend_class_entry * called_scope ;
2008-07-14 17:49:03 +08:00
2017-11-24 19:01:19 +08:00
zfunc = zend_hash_find_ex ( EG ( function_table ) , Z_STR_P ( RT_CONSTANT ( opline , opline - > op1 ) ) , 1 ) ;
2015-03-09 20:57:15 +08:00
ZEND_ASSERT ( zfunc ! = NULL & & Z_FUNC_P ( zfunc ) - > type = = ZEND_USER_FUNCTION ) ;
2008-07-14 17:49:03 +08:00
2016-04-01 21:17:49 +08:00
if ( Z_TYPE ( EX ( This ) ) = = IS_OBJECT ) {
called_scope = Z_OBJCE ( EX ( This ) ) ;
if ( UNEXPECTED ( ( Z_FUNC_P ( zfunc ) - > common . fn_flags & ZEND_ACC_STATIC ) | |
2015-05-04 19:23:21 +08:00
( EX ( func ) - > common . fn_flags & ZEND_ACC_STATIC ) ) ) {
2016-04-01 21:17:49 +08:00
object = NULL ;
} else {
object = & EX ( This ) ;
}
2014-05-13 11:53:08 +08:00
} else {
2016-04-01 21:17:49 +08:00
called_scope = Z_CE ( EX ( This ) ) ;
object = NULL ;
2014-05-13 11:53:08 +08:00
}
2016-04-01 21:17:49 +08:00
zend_create_closure ( EX_VAR ( opline - > result . var ) , Z_FUNC_P ( zfunc ) ,
2016-04-28 09:13:34 +08:00
EX ( func ) - > op_array . scope , called_scope , object ) ;
2008-07-14 17:49:03 +08:00
2016-12-19 20:36:37 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
2008-07-14 17:49:03 +08:00
}
2010-08-25 17:14:36 +08:00
ZEND_VM_HANDLER ( 156 , ZEND_SEPARATE , VAR , UNUSED )
{
USE_OPLINE
2014-02-10 14:04:30 +08:00
zval * var_ptr ;
2010-08-25 17:14:36 +08:00
2014-02-10 14:04:30 +08:00
var_ptr = EX_VAR ( opline - > op1 . var ) ;
2015-08-23 20:17:26 +08:00
if ( UNEXPECTED ( Z_ISREF_P ( var_ptr ) ) ) {
if ( UNEXPECTED ( Z_REFCOUNT_P ( var_ptr ) = = 1 ) ) {
ZVAL_UNREF ( var_ptr ) ;
}
2010-08-25 17:14:36 +08:00
}
2016-04-12 20:33:56 +08:00
2010-08-25 17:14:36 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
}
2018-02-21 17:07:29 +08:00
ZEND_VM_COLD_HELPER ( zend_yield_in_closed_generator_helper , ANY , ANY )
2018-02-21 15:10:04 +08:00
{
USE_OPLINE
SAVE_OPLINE ( ) ;
zend_throw_error ( NULL , " Cannot yield from finally in a force-closed generator " ) ;
FREE_UNFETCHED_OP2 ( ) ;
FREE_UNFETCHED_OP1 ( ) ;
UNDEF_RESULT ( ) ;
HANDLE_EXCEPTION ( ) ;
}
2015-12-11 05:47:02 +08:00
ZEND_VM_HANDLER ( 160 , ZEND_YIELD , CONST | TMP | VAR | CV | UNUSED , CONST | TMP | VAR | CV | UNUSED , SRC )
2012-05-27 04:44:53 +08:00
{
2012-05-29 23:34:33 +08:00
USE_OPLINE
2017-06-16 06:42:49 +08:00
zend_generator * generator = zend_get_running_generator ( EXECUTE_DATA_C ) ;
2012-05-27 04:44:53 +08:00
2015-03-13 01:39:04 +08:00
SAVE_OPLINE ( ) ;
2015-06-05 00:13:40 +08:00
if ( UNEXPECTED ( generator - > flags & ZEND_GENERATOR_FORCED_CLOSE ) ) {
2018-02-21 15:10:04 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_yield_in_closed_generator_helper ) ;
2012-08-25 23:40:08 +08:00
}
2012-05-27 04:44:53 +08:00
/* Destroy the previously yielded value */
2014-02-12 18:29:51 +08:00
zval_ptr_dtor ( & generator - > value ) ;
2012-05-27 04:44:53 +08:00
2012-05-30 08:44:06 +08:00
/* Destroy the previously yielded key */
2014-02-12 18:29:51 +08:00
zval_ptr_dtor ( & generator - > key ) ;
2012-05-30 08:44:06 +08:00
2012-05-29 23:34:33 +08:00
/* Set the new yielded value */
2012-05-29 23:53:11 +08:00
if ( OP1_TYPE ! = IS_UNUSED ) {
2012-07-20 23:38:39 +08:00
zend_free_op free_op1 ;
2015-06-05 00:13:40 +08:00
if ( UNEXPECTED ( EX ( func ) - > op_array . fn_flags & ZEND_ACC_RETURN_REFERENCE ) ) {
2012-07-17 19:24:27 +08:00
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice . */
2016-02-15 11:12:04 +08:00
if ( OP1_TYPE & ( IS_CONST | IS_TMP_VAR ) ) {
2014-02-12 18:29:51 +08:00
zval * value ;
2012-05-27 04:44:53 +08:00
2012-07-17 19:24:27 +08:00
zend_error ( E_NOTICE , " Only variable references should be yielded by reference " ) ;
2012-05-27 04:44:53 +08:00
2012-07-17 19:24:27 +08:00
value = GET_OP1_ZVAL_PTR ( BP_VAR_R ) ;
2014-02-12 18:29:51 +08:00
ZVAL_COPY_VALUE ( & generator - > value , value ) ;
2016-02-11 23:32:45 +08:00
if ( OP1_TYPE = = IS_CONST ) {
2016-05-17 13:45:06 +08:00
if ( UNEXPECTED ( Z_OPT_REFCOUNTED ( generator - > value ) ) ) {
Z_ADDREF ( generator - > value ) ;
2015-06-05 00:13:40 +08:00
}
2012-07-17 19:24:27 +08:00
}
} else {
2014-03-04 16:27:50 +08:00
zval * value_ptr = GET_OP1_ZVAL_PTR_PTR ( BP_VAR_W ) ;
2012-05-27 04:44:53 +08:00
2012-07-17 19:24:27 +08:00
/* If a function call result is yielded and the function did
* not return by reference we throw a notice . */
2014-10-23 01:45:02 +08:00
if ( OP1_TYPE = = IS_VAR & &
( value_ptr = = & EG ( uninitialized_zval ) | |
( opline - > extended_value = = ZEND_RETURNS_FUNCTION & &
2016-04-10 19:01:54 +08:00
! Z_ISREF_P ( value_ptr ) ) ) ) {
2012-07-17 19:24:27 +08:00
zend_error ( E_NOTICE , " Only variable references should be yielded by reference " ) ;
2017-12-26 18:30:25 +08:00
ZVAL_COPY ( & generator - > value , value_ptr ) ;
2012-07-17 19:24:27 +08:00
} else {
2017-12-26 18:30:25 +08:00
if ( Z_ISREF_P ( value_ptr ) ) {
Z_ADDREF_P ( value_ptr ) ;
} else {
ZVAL_MAKE_REF_EX ( value_ptr , 2 ) ;
}
ZVAL_REF ( & generator - > value , Z_REF_P ( value_ptr ) ) ;
2012-07-17 19:24:27 +08:00
}
2013-05-17 17:15:09 +08:00
FREE_OP1_VAR_PTR ( ) ;
2012-07-17 19:24:27 +08:00
}
2012-05-27 04:44:53 +08:00
} else {
2012-07-17 19:24:27 +08:00
zval * value = GET_OP1_ZVAL_PTR ( BP_VAR_R ) ;
2012-05-27 04:44:53 +08:00
2012-07-17 19:24:27 +08:00
/* Consts, temporary variables and references need copying */
2014-04-16 05:45:40 +08:00
if ( OP1_TYPE = = IS_CONST ) {
2015-06-05 00:13:40 +08:00
ZVAL_COPY_VALUE ( & generator - > value , value ) ;
2016-05-17 13:45:06 +08:00
if ( UNEXPECTED ( Z_OPT_REFCOUNTED ( generator - > value ) ) ) {
Z_ADDREF ( generator - > value ) ;
2015-06-05 00:13:40 +08:00
}
2014-04-16 05:45:40 +08:00
} else if ( OP1_TYPE = = IS_TMP_VAR ) {
2014-02-12 18:29:51 +08:00
ZVAL_COPY_VALUE ( & generator - > value , value ) ;
2015-06-05 00:13:40 +08:00
} else if ( ( OP1_TYPE & ( IS_VAR | IS_CV ) ) & & Z_ISREF_P ( value ) ) {
ZVAL_COPY ( & generator - > value , Z_REFVAL_P ( value ) ) ;
2013-05-17 17:15:09 +08:00
FREE_OP1_IF_VAR ( ) ;
2012-07-17 19:24:27 +08:00
} else {
2014-09-22 20:17:35 +08:00
ZVAL_COPY_VALUE ( & generator - > value , value ) ;
2013-05-17 17:15:09 +08:00
if ( OP1_TYPE = = IS_CV ) {
2014-09-22 20:17:35 +08:00
if ( Z_OPT_REFCOUNTED_P ( value ) ) Z_ADDREF_P ( value ) ;
2013-05-17 17:15:09 +08:00
}
2012-07-17 19:24:27 +08:00
}
}
2012-05-29 23:53:11 +08:00
} else {
2012-05-30 08:44:06 +08:00
/* If no value was specified yield null */
2014-02-12 18:29:51 +08:00
ZVAL_NULL ( & generator - > value ) ;
2012-05-27 04:44:53 +08:00
}
2012-05-30 08:44:06 +08:00
/* Set the new yielded key */
if ( OP2_TYPE ! = IS_UNUSED ) {
zend_free_op free_op2 ;
zval * key = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
/* Consts, temporary variables and references need copying */
2014-04-16 05:45:40 +08:00
if ( OP2_TYPE = = IS_CONST ) {
2015-06-05 00:13:40 +08:00
ZVAL_COPY_VALUE ( & generator - > key , key ) ;
2016-05-17 13:45:06 +08:00
if ( UNEXPECTED ( Z_OPT_REFCOUNTED ( generator - > key ) ) ) {
Z_ADDREF ( generator - > key ) ;
2015-06-05 00:13:40 +08:00
}
2014-04-16 05:45:40 +08:00
} else if ( OP2_TYPE = = IS_TMP_VAR ) {
2014-02-12 18:29:51 +08:00
ZVAL_COPY_VALUE ( & generator - > key , key ) ;
2015-06-05 00:13:40 +08:00
} else if ( ( OP2_TYPE & ( IS_VAR | IS_CV ) ) & & Z_ISREF_P ( key ) ) {
ZVAL_COPY ( & generator - > key , Z_REFVAL_P ( key ) ) ;
2014-04-16 05:45:40 +08:00
FREE_OP2_IF_VAR ( ) ;
2012-05-30 08:44:06 +08:00
} else {
2014-09-22 20:17:35 +08:00
ZVAL_COPY_VALUE ( & generator - > key , key ) ;
2014-04-16 20:35:41 +08:00
if ( OP2_TYPE = = IS_CV ) {
2014-09-22 20:17:35 +08:00
if ( Z_OPT_REFCOUNTED_P ( key ) ) Z_ADDREF_P ( key ) ;
2014-04-16 05:45:40 +08:00
}
2012-05-30 08:44:06 +08:00
}
2014-08-26 01:24:55 +08:00
if ( Z_TYPE ( generator - > key ) = = IS_LONG
& & Z_LVAL ( generator - > key ) > generator - > largest_used_integer_key
2012-05-30 11:05:49 +08:00
) {
2014-08-26 01:24:55 +08:00
generator - > largest_used_integer_key = Z_LVAL ( generator - > key ) ;
2012-05-30 11:05:49 +08:00
}
2012-05-30 08:44:06 +08:00
} else {
2012-05-30 11:05:49 +08:00
/* If no key was specified we use auto-increment keys */
generator - > largest_used_integer_key + + ;
2014-08-26 01:24:55 +08:00
ZVAL_LONG ( & generator - > key , generator - > largest_used_integer_key ) ;
2012-05-30 08:44:06 +08:00
}
2013-11-30 20:05:40 +08:00
if ( RETURN_VALUE_USED ( opline ) ) {
/* If the return value of yield is used set the send
* target and initialize it to NULL */
2014-02-12 18:29:51 +08:00
generator - > send_target = EX_VAR ( opline - > result . var ) ;
ZVAL_NULL ( generator - > send_target ) ;
2013-11-30 20:05:40 +08:00
} else {
generator - > send_target = NULL ;
}
2012-05-29 23:34:33 +08:00
2012-07-20 06:49:50 +08:00
/* We increment to the next op, so we are at the correct position when the
* generator is resumed . */
ZEND_VM_INC_OPCODE ( ) ;
2012-05-29 08:31:56 +08:00
/* The GOTO VM uses a local opline variable. We need to set the opline
* variable in execute_data so we don ' t resume at an old position . */
SAVE_OPLINE ( ) ;
2012-05-27 04:44:53 +08:00
ZEND_VM_RETURN ( ) ;
}
2015-04-14 23:58:58 +08:00
ZEND_VM_HANDLER ( 142 , ZEND_YIELD_FROM , CONST | TMP | VAR | CV , ANY )
2015-02-20 19:59:56 +08:00
{
USE_OPLINE
2017-06-16 06:42:49 +08:00
zend_generator * generator = zend_get_running_generator ( EXECUTE_DATA_C ) ;
2015-02-20 19:59:56 +08:00
zval * val ;
zend_free_op free_op1 ;
SAVE_OPLINE ( ) ;
val = GET_OP1_ZVAL_PTR_DEREF ( BP_VAR_R ) ;
2015-04-15 01:53:16 +08:00
2016-05-28 19:13:11 +08:00
if ( UNEXPECTED ( generator - > flags & ZEND_GENERATOR_FORCED_CLOSE ) ) {
zend_throw_error ( NULL , " Cannot use \" yield from \" in a force-closed generator " ) ;
FREE_OP1 ( ) ;
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2016-05-28 19:13:11 +08:00
HANDLE_EXCEPTION ( ) ;
}
2015-02-20 19:59:56 +08:00
if ( Z_TYPE_P ( val ) = = IS_ARRAY ) {
ZVAL_COPY_VALUE ( & generator - > values , val ) ;
if ( OP1_TYPE ! = IS_TMP_VAR & & Z_OPT_REFCOUNTED_P ( val ) ) {
Z_ADDREF_P ( val ) ;
}
Z_FE_POS ( generator - > values ) = 0 ;
FREE_OP1_IF_VAR ( ) ;
} else if ( OP1_TYPE ! = IS_CONST & & Z_TYPE_P ( val ) = = IS_OBJECT & & Z_OBJCE_P ( val ) - > get_iterator ) {
zend_class_entry * ce = Z_OBJCE_P ( val ) ;
if ( ce = = zend_ce_generator ) {
zend_generator * new_gen = ( zend_generator * ) Z_OBJ_P ( val ) ;
if ( OP1_TYPE ! = IS_TMP_VAR ) {
Z_ADDREF_P ( val ) ;
}
FREE_OP1_IF_VAR ( ) ;
2015-03-07 07:28:12 +08:00
if ( Z_ISUNDEF ( new_gen - > retval ) ) {
2015-04-16 03:56:11 +08:00
if ( UNEXPECTED ( zend_generator_get_current ( new_gen ) = = generator ) ) {
2015-07-08 01:10:22 +08:00
zend_throw_error ( NULL , " Impossible to yield from the Generator being currently run " ) ;
2016-07-14 21:55:30 +08:00
zval_ptr_dtor ( val ) ;
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2015-04-16 03:56:11 +08:00
HANDLE_EXCEPTION ( ) ;
} else {
zend_generator_yield_from ( generator , new_gen ) ;
}
} else if ( UNEXPECTED ( new_gen - > execute_data = = NULL ) ) {
2015-07-08 01:10:22 +08:00
zend_throw_error ( NULL , " Generator passed to yield from was aborted without proper return and is unable to continue " ) ;
2016-07-14 21:55:30 +08:00
zval_ptr_dtor ( val ) ;
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2015-04-15 01:53:16 +08:00
HANDLE_EXCEPTION ( ) ;
2015-03-07 07:28:12 +08:00
} else {
if ( RETURN_VALUE_USED ( opline ) ) {
ZVAL_COPY ( EX_VAR ( opline - > result . var ) , & new_gen - > retval ) ;
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
2015-02-20 19:59:56 +08:00
} else {
zend_object_iterator * iter = ce - > get_iterator ( ce , val , 0 ) ;
FREE_OP1 ( ) ;
if ( UNEXPECTED ( ! iter ) | | UNEXPECTED ( EG ( exception ) ) ) {
if ( ! EG ( exception ) ) {
2015-07-08 01:10:22 +08:00
zend_throw_error ( NULL , " Object of type %s did not create an Iterator " , ZSTR_VAL ( ce - > name ) ) ;
2015-02-20 19:59:56 +08:00
}
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2015-02-20 19:59:56 +08:00
HANDLE_EXCEPTION ( ) ;
}
iter - > index = 0 ;
if ( iter - > funcs - > rewind ) {
iter - > funcs - > rewind ( iter ) ;
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
OBJ_RELEASE ( & iter - > std ) ;
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2015-02-20 19:59:56 +08:00
HANDLE_EXCEPTION ( ) ;
}
}
ZVAL_OBJ ( & generator - > values , & iter - > std ) ;
}
} else {
2016-06-21 21:00:37 +08:00
zend_throw_error ( NULL , " Can use \" yield from \" only with arrays and Traversables " ) ;
2016-12-07 05:41:07 +08:00
UNDEF_RESULT ( ) ;
2015-02-20 19:59:56 +08:00
HANDLE_EXCEPTION ( ) ;
}
2015-03-07 07:28:12 +08:00
/* This is the default return value
* when the expression is a Generator , it will be overwritten in zend_generator_resume ( ) */
2015-02-20 19:59:56 +08:00
if ( RETURN_VALUE_USED ( opline ) ) {
ZVAL_NULL ( EX_VAR ( opline - > result . var ) ) ;
}
2016-02-11 23:22:42 +08:00
/* This generator has no send target (though the generator we delegate to might have one) */
generator - > send_target = NULL ;
2015-02-20 19:59:56 +08:00
/* We increment to the next op, so we are at the correct position when the
* generator is resumed . */
ZEND_VM_INC_OPCODE ( ) ;
/* The GOTO VM uses a local opline variable. We need to set the opline
* variable in execute_data so we don ' t resume at an old position . */
SAVE_OPLINE ( ) ;
ZEND_VM_RETURN ( ) ;
}
2012-12-13 06:48:51 +08:00
ZEND_VM_HANDLER ( 159 , ZEND_DISCARD_EXCEPTION , ANY , ANY )
{
2014-11-27 14:56:43 +08:00
USE_OPLINE
zval * fast_call = EX_VAR ( opline - > op1 . var ) ;
2016-06-08 05:23:33 +08:00
SAVE_OPLINE ( ) ;
2016-06-08 07:20:45 +08:00
/* cleanup incomplete RETURN statement */
2018-01-23 17:56:22 +08:00
if ( Z_OPLINE_NUM_P ( fast_call ) ! = ( uint32_t ) - 1
& & ( EX ( func ) - > op_array . opcodes [ Z_OPLINE_NUM_P ( fast_call ) ] . op2_type & ( IS_TMP_VAR | IS_VAR ) ) ) {
zval * return_value = EX_VAR ( EX ( func ) - > op_array . opcodes [ Z_OPLINE_NUM_P ( fast_call ) ] . op2 . var ) ;
2015-01-03 17:22:58 +08:00
2016-06-08 07:20:45 +08:00
zval_ptr_dtor ( return_value ) ;
2016-06-08 05:23:33 +08:00
}
2015-01-03 17:22:58 +08:00
2016-06-08 07:20:45 +08:00
/* cleanup delayed exception */
2014-11-27 14:56:43 +08:00
if ( Z_OBJ_P ( fast_call ) ! = NULL ) {
2012-12-13 06:48:51 +08:00
/* discard the previously thrown exception */
2014-11-27 14:56:43 +08:00
OBJ_RELEASE ( Z_OBJ_P ( fast_call ) ) ;
Z_OBJ_P ( fast_call ) = NULL ;
2012-12-13 06:48:51 +08:00
}
2016-06-08 05:23:33 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2012-12-13 06:48:51 +08:00
}
2016-05-25 06:25:12 +08:00
ZEND_VM_HANDLER ( 162 , ZEND_FAST_CALL , JMP_ADDR , ANY )
2012-11-22 19:17:05 +08:00
{
USE_OPLINE
2014-11-27 14:56:43 +08:00
zval * fast_call = EX_VAR ( opline - > result . var ) ;
2012-11-22 19:17:05 +08:00
2016-05-25 06:25:12 +08:00
Z_OBJ_P ( fast_call ) = NULL ;
/* set return address */
2018-01-23 17:56:22 +08:00
Z_OPLINE_NUM_P ( fast_call ) = opline - EX ( func ) - > op_array . opcodes ;
2014-12-12 15:19:41 +08:00
ZEND_VM_SET_OPCODE ( OP_JMP_ADDR ( opline , opline - > op1 ) ) ;
2012-11-22 19:17:05 +08:00
ZEND_VM_CONTINUE ( ) ;
}
2016-05-25 06:25:12 +08:00
ZEND_VM_HANDLER ( 163 , ZEND_FAST_RET , ANY , TRY_CATCH )
2012-11-22 19:17:05 +08:00
{
2014-11-27 14:56:43 +08:00
USE_OPLINE
zval * fast_call = EX_VAR ( opline - > op1 . var ) ;
2016-05-25 06:25:12 +08:00
uint32_t current_try_catch_offset , current_op_num ;
2014-11-27 14:56:43 +08:00
2018-01-23 17:56:22 +08:00
if ( Z_OPLINE_NUM_P ( fast_call ) ! = ( uint32_t ) - 1 ) {
const zend_op * fast_ret = EX ( func ) - > op_array . opcodes + Z_OPLINE_NUM_P ( fast_call ) ;
2016-05-25 06:25:12 +08:00
2016-04-20 16:06:52 +08:00
ZEND_VM_SET_OPCODE ( fast_ret + 1 ) ;
2012-11-22 19:17:05 +08:00
ZEND_VM_CONTINUE ( ) ;
}
2016-05-25 06:25:12 +08:00
/* special case for unhandled exceptions */
EG ( exception ) = Z_OBJ_P ( fast_call ) ;
Z_OBJ_P ( fast_call ) = NULL ;
current_try_catch_offset = opline - > op2 . num ;
current_op_num = opline - EX ( func ) - > op_array . opcodes ;
ZEND_VM_DISPATCH_TO_HELPER ( zend_dispatch_try_catch_finally_helper , try_catch_offset , current_try_catch_offset , op_num , current_op_num ) ;
2012-11-22 19:17:05 +08:00
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HOT_HANDLER ( 168 , ZEND_BIND_GLOBAL , CV , CONST , CACHE_SLOT )
2014-06-06 19:04:30 +08:00
{
USE_OPLINE
zend_free_op free_op1 , free_op2 ;
zval * varname ;
zval * value ;
zval * variable_ptr ;
2017-10-25 16:45:17 +08:00
uintptr_t idx ;
2016-06-08 17:55:31 +08:00
zend_reference * ref ;
2014-06-06 19:04:30 +08:00
2015-04-29 05:40:43 +08:00
ZEND_VM_REPEATABLE_OPCODE
2014-06-06 19:04:30 +08:00
varname = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
2015-01-03 17:22:58 +08:00
2014-11-24 20:46:34 +08:00
/* We store "hash slot index" + 1 (NULL is a mark of uninitialized cache slot) */
2018-02-06 00:41:47 +08:00
idx = ( uintptr_t ) CACHED_PTR ( opline - > extended_value ) - 1 ;
2017-10-24 15:28:19 +08:00
if ( EXPECTED ( idx < EG ( symbol_table ) . nNumUsed * sizeof ( Bucket ) ) ) {
Bucket * p = ( Bucket * ) ( ( char * ) EG ( symbol_table ) . arData + idx ) ;
2014-11-24 20:46:34 +08:00
if ( EXPECTED ( Z_TYPE ( p - > val ) ! = IS_UNDEF ) & &
( EXPECTED ( p - > key = = Z_STR_P ( varname ) ) | |
2015-06-30 18:59:27 +08:00
( EXPECTED ( p - > h = = ZSTR_H ( Z_STR_P ( varname ) ) ) & &
2014-11-24 20:46:34 +08:00
EXPECTED ( p - > key ! = NULL ) & &
2017-12-04 22:17:02 +08:00
EXPECTED ( zend_string_equal_content ( p - > key , Z_STR_P ( varname ) ) ) ) ) ) {
2015-01-03 17:22:58 +08:00
2017-10-24 15:28:19 +08:00
value = ( zval * ) p ; /* value = &p->val; */
2014-11-24 20:46:34 +08:00
ZEND_VM_C_GOTO ( check_indirect ) ;
}
}
2017-11-24 19:01:19 +08:00
value = zend_hash_find_ex ( & EG ( symbol_table ) , Z_STR_P ( varname ) , 1 ) ;
2014-11-24 20:46:34 +08:00
if ( UNEXPECTED ( value = = NULL ) ) {
2015-02-14 03:20:39 +08:00
value = zend_hash_add_new ( & EG ( symbol_table ) , Z_STR_P ( varname ) , & EG ( uninitialized_zval ) ) ;
2017-10-24 15:28:19 +08:00
idx = ( char * ) value - ( char * ) EG ( symbol_table ) . arData ;
2014-11-24 20:46:34 +08:00
/* Store "hash slot index" + 1 (NULL is a mark of uninitialized cache slot) */
2018-02-06 00:41:47 +08:00
CACHE_PTR ( opline - > extended_value , ( void * ) ( idx + 1 ) ) ;
2014-11-24 20:46:34 +08:00
} else {
2017-10-24 15:28:19 +08:00
idx = ( char * ) value - ( char * ) EG ( symbol_table ) . arData ;
2014-11-24 20:46:34 +08:00
/* Store "hash slot index" + 1 (NULL is a mark of uninitialized cache slot) */
2018-02-06 00:41:47 +08:00
CACHE_PTR ( opline - > extended_value , ( void * ) ( idx + 1 ) ) ;
2014-11-24 20:46:34 +08:00
ZEND_VM_C_LABEL ( check_indirect ) :
2014-06-06 19:04:30 +08:00
/* GLOBAL variable may be an INDIRECT pointer to CV */
2014-09-17 04:52:45 +08:00
if ( UNEXPECTED ( Z_TYPE_P ( value ) = = IS_INDIRECT ) ) {
value = Z_INDIRECT_P ( value ) ;
if ( UNEXPECTED ( Z_TYPE_P ( value ) = = IS_UNDEF ) ) {
ZVAL_NULL ( value ) ;
}
}
2014-06-06 19:04:30 +08:00
}
2016-06-08 17:55:31 +08:00
if ( UNEXPECTED ( ! Z_ISREF_P ( value ) ) ) {
2017-12-26 18:30:25 +08:00
ZVAL_MAKE_REF_EX ( value , 2 ) ;
ref = Z_REF_P ( value ) ;
2016-06-08 17:55:31 +08:00
} else {
ref = Z_REF_P ( value ) ;
2017-10-27 06:28:58 +08:00
GC_ADDREF ( ref ) ;
2016-06-08 17:55:31 +08:00
}
2015-04-29 04:57:21 +08:00
2016-06-08 17:55:31 +08:00
variable_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_W ) ;
2015-08-24 17:47:06 +08:00
2016-06-08 17:55:31 +08:00
if ( UNEXPECTED ( Z_REFCOUNTED_P ( variable_ptr ) ) ) {
2016-10-21 22:47:30 +08:00
zend_refcounted * ref = Z_COUNTED_P ( variable_ptr ) ;
2017-10-27 06:28:58 +08:00
uint32_t refcnt = GC_DELREF ( ref ) ;
2015-08-24 17:47:06 +08:00
2016-06-08 17:55:31 +08:00
if ( EXPECTED ( variable_ptr ! = value ) ) {
2015-08-24 17:47:06 +08:00
if ( refcnt = = 0 ) {
2015-04-29 04:57:21 +08:00
SAVE_OPLINE ( ) ;
2016-10-21 22:47:30 +08:00
zval_dtor_func ( ref ) ;
2015-04-29 04:57:21 +08:00
if ( UNEXPECTED ( EG ( exception ) ) ) {
ZVAL_NULL ( variable_ptr ) ;
HANDLE_EXCEPTION ( ) ;
}
} else {
2016-10-21 22:47:30 +08:00
gc_check_possible_root ( ref ) ;
2015-04-29 04:57:21 +08:00
}
}
2016-06-08 17:55:31 +08:00
}
ZVAL_REF ( variable_ptr , ref ) ;
2015-04-29 04:57:21 +08:00
2015-04-29 05:40:43 +08:00
ZEND_VM_REPEAT_OPCODE ( ZEND_BIND_GLOBAL ) ;
2015-04-29 19:20:44 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
2014-06-06 19:04:30 +08:00
}
2014-12-05 23:23:39 +08:00
ZEND_VM_HANDLER ( 121 , ZEND_STRLEN , CONST | TMPVAR | CV , ANY )
2014-07-11 22:52:27 +08:00
{
USE_OPLINE
zval * value ;
zend_free_op free_op1 ;
2015-06-05 06:53:32 +08:00
value = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
2014-07-11 22:52:27 +08:00
if ( EXPECTED ( Z_TYPE_P ( value ) = = IS_STRING ) ) {
2014-08-26 01:24:55 +08:00
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , Z_STRLEN_P ( value ) ) ;
2016-12-19 20:36:37 +08:00
FREE_OP1 ( ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
2015-03-20 21:04:04 +08:00
} else {
zend_bool strict ;
2014-12-05 23:23:39 +08:00
if ( ( OP1_TYPE & ( IS_VAR | IS_CV ) ) & & Z_TYPE_P ( value ) = = IS_REFERENCE ) {
value = Z_REFVAL_P ( value ) ;
2016-12-19 20:36:37 +08:00
if ( EXPECTED ( Z_TYPE_P ( value ) = = IS_STRING ) ) {
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , Z_STRLEN_P ( value ) ) ;
FREE_OP1 ( ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
}
SAVE_OPLINE ( ) ;
if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( value ) = = IS_UNDEF ) ) {
value = GET_OP1_UNDEF_CV ( value , BP_VAR_R ) ;
2014-07-11 22:52:27 +08:00
}
2015-03-20 21:04:04 +08:00
strict = EX_USES_STRICT_TYPES ( ) ;
do {
if ( EXPECTED ( ! strict ) ) {
2015-03-21 04:18:52 +08:00
zend_string * str ;
zval tmp ;
ZVAL_COPY ( & tmp , value ) ;
if ( zend_parse_arg_str_weak ( & tmp , & str ) ) {
2015-06-30 18:59:27 +08:00
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , ZSTR_LEN ( str ) ) ;
2015-03-21 04:18:52 +08:00
zval_ptr_dtor ( & tmp ) ;
2015-03-20 21:04:04 +08:00
break ;
}
2015-03-21 04:18:52 +08:00
zval_ptr_dtor ( & tmp ) ;
2015-03-20 21:04:04 +08:00
}
zend_internal_type_error ( strict , " strlen() expects parameter 1 to be string, %s given " , zend_get_type_by_const ( Z_TYPE_P ( value ) ) ) ;
ZVAL_NULL ( EX_VAR ( opline - > result . var ) ) ;
} while ( 0 ) ;
2014-07-11 22:52:27 +08:00
}
FREE_OP1 ( ) ;
2015-07-08 23:33:58 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2014-07-11 22:52:27 +08:00
}
2017-11-23 20:58:34 +08:00
ZEND_VM_HANDLER ( 123 , ZEND_TYPE_CHECK , CONST | TMP | VAR | CV , ANY , TYPE_MASK )
2014-07-14 14:33:11 +08:00
{
USE_OPLINE
zval * value ;
2015-05-05 23:50:47 +08:00
int result = 0 ;
2014-07-14 14:33:11 +08:00
zend_free_op free_op1 ;
2017-11-23 20:58:34 +08:00
value = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
if ( ( 1 < < ( uint32_t ) Z_TYPE_P ( value ) & opline - > extended_value ) ) {
ZEND_VM_C_LABEL ( type_check_resource ) :
if ( EXPECTED ( Z_TYPE_P ( value ) ! = IS_RESOURCE )
| | EXPECTED ( NULL ! = zend_rsrc_list_get_rsrc_type ( Z_RES_P ( value ) ) ) ) {
2015-05-05 23:50:47 +08:00
result = 1 ;
}
2017-11-23 20:58:34 +08:00
} else if ( ( OP1_TYPE & ( IS_CV | IS_VAR ) ) & & Z_ISREF_P ( value ) ) {
value = Z_REFVAL_P ( value ) ;
if ( ( 1 < < ( uint32_t ) Z_TYPE_P ( value ) & opline - > extended_value ) ) {
ZEND_VM_C_GOTO ( type_check_resource ) ;
}
} else if ( OP1_TYPE = = IS_CV & & UNEXPECTED ( Z_TYPE_P ( value ) = = IS_UNDEF ) ) {
result = ( ( 1 < < IS_NULL ) & opline - > extended_value ) ! = 0 ;
SAVE_OPLINE ( ) ;
GET_OP1_UNDEF_CV ( value , BP_VAR_R ) ;
ZEND_VM_SMART_BRANCH ( result , 1 ) ;
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
}
if ( OP1_TYPE & ( IS_TMP_VAR | IS_VAR ) ) {
SAVE_OPLINE ( ) ;
FREE_OP1 ( ) ;
ZEND_VM_SMART_BRANCH ( result , 1 ) ;
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
} else {
ZEND_VM_SMART_BRANCH ( result , 0 ) ;
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
2014-07-14 14:33:11 +08:00
}
}
2018-02-06 00:41:47 +08:00
ZEND_VM_HANDLER ( 122 , ZEND_DEFINED , CONST , ANY , CACHE_SLOT )
2014-07-14 19:43:11 +08:00
{
USE_OPLINE
zend_constant * c ;
2015-04-29 09:17:59 +08:00
int result ;
2014-07-14 19:43:11 +08:00
2018-03-30 21:41:02 +08:00
c = CACHED_PTR ( opline - > extended_value ) ;
do {
if ( EXPECTED ( c ! = NULL ) ) {
if ( ! IS_SPECIAL_CACHE_VAL ( c ) ) {
result = 1 ;
break ;
} else if ( EXPECTED ( zend_hash_num_elements ( EG ( zend_constants ) ) = = DECODE_SPECIAL_CACHE_NUM ( c ) ) ) {
result = 0 ;
break ;
}
}
if ( ( c = zend_quick_get_constant ( RT_CONSTANT ( opline , opline - > op1 ) , 0 ) ) = = NULL ) {
CACHE_PTR ( opline - > extended_value , ENCODE_SPECIAL_CACHE_NUM ( zend_hash_num_elements ( EG ( zend_constants ) ) ) ) ;
result = 0 ;
} else {
CACHE_PTR ( opline - > extended_value , c ) ;
result = 1 ;
}
} while ( 0 ) ;
2015-04-29 09:17:59 +08:00
ZEND_VM_SMART_BRANCH ( result , 0 ) ;
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
2014-07-14 19:43:11 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
}
2015-10-30 03:50:45 +08:00
ZEND_VM_HANDLER ( 151 , ZEND_ASSERT_CHECK , ANY , JMP_ADDR )
2015-03-02 17:25:40 +08:00
{
USE_OPLINE
if ( EG ( assertions ) < = 0 ) {
zend_op * target = OP_JMP_ADDR ( opline , opline - > op2 ) ;
2015-12-14 19:31:00 +08:00
if ( RETURN_VALUE_USED ( opline ) ) {
ZVAL_TRUE ( EX_VAR ( opline - > result . var ) ) ;
2015-03-02 17:25:40 +08:00
}
2016-12-02 20:39:33 +08:00
ZEND_VM_SET_OPCODE ( target ) ;
ZEND_VM_CONTINUE ( ) ;
2015-03-02 17:25:40 +08:00
} else {
ZEND_VM_NEXT_OPCODE ( ) ;
}
}
2018-01-31 23:14:43 +08:00
ZEND_VM_HANDLER ( 157 , ZEND_FETCH_CLASS_NAME , UNUSED | CLASS_FETCH , ANY )
2015-03-18 20:31:29 +08:00
{
2015-05-06 00:36:06 +08:00
uint32_t fetch_type ;
2016-04-28 09:13:34 +08:00
zend_class_entry * called_scope , * scope ;
2015-03-18 20:31:29 +08:00
USE_OPLINE
2018-01-31 23:14:43 +08:00
fetch_type = opline - > op1 . num ;
2015-05-06 00:36:06 +08:00
2016-04-28 09:13:34 +08:00
scope = EX ( func ) - > op_array . scope ;
if ( UNEXPECTED ( scope = = NULL ) ) {
2016-12-19 20:36:37 +08:00
SAVE_OPLINE ( ) ;
2015-07-08 01:10:22 +08:00
zend_throw_error ( NULL , " Cannot use \" %s \" when no class scope is active " ,
2015-05-06 00:36:06 +08:00
fetch_type = = ZEND_FETCH_CLASS_SELF ? " self " :
fetch_type = = ZEND_FETCH_CLASS_PARENT ? " parent " : " static " ) ;
2016-12-07 06:43:13 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2015-05-06 00:36:06 +08:00
HANDLE_EXCEPTION ( ) ;
}
switch ( fetch_type ) {
case ZEND_FETCH_CLASS_SELF :
2016-04-28 09:13:34 +08:00
ZVAL_STR_COPY ( EX_VAR ( opline - > result . var ) , scope - > name ) ;
2015-05-06 00:36:06 +08:00
break ;
case ZEND_FETCH_CLASS_PARENT :
2016-04-28 09:13:34 +08:00
if ( UNEXPECTED ( scope - > parent = = NULL ) ) {
2016-12-19 20:36:37 +08:00
SAVE_OPLINE ( ) ;
2015-07-08 01:10:22 +08:00
zend_throw_error ( NULL ,
2015-05-06 00:36:06 +08:00
" Cannot use \" parent \" when current class scope has no parent " ) ;
2016-12-07 06:43:13 +08:00
ZVAL_UNDEF ( EX_VAR ( opline - > result . var ) ) ;
2015-05-06 00:36:06 +08:00
HANDLE_EXCEPTION ( ) ;
}
2016-04-28 09:13:34 +08:00
ZVAL_STR_COPY ( EX_VAR ( opline - > result . var ) , scope - > parent - > name ) ;
2015-05-06 00:36:06 +08:00
break ;
case ZEND_FETCH_CLASS_STATIC :
2016-04-01 21:17:49 +08:00
if ( Z_TYPE ( EX ( This ) ) = = IS_OBJECT ) {
called_scope = Z_OBJCE ( EX ( This ) ) ;
} else {
called_scope = Z_CE ( EX ( This ) ) ;
}
ZVAL_STR_COPY ( EX_VAR ( opline - > result . var ) , called_scope - > name ) ;
2015-05-06 00:36:06 +08:00
break ;
EMPTY_SWITCH_DEFAULT_CASE ( )
2015-03-18 20:31:29 +08:00
}
ZEND_VM_NEXT_OPCODE ( ) ;
2015-03-20 16:10:29 +08:00
}
2015-04-11 04:01:00 +08:00
ZEND_VM_HANDLER ( 158 , ZEND_CALL_TRAMPOLINE , ANY , ANY )
{
zend_array * args ;
zend_function * fbc = EX ( func ) ;
zval * ret = EX ( return_value ) ;
2015-05-07 21:28:23 +08:00
uint32_t call_info = EX_CALL_INFO ( ) & ( ZEND_CALL_NESTED | ZEND_CALL_TOP | ZEND_CALL_RELEASE_THIS ) ;
2015-04-11 04:01:00 +08:00
uint32_t num_args = EX_NUM_ARGS ( ) ;
zend_execute_data * call ;
2017-05-21 20:44:09 +08:00
SAVE_OPLINE ( ) ;
2015-04-11 04:01:00 +08:00
if ( num_args ) {
zval * p = ZEND_CALL_ARG ( execute_data , 1 ) ;
zval * end = p + num_args ;
2017-10-24 22:27:31 +08:00
args = zend_new_array ( num_args ) ;
2018-03-23 05:13:45 +08:00
zend_hash_real_init_packed ( args ) ;
2015-04-11 04:01:00 +08:00
ZEND_HASH_FILL_PACKED ( args ) {
do {
ZEND_HASH_FILL_ADD ( p ) ;
p + + ;
} while ( p ! = end ) ;
} ZEND_HASH_FILL_END ( ) ;
}
call = execute_data ;
execute_data = EG ( current_execute_data ) = EX ( prev_execute_data ) ;
2016-01-28 16:41:15 +08:00
ZEND_ASSERT ( zend_vm_calc_used_stack ( 2 , fbc - > common . prototype ) < = ( size_t ) ( ( ( char * ) EG ( vm_stack_end ) ) - ( char * ) call ) ) ;
call - > func = fbc - > common . prototype ;
ZEND_CALL_NUM_ARGS ( call ) = 2 ;
2015-04-11 04:01:00 +08:00
ZVAL_STR ( ZEND_CALL_ARG ( call , 1 ) , fbc - > common . function_name ) ;
2017-10-24 22:27:31 +08:00
if ( num_args ) {
ZVAL_ARR ( ZEND_CALL_ARG ( call , 2 ) , args ) ;
} else {
ZVAL_EMPTY_ARRAY ( ZEND_CALL_ARG ( call , 2 ) ) ;
}
2015-04-11 04:01:00 +08:00
zend_free_trampoline ( fbc ) ;
fbc = call - > func ;
if ( EXPECTED ( fbc - > type = = ZEND_USER_FUNCTION ) ) {
2016-04-05 05:01:00 +08:00
if ( UNEXPECTED ( ! fbc - > op_array . run_time_cache ) ) {
init_func_run_time_cache ( & fbc - > op_array ) ;
}
2017-12-06 07:53:30 +08:00
execute_data = call ;
i_init_func_execute_data ( & fbc - > op_array , ret , 0 EXECUTE_DATA_CC ) ;
2015-04-11 04:01:00 +08:00
if ( EXPECTED ( zend_execute_ex = = execute_ex ) ) {
2017-12-06 07:53:30 +08:00
LOAD_OPLINE ( ) ;
ZEND_VM_ENTER_EX ( ) ;
2015-04-11 04:01:00 +08:00
} else {
2017-12-06 07:53:30 +08:00
execute_data = EX ( prev_execute_data ) ;
LOAD_OPLINE ( ) ;
2015-04-11 04:01:00 +08:00
ZEND_ADD_CALL_FLAG ( call , ZEND_CALL_TOP ) ;
zend_execute_ex ( call ) ;
}
} else {
zval retval ;
ZEND_ASSERT ( fbc - > type = = ZEND_INTERNAL_FUNCTION ) ;
EG ( current_execute_data ) = call ;
2016-04-14 01:13:17 +08:00
if ( UNEXPECTED ( fbc - > common . fn_flags & ZEND_ACC_HAS_TYPE_HINTS )
& & UNEXPECTED ( ! zend_verify_internal_arg_types ( fbc , call ) ) ) {
zend_vm_stack_free_call_frame ( call ) ;
if ( ret ) {
ZVAL_UNDEF ( ret ) ;
2015-04-11 04:01:00 +08:00
}
2016-04-14 01:13:17 +08:00
ZEND_VM_C_GOTO ( call_trampoline_end ) ;
2015-04-11 04:01:00 +08:00
}
if ( ret = = NULL ) {
ZVAL_NULL ( & retval ) ;
ret = & retval ;
}
if ( ! zend_execute_internal ) {
/* saves one function call if zend_execute_internal is not used */
fbc - > internal_function . handler ( call , ret ) ;
} else {
zend_execute_internal ( call , ret ) ;
}
# if ZEND_DEBUG
2017-10-17 18:35:59 +08:00
if ( ! EG ( exception ) & & call - > func ) {
ZEND_ASSERT ( ! ( call - > func - > common . fn_flags & ZEND_ACC_HAS_RETURN_TYPE ) | |
zend_verify_internal_return_type ( call - > func , ret ) ) ;
ZEND_ASSERT ( ( call - > func - > common . fn_flags & ZEND_ACC_RETURN_REFERENCE )
? Z_ISREF_P ( ret ) : ! Z_ISREF_P ( ret ) ) ;
}
2015-04-11 04:01:00 +08:00
# endif
EG ( current_execute_data ) = call - > prev_execute_data ;
zend_vm_stack_free_args ( call ) ;
if ( ret = = & retval ) {
zval_ptr_dtor ( ret ) ;
}
}
ZEND_VM_C_LABEL ( call_trampoline_end ) :
execute_data = EG ( current_execute_data ) ;
2015-05-07 21:28:23 +08:00
if ( ! EX ( func ) | | ! ZEND_USER_CODE ( EX ( func ) - > type ) | | ( call_info & ZEND_CALL_TOP ) ) {
2015-04-11 04:01:00 +08:00
ZEND_VM_RETURN ( ) ;
}
2015-05-07 22:26:35 +08:00
if ( UNEXPECTED ( call_info & ZEND_CALL_RELEASE_THIS ) ) {
2016-01-28 16:41:15 +08:00
zend_object * object = Z_OBJ ( call - > This ) ;
2015-04-11 04:01:00 +08:00
OBJ_RELEASE ( object ) ;
}
2015-05-07 21:28:23 +08:00
zend_vm_stack_free_call_frame ( call ) ;
2015-04-11 04:01:00 +08:00
if ( UNEXPECTED ( EG ( exception ) ! = NULL ) ) {
2016-12-12 15:55:32 +08:00
zend_rethrow_exception ( execute_data ) ;
2015-04-11 04:01:00 +08:00
HANDLE_EXCEPTION_LEAVE ( ) ;
}
2018-02-04 00:40:45 +08:00
LOAD_OPLINE ( ) ;
2015-04-11 04:01:00 +08:00
ZEND_VM_INC_OPCODE ( ) ;
ZEND_VM_LEAVE ( ) ;
}
2015-04-20 05:21:57 +08:00
2015-12-29 18:16:08 +08:00
ZEND_VM_HANDLER ( 182 , ZEND_BIND_LEXICAL , TMP , CV , REF )
{
USE_OPLINE
zend_free_op free_op1 , free_op2 ;
zval * closure , * var ;
zend_string * var_name ;
closure = GET_OP1_ZVAL_PTR ( BP_VAR_R ) ;
if ( opline - > extended_value ) {
/* By-ref binding */
var = GET_OP2_ZVAL_PTR ( BP_VAR_W ) ;
2017-12-26 18:30:25 +08:00
if ( Z_ISREF_P ( var ) ) {
Z_ADDREF_P ( var ) ;
} else {
ZVAL_MAKE_REF_EX ( var , 2 ) ;
}
2015-12-29 18:16:08 +08:00
} else {
var = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
if ( UNEXPECTED ( Z_ISUNDEF_P ( var ) ) ) {
SAVE_OPLINE ( ) ;
var = GET_OP2_UNDEF_CV ( var , BP_VAR_R ) ;
if ( UNEXPECTED ( EG ( exception ) ) ) {
HANDLE_EXCEPTION ( ) ;
}
}
ZVAL_DEREF ( var ) ;
Z_TRY_ADDREF_P ( var ) ;
}
var_name = CV_DEF_OF ( EX_VAR_TO_NUM ( opline - > op2 . var ) ) ;
zend_closure_bind_var ( closure , var_name , var ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2016-01-12 17:20:35 +08:00
ZEND_VM_HANDLER ( 183 , ZEND_BIND_STATIC , CV , CONST , REF )
{
USE_OPLINE
zend_free_op free_op1 , free_op2 ;
HashTable * ht ;
zval * varname ;
zval * value ;
zval * variable_ptr ;
variable_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_W ) ;
zval_ptr_dtor ( variable_ptr ) ;
ht = EX ( func ) - > op_array . static_variables ;
ZEND_ASSERT ( ht ! = NULL ) ;
if ( GC_REFCOUNT ( ht ) > 1 ) {
if ( ! ( GC_FLAGS ( ht ) & IS_ARRAY_IMMUTABLE ) ) {
2017-10-27 06:28:58 +08:00
GC_DELREF ( ht ) ;
2016-01-12 17:20:35 +08:00
}
EX ( func ) - > op_array . static_variables = ht = zend_array_dup ( ht ) ;
}
varname = GET_OP2_ZVAL_PTR ( BP_VAR_R ) ;
2017-11-24 19:01:19 +08:00
value = zend_hash_find_ex ( ht , Z_STR_P ( varname ) , 1 ) ;
2016-01-12 17:20:35 +08:00
if ( opline - > extended_value ) {
2017-10-10 15:11:05 +08:00
if ( Z_TYPE_P ( value ) = = IS_CONSTANT_AST ) {
2016-12-19 20:36:37 +08:00
SAVE_OPLINE ( ) ;
2016-04-28 09:13:34 +08:00
if ( UNEXPECTED ( zval_update_constant_ex ( value , EX ( func ) - > op_array . scope ) ! = SUCCESS ) ) {
2016-01-12 17:20:35 +08:00
ZVAL_NULL ( variable_ptr ) ;
HANDLE_EXCEPTION ( ) ;
}
}
if ( UNEXPECTED ( ! Z_ISREF_P ( value ) ) ) {
zend_reference * ref = ( zend_reference * ) emalloc ( sizeof ( zend_reference ) ) ;
2017-10-27 06:28:58 +08:00
GC_SET_REFCOUNT ( ref , 2 ) ;
2016-01-12 17:20:35 +08:00
GC_TYPE_INFO ( ref ) = IS_REFERENCE ;
ZVAL_COPY_VALUE ( & ref - > val , value ) ;
Z_REF_P ( value ) = ref ;
Z_TYPE_INFO_P ( value ) = IS_REFERENCE_EX ;
ZVAL_REF ( variable_ptr , ref ) ;
} else {
Z_ADDREF_P ( value ) ;
ZVAL_REF ( variable_ptr , Z_REF_P ( value ) ) ;
}
} else {
ZVAL_COPY ( variable_ptr , value ) ;
}
2016-12-19 20:36:37 +08:00
ZEND_VM_NEXT_OPCODE ( ) ;
2016-01-12 17:20:35 +08:00
}
2016-06-16 07:30:23 +08:00
ZEND_VM_HANDLER ( 184 , ZEND_FETCH_THIS , UNUSED , UNUSED )
{
USE_OPLINE
if ( EXPECTED ( Z_TYPE ( EX ( This ) ) = = IS_OBJECT ) ) {
zval * result = EX_VAR ( opline - > result . var ) ;
ZVAL_OBJ ( result , Z_OBJ ( EX ( This ) ) ) ;
Z_ADDREF_P ( result ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
} else {
2017-06-15 21:23:05 +08:00
ZEND_VM_DISPATCH_TO_HELPER ( zend_this_not_in_object_context_helper ) ;
2016-06-16 07:30:23 +08:00
}
}
ZEND_VM_HANDLER ( 186 , ZEND_ISSET_ISEMPTY_THIS , UNUSED , UNUSED )
{
USE_OPLINE
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) ,
( opline - > extended_value & ZEND_ISSET ) ?
( Z_TYPE ( EX ( This ) ) = = IS_OBJECT ) :
( Z_TYPE ( EX ( This ) ) ! = IS_OBJECT ) ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2016-07-01 02:40:34 +08:00
ZEND_VM_HANDLER ( 49 , ZEND_CHECK_VAR , CV , UNUSED )
{
USE_OPLINE
zval * op1 = EX_VAR ( opline - > op1 . var ) ;
if ( UNEXPECTED ( Z_TYPE_INFO_P ( op1 ) = = IS_UNDEF ) ) {
SAVE_OPLINE ( ) ;
GET_OP1_UNDEF_CV ( op1 , BP_VAR_R ) ;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
2016-07-13 20:08:28 +08:00
ZEND_VM_HANDLER ( 51 , ZEND_MAKE_REF , VAR | CV , UNUSED )
2016-07-07 05:59:44 +08:00
{
USE_OPLINE
zval * op1 = EX_VAR ( opline - > op1 . var ) ;
2016-07-13 20:08:28 +08:00
if ( OP1_TYPE = = IS_CV ) {
if ( UNEXPECTED ( Z_TYPE_P ( op1 ) = = IS_UNDEF ) ) {
2016-07-14 01:35:53 +08:00
ZVAL_NEW_EMPTY_REF ( op1 ) ;
Z_SET_REFCOUNT_P ( op1 , 2 ) ;
ZVAL_NULL ( Z_REFVAL_P ( op1 ) ) ;
ZVAL_REF ( EX_VAR ( opline - > result . var ) , Z_REF_P ( op1 ) ) ;
2016-07-14 01:04:47 +08:00
} else {
2017-12-26 18:30:25 +08:00
if ( Z_ISREF_P ( op1 ) ) {
Z_ADDREF_P ( op1 ) ;
} else {
ZVAL_MAKE_REF_EX ( op1 , 2 ) ;
}
ZVAL_REF ( EX_VAR ( opline - > result . var ) , Z_REF_P ( op1 ) ) ;
2016-07-13 20:08:28 +08:00
}
} else if ( EXPECTED ( Z_TYPE_P ( op1 ) = = IS_INDIRECT ) ) {
2016-07-07 05:59:44 +08:00
op1 = Z_INDIRECT_P ( op1 ) ;
if ( EXPECTED ( ! Z_ISREF_P ( op1 ) ) ) {
2017-12-26 18:30:25 +08:00
ZVAL_MAKE_REF_EX ( op1 , 2 ) ;
} else {
GC_ADDREF ( Z_REF_P ( op1 ) ) ;
2016-07-07 05:59:44 +08:00
}
ZVAL_REF ( EX_VAR ( opline - > result . var ) , Z_REF_P ( op1 ) ) ;
} else {
ZVAL_COPY_VALUE ( EX_VAR ( opline - > result . var ) , op1 ) ;
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-12-29 17:02:50 +08:00
ZEND_VM_HANDLER ( 187 , ZEND_SWITCH_LONG , CONST | TMPVARCV , CONST , JMP_ADDR )
2017-03-18 06:45:05 +08:00
{
USE_OPLINE
zend_free_op free_op1 , free_op2 ;
zval * op , * jump_zv ;
HashTable * jumptable ;
op = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
jumptable = Z_ARRVAL_P ( GET_OP2_ZVAL_PTR ( BP_VAR_R ) ) ;
if ( Z_TYPE_P ( op ) ! = IS_LONG ) {
ZVAL_DEREF ( op ) ;
if ( Z_TYPE_P ( op ) ! = IS_LONG ) {
/* Wrong type, fall back to ZEND_CASE chain */
ZEND_VM_NEXT_OPCODE ( ) ;
}
}
jump_zv = zend_hash_index_find ( jumptable , Z_LVAL_P ( op ) ) ;
if ( jump_zv ! = NULL ) {
ZEND_VM_SET_RELATIVE_OPCODE ( opline , Z_LVAL_P ( jump_zv ) ) ;
ZEND_VM_CONTINUE ( ) ;
} else {
/* default */
ZEND_VM_SET_RELATIVE_OPCODE ( opline , opline - > extended_value ) ;
ZEND_VM_CONTINUE ( ) ;
}
}
2017-12-29 17:02:50 +08:00
ZEND_VM_HANDLER ( 188 , ZEND_SWITCH_STRING , CONST | TMPVARCV , CONST , JMP_ADDR )
2017-03-18 06:45:05 +08:00
{
USE_OPLINE
zend_free_op free_op1 , free_op2 ;
zval * op , * jump_zv ;
HashTable * jumptable ;
op = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
jumptable = Z_ARRVAL_P ( GET_OP2_ZVAL_PTR ( BP_VAR_R ) ) ;
if ( Z_TYPE_P ( op ) ! = IS_STRING ) {
2017-11-24 19:01:19 +08:00
if ( OP1_TYPE = = IS_CONST ) {
2017-03-18 06:45:05 +08:00
/* Wrong type, fall back to ZEND_CASE chain */
ZEND_VM_NEXT_OPCODE ( ) ;
2017-11-24 19:01:19 +08:00
} else {
ZVAL_DEREF ( op ) ;
if ( Z_TYPE_P ( op ) ! = IS_STRING ) {
/* Wrong type, fall back to ZEND_CASE chain */
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-03-18 06:45:05 +08:00
}
}
2017-11-24 19:01:19 +08:00
jump_zv = zend_hash_find_ex ( jumptable , Z_STR_P ( op ) , OP1_TYPE = = IS_CONST ) ;
2017-03-18 06:45:05 +08:00
if ( jump_zv ! = NULL ) {
ZEND_VM_SET_RELATIVE_OPCODE ( opline , Z_LVAL_P ( jump_zv ) ) ;
ZEND_VM_CONTINUE ( ) ;
} else {
/* default */
ZEND_VM_SET_RELATIVE_OPCODE ( opline , opline - > extended_value ) ;
ZEND_VM_CONTINUE ( ) ;
}
}
2017-05-25 04:00:48 +08:00
ZEND_VM_HANDLER ( 189 , ZEND_IN_ARRAY , CONST | TMP | VAR | CV , CONST , NUM )
{
USE_OPLINE
zend_free_op free_op1 ;
2017-05-25 15:26:42 +08:00
zval * op1 ;
2017-10-04 21:53:01 +08:00
HashTable * ht = Z_ARRVAL_P ( RT_CONSTANT ( opline , opline - > op2 ) ) ;
2017-05-25 04:00:48 +08:00
int result ;
2017-05-25 15:26:42 +08:00
SAVE_OPLINE ( ) ;
op1 = GET_OP1_ZVAL_PTR_DEREF ( BP_VAR_R ) ;
2017-05-25 04:00:48 +08:00
if ( EXPECTED ( Z_TYPE_P ( op1 ) = = IS_STRING ) ) {
result = zend_hash_exists ( ht , Z_STR_P ( op1 ) ) ;
} else if ( opline - > extended_value ) {
if ( EXPECTED ( Z_TYPE_P ( op1 ) = = IS_LONG ) ) {
result = zend_hash_index_exists ( ht , Z_LVAL_P ( op1 ) ) ;
} else {
result = 0 ;
}
} else if ( Z_TYPE_P ( op1 ) < = IS_FALSE ) {
result = zend_hash_exists ( ht , ZSTR_EMPTY_ALLOC ( ) ) ;
} else {
zend_string * key ;
2017-07-19 07:04:36 +08:00
zval key_tmp , result_tmp ;
2017-05-25 04:00:48 +08:00
result = 0 ;
ZEND_HASH_FOREACH_STR_KEY ( ht , key ) {
2017-07-19 07:04:36 +08:00
ZVAL_STR ( & key_tmp , key ) ;
compare_function ( & result_tmp , op1 , & key_tmp ) ;
if ( Z_LVAL ( result_tmp ) = = 0 ) {
2017-05-25 04:00:48 +08:00
result = 1 ;
break ;
}
} ZEND_HASH_FOREACH_END ( ) ;
}
FREE_OP1 ( ) ;
2017-05-25 15:26:42 +08:00
ZEND_VM_SMART_BRANCH ( result , 1 ) ;
2017-05-25 04:00:48 +08:00
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
2017-05-25 15:26:42 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2017-05-25 04:00:48 +08:00
}
2017-05-25 17:52:34 +08:00
ZEND_VM_HANDLER ( 190 , ZEND_COUNT , CONST | TMP | VAR | CV , UNUSED )
{
USE_OPLINE
zend_free_op free_op1 ;
zval * op1 ;
zend_long count ;
SAVE_OPLINE ( ) ;
op1 = GET_OP1_ZVAL_PTR_DEREF ( BP_VAR_R ) ;
do {
if ( Z_TYPE_P ( op1 ) = = IS_ARRAY ) {
count = zend_array_count ( Z_ARRVAL_P ( op1 ) ) ;
break ;
} else if ( Z_TYPE_P ( op1 ) = = IS_OBJECT ) {
/* first, we check if the handler is defined */
if ( Z_OBJ_HT_P ( op1 ) - > count_elements ) {
if ( SUCCESS = = Z_OBJ_HT_P ( op1 ) - > count_elements ( op1 , & count ) ) {
break ;
}
}
/* if not and the object implements Countable we call its count() method */
if ( instanceof_function ( Z_OBJCE_P ( op1 ) , zend_ce_countable ) ) {
zval retval ;
zend_call_method_with_0_params ( op1 , NULL , NULL , " count " , & retval ) ;
count = zval_get_long ( & retval ) ;
zval_ptr_dtor ( & retval ) ;
break ;
}
/* If There's no handler and it doesn't implement Countable then add a warning */
count = 1 ;
} else if ( Z_TYPE_P ( op1 ) = = IS_NULL ) {
count = 0 ;
} else {
count = 1 ;
}
zend_error ( E_WARNING , " count(): Parameter must be an array or an object that implements Countable " ) ;
} while ( 0 ) ;
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , count ) ;
FREE_OP1 ( ) ;
2017-05-25 23:41:28 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
}
ZEND_VM_HANDLER ( 191 , ZEND_GET_CLASS , UNUSED | CONST | TMP | VAR | CV , UNUSED )
{
USE_OPLINE
if ( OP1_TYPE = = IS_UNUSED ) {
if ( UNEXPECTED ( ! EX ( func ) - > common . scope ) ) {
SAVE_OPLINE ( ) ;
zend_error ( E_WARNING , " get_class() called without object from outside a class " ) ;
ZVAL_FALSE ( EX_VAR ( opline - > result . var ) ) ;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
} else {
ZVAL_STR_COPY ( EX_VAR ( opline - > result . var ) , EX ( func ) - > common . scope - > name ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
} else {
zend_free_op free_op1 ;
zval * op1 ;
SAVE_OPLINE ( ) ;
op1 = GET_OP1_ZVAL_PTR_DEREF ( BP_VAR_R ) ;
if ( Z_TYPE_P ( op1 ) = = IS_OBJECT ) {
ZVAL_STR_COPY ( EX_VAR ( opline - > result . var ) , Z_OBJCE_P ( op1 ) - > name ) ;
} else {
zend_error ( E_WARNING , " get_class() expects parameter 1 to be object, %s given " , zend_get_type_by_const ( Z_TYPE_P ( op1 ) ) ) ;
ZVAL_FALSE ( EX_VAR ( opline - > result . var ) ) ;
}
FREE_OP1 ( ) ;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
}
}
ZEND_VM_HANDLER ( 192 , ZEND_GET_CALLED_CLASS , UNUSED , UNUSED )
{
USE_OPLINE
if ( Z_TYPE ( EX ( This ) ) = = IS_OBJECT ) {
ZVAL_STR_COPY ( EX_VAR ( opline - > result . var ) , Z_OBJCE ( EX ( This ) ) - > name ) ;
} else if ( Z_CE ( EX ( This ) ) ) {
ZVAL_STR_COPY ( EX_VAR ( opline - > result . var ) , Z_CE ( EX ( This ) ) - > name ) ;
} else {
ZVAL_FALSE ( EX_VAR ( opline - > result . var ) ) ;
if ( UNEXPECTED ( ! EX ( func ) - > common . scope ) ) {
SAVE_OPLINE ( ) ;
zend_error ( E_WARNING , " get_called_class() called from outside a class " ) ;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
}
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
ZEND_VM_HANDLER ( 193 , ZEND_GET_TYPE , CONST | TMP | VAR | CV , UNUSED )
{
USE_OPLINE
zend_free_op free_op1 ;
zval * op1 ;
zend_string * type ;
SAVE_OPLINE ( ) ;
op1 = GET_OP1_ZVAL_PTR_DEREF ( BP_VAR_R ) ;
type = zend_zval_get_type ( op1 ) ;
if ( EXPECTED ( type ) ) {
ZVAL_INTERNED_STR ( EX_VAR ( opline - > result . var ) , type ) ;
} else {
ZVAL_STRING ( EX_VAR ( opline - > result . var ) , " unknown type " ) ;
}
FREE_OP1 ( ) ;
2017-05-25 17:52:34 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
}
2017-05-30 18:23:17 +08:00
ZEND_VM_HANDLER ( 194 , ZEND_FUNC_NUM_ARGS , UNUSED , UNUSED )
{
2017-05-30 18:31:58 +08:00
USE_OPLINE
2017-05-30 18:23:17 +08:00
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , EX_NUM_ARGS ( ) ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
ZEND_VM_HANDLER ( 195 , ZEND_FUNC_GET_ARGS , UNUSED | CONST , UNUSED )
{
USE_OPLINE
zend_array * ht ;
2017-06-25 21:37:29 +08:00
uint32_t arg_count , result_size , skip ;
2017-05-30 18:23:17 +08:00
arg_count = EX_NUM_ARGS ( ) ;
if ( OP1_TYPE = = IS_CONST ) {
2017-10-04 21:53:01 +08:00
skip = Z_LVAL_P ( RT_CONSTANT ( opline , opline - > op1 ) ) ;
2017-06-25 21:37:29 +08:00
if ( arg_count < skip ) {
result_size = 0 ;
2017-05-30 18:23:17 +08:00
} else {
2017-06-25 21:37:29 +08:00
result_size = arg_count - skip ;
2017-05-30 18:23:17 +08:00
}
} else {
2017-06-25 21:37:29 +08:00
skip = 0 ;
result_size = arg_count ;
2017-05-30 18:23:17 +08:00
}
2017-06-25 21:37:29 +08:00
if ( result_size ) {
uint32_t first_extra_arg = EX ( func ) - > op_array . num_args ;
2017-10-24 22:27:31 +08:00
ht = zend_new_array ( result_size ) ;
ZVAL_ARR ( EX_VAR ( opline - > result . var ) , ht ) ;
2018-03-23 05:13:45 +08:00
zend_hash_real_init_packed ( ht ) ;
2017-05-30 18:23:17 +08:00
ZEND_HASH_FILL_PACKED ( ht ) {
2017-06-25 21:37:29 +08:00
zval * p , * q ;
uint32_t i = skip ;
2017-05-30 18:23:17 +08:00
p = EX_VAR_NUM ( i ) ;
if ( arg_count > first_extra_arg ) {
while ( i < first_extra_arg ) {
q = p ;
if ( EXPECTED ( Z_TYPE_INFO_P ( q ) ! = IS_UNDEF ) ) {
ZVAL_DEREF ( q ) ;
if ( Z_OPT_REFCOUNTED_P ( q ) ) {
Z_ADDREF_P ( q ) ;
}
2017-06-25 21:31:06 +08:00
} else {
q = & EG ( uninitialized_zval ) ;
2017-05-30 18:23:17 +08:00
}
ZEND_HASH_FILL_ADD ( q ) ;
p + + ;
i + + ;
}
2017-06-25 21:37:29 +08:00
if ( skip < first_extra_arg ) {
skip = 0 ;
} else {
skip - = first_extra_arg ;
}
p = EX_VAR_NUM ( EX ( func ) - > op_array . last_var + EX ( func ) - > op_array . T + skip ) ;
2017-05-30 18:23:17 +08:00
}
while ( i < arg_count ) {
q = p ;
if ( EXPECTED ( Z_TYPE_INFO_P ( q ) ! = IS_UNDEF ) ) {
ZVAL_DEREF ( q ) ;
if ( Z_OPT_REFCOUNTED_P ( q ) ) {
Z_ADDREF_P ( q ) ;
}
2017-06-25 21:31:06 +08:00
} else {
q = & EG ( uninitialized_zval ) ;
2017-05-30 18:23:17 +08:00
}
ZEND_HASH_FILL_ADD ( q ) ;
p + + ;
i + + ;
}
} ZEND_HASH_FILL_END ( ) ;
2017-06-25 21:37:29 +08:00
ht - > nNumOfElements = result_size ;
2017-10-24 22:27:31 +08:00
} else {
ZVAL_EMPTY_ARRAY ( EX_VAR ( opline - > result . var ) ) ;
2017-05-30 18:23:17 +08:00
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
2018-01-16 18:50:36 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_JMP , ( OP_JMP_ADDR ( op , op - > op1 ) > op ) , ZEND_JMP_FORWARD , JMP_ADDR , ANY )
{
USE_OPLINE
OPLINE = OP_JMP_ADDR ( opline , opline - > op1 ) ;
ZEND_VM_CONTINUE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_ADD , ( res_info = = MAY_BE_LONG & & op1_info = = MAY_BE_LONG & & op2_info = = MAY_BE_LONG ) , ZEND_ADD_LONG_NO_OVERFLOW , CONST | TMPVARCV , CONST | TMPVARCV , SPEC ( NO_CONST_CONST , COMMUTATIVE ) )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * op1 , * op2 , * result ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
result = EX_VAR ( opline - > result . var ) ;
ZVAL_LONG ( result , Z_LVAL_P ( op1 ) + Z_LVAL_P ( op2 ) ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_ADD , ( op1_info = = MAY_BE_LONG & & op2_info = = MAY_BE_LONG ) , ZEND_ADD_LONG , CONST | TMPVARCV , CONST | TMPVARCV , SPEC ( NO_CONST_CONST , COMMUTATIVE ) )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * op1 , * op2 , * result ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
result = EX_VAR ( opline - > result . var ) ;
fast_long_add_function ( result , op1 , op2 ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_ADD , ( op1_info = = MAY_BE_DOUBLE & & op2_info = = MAY_BE_DOUBLE ) , ZEND_ADD_DOUBLE , CONST | TMPVARCV , CONST | TMPVARCV , SPEC ( NO_CONST_CONST , COMMUTATIVE ) )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * op1 , * op2 , * result ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
result = EX_VAR ( opline - > result . var ) ;
ZVAL_DOUBLE ( result , Z_DVAL_P ( op1 ) + Z_DVAL_P ( op2 ) ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_SUB , ( res_info = = MAY_BE_LONG & & op1_info = = MAY_BE_LONG & & op2_info = = MAY_BE_LONG ) , ZEND_SUB_LONG_NO_OVERFLOW , CONST | TMPVARCV , CONST | TMPVARCV , SPEC ( NO_CONST_CONST ) )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * op1 , * op2 , * result ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
result = EX_VAR ( opline - > result . var ) ;
ZVAL_LONG ( result , Z_LVAL_P ( op1 ) - Z_LVAL_P ( op2 ) ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_SUB , ( op1_info = = MAY_BE_LONG & & op2_info = = MAY_BE_LONG ) , ZEND_SUB_LONG , CONST | TMPVARCV , CONST | TMPVARCV , SPEC ( NO_CONST_CONST ) )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * op1 , * op2 , * result ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
result = EX_VAR ( opline - > result . var ) ;
fast_long_sub_function ( result , op1 , op2 ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_SUB , ( op1_info = = MAY_BE_DOUBLE & & op2_info = = MAY_BE_DOUBLE ) , ZEND_SUB_DOUBLE , CONST | TMPVARCV , CONST | TMPVARCV , SPEC ( NO_CONST_CONST ) )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * op1 , * op2 , * result ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
result = EX_VAR ( opline - > result . var ) ;
ZVAL_DOUBLE ( result , Z_DVAL_P ( op1 ) - Z_DVAL_P ( op2 ) ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_MUL , ( res_info = = MAY_BE_LONG & & op1_info = = MAY_BE_LONG & & op2_info = = MAY_BE_LONG ) , ZEND_MUL_LONG_NO_OVERFLOW , CONST | TMPVARCV , CONST | TMPVARCV , SPEC ( NO_CONST_CONST , COMMUTATIVE ) )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * op1 , * op2 , * result ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
result = EX_VAR ( opline - > result . var ) ;
ZVAL_LONG ( result , Z_LVAL_P ( op1 ) * Z_LVAL_P ( op2 ) ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_MUL , ( op1_info = = MAY_BE_LONG & & op2_info = = MAY_BE_LONG ) , ZEND_MUL_LONG , CONST | TMPVARCV , CONST | TMPVARCV , SPEC ( NO_CONST_CONST , COMMUTATIVE ) )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * op1 , * op2 , * result ;
zend_long overflow ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
result = EX_VAR ( opline - > result . var ) ;
ZEND_SIGNED_MULTIPLY_LONG ( Z_LVAL_P ( op1 ) , Z_LVAL_P ( op2 ) , Z_LVAL_P ( result ) , Z_DVAL_P ( result ) , overflow ) ;
Z_TYPE_INFO_P ( result ) = overflow ? IS_DOUBLE : IS_LONG ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_MUL , ( op1_info = = MAY_BE_DOUBLE & & op2_info = = MAY_BE_DOUBLE ) , ZEND_MUL_DOUBLE , CONST | TMPVARCV , CONST | TMPVARCV , SPEC ( NO_CONST_CONST , COMMUTATIVE ) )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * op1 , * op2 , * result ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
result = EX_VAR ( opline - > result . var ) ;
ZVAL_DOUBLE ( result , Z_DVAL_P ( op1 ) * Z_DVAL_P ( op2 ) ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_IS_EQUAL , ( op1_info = = MAY_BE_LONG & & op2_info = = MAY_BE_LONG ) , ZEND_IS_EQUAL_LONG , CONST | TMPVARCV , CONST | TMPVARCV , SPEC ( SMART_BRANCH , NO_CONST_CONST , COMMUTATIVE ) )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * op1 , * op2 ;
int result ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
result = ( Z_LVAL_P ( op1 ) = = Z_LVAL_P ( op2 ) ) ;
ZEND_VM_SMART_BRANCH ( result , 0 ) ;
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_IS_EQUAL , ( op1_info = = MAY_BE_DOUBLE & & op2_info = = MAY_BE_DOUBLE ) , ZEND_IS_EQUAL_DOUBLE , CONST | TMPVARCV , CONST | TMPVARCV , SPEC ( SMART_BRANCH , NO_CONST_CONST , COMMUTATIVE ) )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * op1 , * op2 ;
int result ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
result = ( Z_DVAL_P ( op1 ) = = Z_DVAL_P ( op2 ) ) ;
ZEND_VM_SMART_BRANCH ( result , 0 ) ;
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_IS_NOT_EQUAL , ( op1_info = = MAY_BE_LONG & & op2_info = = MAY_BE_LONG ) , ZEND_IS_NOT_EQUAL_LONG , CONST | TMPVARCV , CONST | TMPVARCV , SPEC ( SMART_BRANCH , NO_CONST_CONST , COMMUTATIVE ) )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * op1 , * op2 ;
int result ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
result = ( Z_LVAL_P ( op1 ) ! = Z_LVAL_P ( op2 ) ) ;
ZEND_VM_SMART_BRANCH ( result , 0 ) ;
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_IS_NOT_EQUAL , ( op1_info = = MAY_BE_DOUBLE & & op2_info = = MAY_BE_DOUBLE ) , ZEND_IS_NOT_EQUAL_DOUBLE , CONST | TMPVARCV , CONST | TMPVARCV , SPEC ( SMART_BRANCH , NO_CONST_CONST , COMMUTATIVE ) )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * op1 , * op2 ;
int result ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
result = ( Z_DVAL_P ( op1 ) ! = Z_DVAL_P ( op2 ) ) ;
ZEND_VM_SMART_BRANCH ( result , 0 ) ;
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_IS_SMALLER , ( op1_info = = MAY_BE_LONG & & op2_info = = MAY_BE_LONG ) , ZEND_IS_SMALLER_LONG , CONST | TMPVARCV , CONST | TMPVARCV , SPEC ( SMART_BRANCH , NO_CONST_CONST ) )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * op1 , * op2 ;
int result ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
result = ( Z_LVAL_P ( op1 ) < Z_LVAL_P ( op2 ) ) ;
ZEND_VM_SMART_BRANCH ( result , 0 ) ;
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_IS_SMALLER , ( op1_info = = MAY_BE_DOUBLE & & op2_info = = MAY_BE_DOUBLE ) , ZEND_IS_SMALLER_DOUBLE , CONST | TMPVARCV , CONST | TMPVARCV , SPEC ( SMART_BRANCH , NO_CONST_CONST ) )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * op1 , * op2 ;
int result ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
result = ( Z_DVAL_P ( op1 ) < Z_DVAL_P ( op2 ) ) ;
ZEND_VM_SMART_BRANCH ( result , 0 ) ;
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_IS_SMALLER_OR_EQUAL , ( op1_info = = MAY_BE_LONG & & op2_info = = MAY_BE_LONG ) , ZEND_IS_SMALLER_OR_EQUAL_LONG , CONST | TMPVARCV , CONST | TMPVARCV , SPEC ( SMART_BRANCH , NO_CONST_CONST ) )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * op1 , * op2 ;
int result ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
result = ( Z_LVAL_P ( op1 ) < = Z_LVAL_P ( op2 ) ) ;
ZEND_VM_SMART_BRANCH ( result , 0 ) ;
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_IS_SMALLER_OR_EQUAL , ( op1_info = = MAY_BE_DOUBLE & & op2_info = = MAY_BE_DOUBLE ) , ZEND_IS_SMALLER_OR_EQUAL_DOUBLE , CONST | TMPVARCV , CONST | TMPVARCV , SPEC ( SMART_BRANCH , NO_CONST_CONST ) )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * op1 , * op2 ;
int result ;
op1 = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
op2 = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
result = ( Z_DVAL_P ( op1 ) < = Z_DVAL_P ( op2 ) ) ;
ZEND_VM_SMART_BRANCH ( result , 0 ) ;
ZVAL_BOOL ( EX_VAR ( opline - > result . var ) , result ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_PRE_INC , ( res_info = = MAY_BE_LONG & & op1_info = = MAY_BE_LONG ) , ZEND_PRE_INC_LONG_NO_OVERFLOW , TMPVARCV , ANY , SPEC ( RETVAL ) )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * var_ptr ;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_RW ) ;
Z_LVAL_P ( var_ptr ) + + ;
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , Z_LVAL_P ( var_ptr ) ) ;
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_PRE_INC , ( op1_info = = MAY_BE_LONG ) , ZEND_PRE_INC_LONG , TMPVARCV , ANY , SPEC ( RETVAL ) )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * var_ptr ;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_RW ) ;
fast_long_increment_function ( var_ptr ) ;
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
ZVAL_COPY_VALUE ( EX_VAR ( opline - > result . var ) , var_ptr ) ;
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_PRE_INC , ( op1_info = = ( MAY_BE_LONG | MAY_BE_DOUBLE ) ) , ZEND_PRE_INC_LONG_OR_DOUBLE , TMPVARCV , ANY , SPEC ( RETVAL ) )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * var_ptr ;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_RW ) ;
if ( EXPECTED ( Z_TYPE_P ( var_ptr ) = = IS_LONG ) ) {
fast_long_increment_function ( var_ptr ) ;
} else {
Z_DVAL_P ( var_ptr ) + + ;
}
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
ZVAL_COPY_VALUE ( EX_VAR ( opline - > result . var ) , var_ptr ) ;
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_PRE_DEC , ( res_info = = MAY_BE_LONG & & op1_info = = MAY_BE_LONG ) , ZEND_PRE_DEC_LONG_NO_OVERFLOW , TMPVARCV , ANY , SPEC ( RETVAL ) )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * var_ptr ;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_RW ) ;
Z_LVAL_P ( var_ptr ) - - ;
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , Z_LVAL_P ( var_ptr ) ) ;
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_PRE_DEC , ( op1_info = = MAY_BE_LONG ) , ZEND_PRE_DEC_LONG , TMPVARCV , ANY , SPEC ( RETVAL ) )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * var_ptr ;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_RW ) ;
fast_long_decrement_function ( var_ptr ) ;
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
ZVAL_COPY_VALUE ( EX_VAR ( opline - > result . var ) , var_ptr ) ;
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_PRE_DEC , ( op1_info = = ( MAY_BE_LONG | MAY_BE_DOUBLE ) ) , ZEND_PRE_DEC_LONG_OR_DOUBLE , TMPVARCV , ANY , SPEC ( RETVAL ) )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * var_ptr ;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_RW ) ;
if ( EXPECTED ( Z_TYPE_P ( var_ptr ) = = IS_LONG ) ) {
fast_long_decrement_function ( var_ptr ) ;
} else {
Z_DVAL_P ( var_ptr ) - - ;
}
if ( UNEXPECTED ( RETURN_VALUE_USED ( opline ) ) ) {
ZVAL_COPY_VALUE ( EX_VAR ( opline - > result . var ) , var_ptr ) ;
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_POST_INC , ( res_info = = MAY_BE_LONG & & op1_info = = MAY_BE_LONG ) , ZEND_POST_INC_LONG_NO_OVERFLOW , TMPVARCV , ANY )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * var_ptr ;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_RW ) ;
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , Z_LVAL_P ( var_ptr ) ) ;
Z_LVAL_P ( var_ptr ) + + ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_POST_INC , ( op1_info = = MAY_BE_LONG ) , ZEND_POST_INC_LONG , TMPVARCV , ANY )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * var_ptr ;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_RW ) ;
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , Z_LVAL_P ( var_ptr ) ) ;
fast_long_increment_function ( var_ptr ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_POST_INC , ( op1_info = = ( MAY_BE_LONG | MAY_BE_DOUBLE ) ) , ZEND_POST_INC_LONG_OR_DOUBLE , TMPVARCV , ANY )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * var_ptr ;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_RW ) ;
if ( EXPECTED ( Z_TYPE_P ( var_ptr ) = = IS_LONG ) ) {
2017-12-26 21:49:34 +08:00
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , Z_LVAL_P ( var_ptr ) ) ;
2016-03-18 03:00:27 +08:00
fast_long_increment_function ( var_ptr ) ;
} else {
2017-12-26 21:49:34 +08:00
ZVAL_DOUBLE ( EX_VAR ( opline - > result . var ) , Z_DVAL_P ( var_ptr ) ) ;
2016-03-18 03:00:27 +08:00
Z_DVAL_P ( var_ptr ) + + ;
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_POST_DEC , ( res_info = = MAY_BE_LONG & & op1_info = = MAY_BE_LONG ) , ZEND_POST_DEC_LONG_NO_OVERFLOW , TMPVARCV , ANY )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * var_ptr ;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_RW ) ;
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , Z_LVAL_P ( var_ptr ) ) ;
Z_LVAL_P ( var_ptr ) - - ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_POST_DEC , ( op1_info = = MAY_BE_LONG ) , ZEND_POST_DEC_LONG , TMPVARCV , ANY )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * var_ptr ;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_RW ) ;
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , Z_LVAL_P ( var_ptr ) ) ;
fast_long_decrement_function ( var_ptr ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_POST_DEC , ( op1_info = = ( MAY_BE_LONG | MAY_BE_DOUBLE ) ) , ZEND_POST_DEC_LONG_OR_DOUBLE , TMPVARCV , ANY )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zval * var_ptr ;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF ( BP_VAR_RW ) ;
if ( EXPECTED ( Z_TYPE_P ( var_ptr ) = = IS_LONG ) ) {
2017-12-26 21:49:34 +08:00
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , Z_LVAL_P ( var_ptr ) ) ;
2016-03-18 03:00:27 +08:00
fast_long_decrement_function ( var_ptr ) ;
} else {
2017-12-26 21:49:34 +08:00
ZVAL_DOUBLE ( EX_VAR ( opline - > result . var ) , Z_DVAL_P ( var_ptr ) ) ;
2016-03-18 03:00:27 +08:00
Z_DVAL_P ( var_ptr ) - - ;
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_QM_ASSIGN , ( op1_info = = MAY_BE_DOUBLE ) , ZEND_QM_ASSIGN_DOUBLE , CONST | TMPVARCV , ANY )
2016-03-21 18:03:30 +08:00
{
USE_OPLINE
zend_free_op free_op1 ;
zval * value ;
value = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
ZVAL_DOUBLE ( EX_VAR ( opline - > result . var ) , Z_DVAL_P ( value ) ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_QM_ASSIGN , ( ! ( op1_info & ( ( MAY_BE_ANY | MAY_BE_UNDEF ) - ( MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_LONG | MAY_BE_DOUBLE ) ) ) ) , ZEND_QM_ASSIGN_NOREF , CONST | TMPVARCV , ANY )
2016-03-18 03:00:27 +08:00
{
USE_OPLINE
zend_free_op free_op1 ;
zval * value ;
value = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
ZVAL_COPY_VALUE ( EX_VAR ( opline - > result . var ) , value ) ;
ZEND_VM_NEXT_OPCODE ( ) ;
}
2018-03-29 16:13:17 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_FETCH_DIM_R , ( ! ( op2_info & ( MAY_BE_UNDEF | MAY_BE_NULL | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_OBJECT | MAY_BE_RESOURCE | MAY_BE_REF ) ) ) , ZEND_FETCH_DIM_R_INDEX , CONST | TMPVAR | CV , CONST | TMPVARCV )
2016-05-18 20:06:49 +08:00
{
USE_OPLINE
zend_free_op free_op1 , free_op2 ;
zval * container , * dim , * value ;
zend_long offset ;
2018-02-21 21:06:29 +08:00
HashTable * ht ;
2016-05-18 20:06:49 +08:00
container = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
dim = GET_OP2_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
if ( EXPECTED ( Z_TYPE_P ( container ) = = IS_ARRAY ) ) {
ZEND_VM_C_LABEL ( fetch_dim_r_index_array ) :
if ( EXPECTED ( Z_TYPE_P ( dim ) = = IS_LONG ) ) {
offset = Z_LVAL_P ( dim ) ;
} else {
offset = zval_get_long ( dim ) ;
}
2018-02-21 21:06:29 +08:00
ht = Z_ARRVAL_P ( container ) ;
ZEND_HASH_INDEX_FIND ( ht , offset , value , ZEND_VM_C_LABEL ( fetch_dim_r_index_undef ) ) ;
2016-07-07 01:46:43 +08:00
ZVAL_COPY_UNREF ( EX_VAR ( opline - > result . var ) , value ) ;
2016-05-18 20:06:49 +08:00
if ( OP1_TYPE & ( IS_TMP_VAR | IS_VAR ) ) {
SAVE_OPLINE ( ) ;
FREE_OP1 ( ) ;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
} else {
ZEND_VM_NEXT_OPCODE ( ) ;
}
} else if ( OP1_TYPE ! = IS_CONST & & EXPECTED ( Z_TYPE_P ( container ) = = IS_REFERENCE ) ) {
container = Z_REFVAL_P ( container ) ;
if ( EXPECTED ( Z_TYPE_P ( container ) = = IS_ARRAY ) ) {
ZEND_VM_C_GOTO ( fetch_dim_r_index_array ) ;
} else {
ZEND_VM_C_GOTO ( fetch_dim_r_index_slow ) ;
}
} else {
ZEND_VM_C_LABEL ( fetch_dim_r_index_slow ) :
SAVE_OPLINE ( ) ;
2018-02-21 21:06:29 +08:00
zend_fetch_dimension_address_read_R_slow ( container , dim OPLINE_CC EXECUTE_DATA_CC ) ;
2016-05-18 20:06:49 +08:00
FREE_OP1 ( ) ;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
}
ZEND_VM_C_LABEL ( fetch_dim_r_index_undef ) :
ZVAL_NULL ( EX_VAR ( opline - > result . var ) ) ;
SAVE_OPLINE ( ) ;
2018-02-16 07:45:31 +08:00
zend_undefined_offset ( offset ) ;
2016-05-18 20:06:49 +08:00
FREE_OP1 ( ) ;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
}
2017-05-03 15:01:22 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_SEND_VAR , ( op1_info & ( MAY_BE_UNDEF | MAY_BE_REF ) ) = = 0 , ZEND_SEND_VAR_SIMPLE , CV | VAR , NUM )
2016-06-16 04:07:46 +08:00
{
USE_OPLINE
zval * varptr , * arg ;
zend_free_op free_op1 ;
varptr = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
arg = ZEND_CALL_VAR ( EX ( call ) , opline - > result . var ) ;
if ( OP1_TYPE = = IS_CV ) {
ZVAL_COPY ( arg , varptr ) ;
} else /* if (OP1_TYPE == IS_VAR) */ {
ZVAL_COPY_VALUE ( arg , varptr ) ;
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
2018-02-15 19:50:42 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_SEND_VAR_EX , op - > op2 . num < = MAX_ARG_FLAG_NUM & & ( op1_info & ( MAY_BE_UNDEF | MAY_BE_REF ) ) = = 0 , ZEND_SEND_VAR_EX_SIMPLE , CV | VAR , NUM )
2016-06-16 04:07:46 +08:00
{
USE_OPLINE
zval * varptr , * arg ;
zend_free_op free_op1 ;
uint32_t arg_num = opline - > op2 . num ;
2018-02-15 19:50:42 +08:00
if ( QUICK_ARG_SHOULD_BE_SENT_BY_REF ( EX ( call ) - > func , arg_num ) ) {
2016-06-16 04:07:46 +08:00
ZEND_VM_DISPATCH_TO_HANDLER ( ZEND_SEND_REF ) ;
}
varptr = GET_OP1_ZVAL_PTR_UNDEF ( BP_VAR_R ) ;
arg = ZEND_CALL_VAR ( EX ( call ) , opline - > result . var ) ;
if ( OP1_TYPE = = IS_CV ) {
ZVAL_COPY ( arg , varptr ) ;
} else /* if (OP1_TYPE == IS_VAR) */ {
ZVAL_COPY_VALUE ( arg , varptr ) ;
}
ZEND_VM_NEXT_OPCODE ( ) ;
}
2017-06-21 04:25:09 +08:00
ZEND_VM_HOT_TYPE_SPEC_HANDLER ( ZEND_FE_FETCH_R , op - > op2_type = = IS_CV & & ( op1_info & ( MAY_BE_UNDEF | MAY_BE_ANY | MAY_BE_REF ) ) = = MAY_BE_ARRAY , ZEND_FE_FETCH_R_SIMPLE , VAR , CV , JMP_ADDR , SPEC ( RETVAL ) )
{
USE_OPLINE
zval * array ;
zval * value , * variable_ptr ;
uint32_t value_type ;
HashTable * fe_ht ;
HashPosition pos ;
Bucket * p ;
array = EX_VAR ( opline - > op1 . var ) ;
SAVE_OPLINE ( ) ;
fe_ht = Z_ARRVAL_P ( array ) ;
pos = Z_FE_POS_P ( array ) ;
p = fe_ht - > arData + pos ;
while ( 1 ) {
if ( UNEXPECTED ( pos > = fe_ht - > nNumUsed ) ) {
/* reached end of iteration */
ZEND_VM_SET_RELATIVE_OPCODE ( opline , opline - > extended_value ) ;
ZEND_VM_CONTINUE ( ) ;
}
value = & p - > val ;
value_type = Z_TYPE_INFO_P ( value ) ;
if ( EXPECTED ( value_type ! = IS_UNDEF ) ) {
if ( UNEXPECTED ( value_type = = IS_INDIRECT ) ) {
value = Z_INDIRECT_P ( value ) ;
value_type = Z_TYPE_INFO_P ( value ) ;
if ( EXPECTED ( value_type ! = IS_UNDEF ) ) {
break ;
}
} else {
break ;
}
}
pos + + ;
p + + ;
}
Z_FE_POS_P ( array ) = pos + 1 ;
if ( RETURN_VALUE_USED ( opline ) ) {
if ( ! p - > key ) {
ZVAL_LONG ( EX_VAR ( opline - > result . var ) , p - > h ) ;
} else {
ZVAL_STR_COPY ( EX_VAR ( opline - > result . var ) , p - > key ) ;
}
}
variable_ptr = _get_zval_ptr_cv_undef_BP_VAR_W ( opline - > op2 . var EXECUTE_DATA_CC ) ;
zend_assign_to_variable ( variable_ptr , value , IS_CV ) ;
2017-06-25 22:45:17 +08:00
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION ( ) ;
2017-06-21 04:25:09 +08:00
}
2015-04-20 05:21:57 +08:00
ZEND_VM_DEFINE_OP ( 137 , ZEND_OP_DATA ) ;
2016-06-23 20:01:23 +08:00
ZEND_VM_HELPER ( zend_interrupt_helper , ANY , ANY )
{
EG ( vm_interrupt ) = 0 ;
if ( EG ( timed_out ) ) {
zend_timeout ( 0 ) ;
} else if ( zend_interrupt_function ) {
SAVE_OPLINE ( ) ;
zend_interrupt_function ( execute_data ) ;
2016-06-24 17:20:41 +08:00
ZEND_VM_ENTER ( ) ;
2016-06-23 20:01:23 +08:00
}
ZEND_VM_CONTINUE ( ) ;
}