@@ -773,6 +773,20 @@ ZEND_VM_HANDLER(13, ZEND_BOOL_NOT, CONST|TMPVAR|CV, ANY)
773
773
ZEND_VM_NEXT_OPCODE ();
774
774
}
775
775
776
+ ZEND_VM_HELPER (zend_this_not_in_object_context_helper , ANY , ANY )
777
+ {
778
+ USE_OPLINE
779
+
780
+ SAVE_OPLINE ();
781
+ zend_throw_error (NULL , "Using $this when not in object context" );
782
+ if ((opline + 1 )-> opcode == ZEND_OP_DATA ) {
783
+ FREE_UNFETCHED_OP_DATA ();
784
+ }
785
+ FREE_UNFETCHED_OP2 ();
786
+ UNDEF_RESULT ();
787
+ HANDLE_EXCEPTION ();
788
+ }
789
+
776
790
ZEND_VM_HELPER (zend_binary_assign_op_obj_helper , VAR |UNUSED |CV , CONST |TMPVAR |CV , binary_op_type binary_op )
777
791
{
778
792
USE_OPLINE
@@ -786,11 +800,7 @@ ZEND_VM_HELPER(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMPVAR|CV,
786
800
object = GET_OP1_OBJ_ZVAL_PTR_PTR (BP_VAR_RW );
787
801
788
802
if (OP1_TYPE == IS_UNUSED && UNEXPECTED (Z_TYPE_P (object ) == IS_UNDEF )) {
789
- zend_throw_error (NULL , "Using $this when not in object context" );
790
- FREE_UNFETCHED_OP ((opline + 1 )-> op1_type , (opline + 1 )-> op1 .var );
791
- FREE_UNFETCHED_OP2 ();
792
- UNDEF_RESULT ();
793
- HANDLE_EXCEPTION ();
803
+ ZEND_VM_DISPATCH_TO_HELPER (zend_this_not_in_object_context_helper );
794
804
}
795
805
796
806
property = GET_OP2_ZVAL_PTR (BP_VAR_R );
@@ -1051,10 +1061,7 @@ ZEND_VM_HELPER(zend_pre_incdec_property_helper, VAR|UNUSED|CV, CONST|TMPVAR|CV,
1051
1061
object = GET_OP1_OBJ_ZVAL_PTR_PTR (BP_VAR_RW );
1052
1062
1053
1063
if (OP1_TYPE == IS_UNUSED && UNEXPECTED (Z_TYPE_P (object ) == IS_UNDEF )) {
1054
- zend_throw_error (NULL , "Using $this when not in object context" );
1055
- FREE_UNFETCHED_OP2 ();
1056
- UNDEF_RESULT ();
1057
- HANDLE_EXCEPTION ();
1064
+ ZEND_VM_DISPATCH_TO_HELPER (zend_this_not_in_object_context_helper );
1058
1065
}
1059
1066
1060
1067
property = GET_OP2_ZVAL_PTR (BP_VAR_R );
@@ -1131,10 +1138,7 @@ ZEND_VM_HELPER(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMPVAR|CV,
1131
1138
object = GET_OP1_OBJ_ZVAL_PTR_PTR (BP_VAR_RW );
1132
1139
1133
1140
if (OP1_TYPE == IS_UNUSED && UNEXPECTED (Z_TYPE_P (object ) == IS_UNDEF )) {
1134
- zend_throw_error (NULL , "Using $this when not in object context" );
1135
- FREE_UNFETCHED_OP2 ();
1136
- ZVAL_UNDEF (EX_VAR (opline -> result .var ));
1137
- HANDLE_EXCEPTION ();
1141
+ ZEND_VM_DISPATCH_TO_HELPER (zend_this_not_in_object_context_helper );
1138
1142
}
1139
1143
1140
1144
property = GET_OP2_ZVAL_PTR (BP_VAR_R );
@@ -1756,10 +1760,7 @@ ZEND_VM_HANDLER(82, ZEND_FETCH_OBJ_R, CONST|TMP|VAR|UNUSED|THIS|CV, CONST|TMPVAR
1756
1760
container = GET_OP1_OBJ_ZVAL_PTR (BP_VAR_R );
1757
1761
1758
1762
if (OP1_TYPE == IS_UNUSED && UNEXPECTED (Z_TYPE_P (container ) == IS_UNDEF )) {
1759
- zend_throw_error (NULL , "Using $this when not in object context" );
1760
- FREE_UNFETCHED_OP2 ();
1761
- ZVAL_UNDEF (EX_VAR (opline -> result .var ));
1762
- HANDLE_EXCEPTION ();
1763
+ ZEND_VM_DISPATCH_TO_HELPER (zend_this_not_in_object_context_helper );
1763
1764
}
1764
1765
1765
1766
offset = GET_OP2_ZVAL_PTR (BP_VAR_R );
@@ -1826,16 +1827,13 @@ ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV)
1826
1827
zval * container ;
1827
1828
1828
1829
SAVE_OPLINE ();
1829
- property = GET_OP2_ZVAL_PTR (BP_VAR_R );
1830
1830
1831
1831
container = GET_OP1_OBJ_ZVAL_PTR_PTR_UNDEF (BP_VAR_W );
1832
1832
if (OP1_TYPE == IS_UNUSED && UNEXPECTED (Z_TYPE_P (container ) == IS_UNDEF )) {
1833
- zend_throw_error (NULL , "Using $this when not in object context" );
1834
- FREE_OP2 ();
1835
- ZVAL_UNDEF (EX_VAR (opline -> result .var ));
1836
- HANDLE_EXCEPTION ();
1833
+ ZEND_VM_DISPATCH_TO_HELPER (zend_this_not_in_object_context_helper );
1837
1834
}
1838
1835
1836
+ property = GET_OP2_ZVAL_PTR (BP_VAR_R );
1839
1837
zend_fetch_property_address (EX_VAR (opline -> result .var ), container , OP1_TYPE , property , OP2_TYPE , ((OP2_TYPE == IS_CONST ) ? CACHE_ADDR (Z_CACHE_SLOT_P (property )) : NULL ), BP_VAR_W );
1840
1838
FREE_OP2 ();
1841
1839
if (OP1_TYPE == IS_VAR && READY_TO_DESTROY (free_op1 )) {
@@ -1853,15 +1851,12 @@ ZEND_VM_HANDLER(88, ZEND_FETCH_OBJ_RW, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV)
1853
1851
zval * container ;
1854
1852
1855
1853
SAVE_OPLINE ();
1856
- property = GET_OP2_ZVAL_PTR (BP_VAR_R );
1857
1854
container = GET_OP1_OBJ_ZVAL_PTR_PTR (BP_VAR_RW );
1858
1855
1859
1856
if (OP1_TYPE == IS_UNUSED && UNEXPECTED (Z_TYPE_P (container ) == IS_UNDEF )) {
1860
- zend_throw_error (NULL , "Using $this when not in object context" );
1861
- FREE_OP2 ();
1862
- ZVAL_UNDEF (EX_VAR (opline -> result .var ));
1863
- HANDLE_EXCEPTION ();
1857
+ ZEND_VM_DISPATCH_TO_HELPER (zend_this_not_in_object_context_helper );
1864
1858
}
1859
+ property = GET_OP2_ZVAL_PTR (BP_VAR_R );
1865
1860
zend_fetch_property_address (EX_VAR (opline -> result .var ), container , OP1_TYPE , property , OP2_TYPE , ((OP2_TYPE == IS_CONST ) ? CACHE_ADDR (Z_CACHE_SLOT_P (property )) : NULL ), BP_VAR_RW );
1866
1861
FREE_OP2 ();
1867
1862
if (OP1_TYPE == IS_VAR && READY_TO_DESTROY (free_op1 )) {
@@ -1883,10 +1878,7 @@ ZEND_VM_HANDLER(91, ZEND_FETCH_OBJ_IS, CONST|TMPVAR|UNUSED|THIS|CV, CONST|TMPVAR
1883
1878
container = GET_OP1_OBJ_ZVAL_PTR (BP_VAR_IS );
1884
1879
1885
1880
if (OP1_TYPE == IS_UNUSED && UNEXPECTED (Z_TYPE_P (container ) == IS_UNDEF )) {
1886
- zend_throw_error (NULL , "Using $this when not in object context" );
1887
- FREE_UNFETCHED_OP2 ();
1888
- ZVAL_UNDEF (EX_VAR (opline -> result .var ));
1889
- HANDLE_EXCEPTION ();
1881
+ ZEND_VM_DISPATCH_TO_HELPER (zend_this_not_in_object_context_helper );
1890
1882
}
1891
1883
1892
1884
offset = GET_OP2_ZVAL_PTR (BP_VAR_R );
@@ -1956,22 +1948,19 @@ ZEND_VM_HANDLER(94, ZEND_FETCH_OBJ_FUNC_ARG, CONST|TMP|VAR|UNUSED|THIS|CV, CONST
1956
1948
zval * property ;
1957
1949
1958
1950
SAVE_OPLINE ();
1959
- property = GET_OP2_ZVAL_PTR (BP_VAR_R );
1960
1951
container = GET_OP1_OBJ_ZVAL_PTR_PTR_UNDEF (BP_VAR_W );
1961
1952
1962
1953
if (OP1_TYPE == IS_UNUSED && UNEXPECTED (Z_TYPE_P (container ) == IS_UNDEF )) {
1963
- zend_throw_error (NULL , "Using $this when not in object context" );
1964
- FREE_OP2 ();
1965
- ZVAL_UNDEF (EX_VAR (opline -> result .var ));
1966
- HANDLE_EXCEPTION ();
1954
+ ZEND_VM_DISPATCH_TO_HELPER (zend_this_not_in_object_context_helper );
1967
1955
}
1968
1956
if ((OP1_TYPE & (IS_CONST |IS_TMP_VAR ))) {
1969
1957
zend_throw_error (NULL , "Cannot use temporary expression in write context" );
1970
- FREE_OP2 ();
1958
+ FREE_UNFETCHED_OP2 ();
1971
1959
FREE_OP1_VAR_PTR ();
1972
1960
ZVAL_UNDEF (EX_VAR (opline -> result .var ));
1973
1961
HANDLE_EXCEPTION ();
1974
1962
}
1963
+ property = GET_OP2_ZVAL_PTR (BP_VAR_R );
1975
1964
zend_fetch_property_address (EX_VAR (opline -> result .var ), container , OP1_TYPE , property , OP2_TYPE , ((OP2_TYPE == IS_CONST ) ? CACHE_ADDR (Z_CACHE_SLOT_P (property )) : NULL ), BP_VAR_W );
1976
1965
FREE_OP2 ();
1977
1966
if (OP1_TYPE == IS_VAR && READY_TO_DESTROY (free_op1 )) {
@@ -1994,10 +1983,7 @@ ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV)
1994
1983
container = GET_OP1_OBJ_ZVAL_PTR_PTR (BP_VAR_UNSET );
1995
1984
1996
1985
if (OP1_TYPE == IS_UNUSED && UNEXPECTED (Z_TYPE_P (container ) == IS_UNDEF )) {
1997
- zend_throw_error (NULL , "Using $this when not in object context" );
1998
- FREE_UNFETCHED_OP2 ();
1999
- ZVAL_UNDEF (EX_VAR (opline -> result .var ));
2000
- HANDLE_EXCEPTION ();
1986
+ ZEND_VM_DISPATCH_TO_HELPER (zend_this_not_in_object_context_helper );
2001
1987
}
2002
1988
2003
1989
property = GET_OP2_ZVAL_PTR (BP_VAR_R );
@@ -2034,11 +2020,7 @@ ZEND_VM_HANDLER(136, ZEND_ASSIGN_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, SPEC(
2034
2020
object = GET_OP1_OBJ_ZVAL_PTR_PTR_UNDEF (BP_VAR_W );
2035
2021
2036
2022
if (OP1_TYPE == IS_UNUSED && UNEXPECTED (Z_TYPE_P (object ) == IS_UNDEF )) {
2037
- zend_throw_error (NULL , "Using $this when not in object context" );
2038
- FREE_UNFETCHED_OP2 ();
2039
- FREE_UNFETCHED_OP_DATA ();
2040
- UNDEF_RESULT ();
2041
- HANDLE_EXCEPTION ();
2023
+ ZEND_VM_DISPATCH_TO_HELPER (zend_this_not_in_object_context_helper );
2042
2024
}
2043
2025
2044
2026
property_name = GET_OP2_ZVAL_PTR (BP_VAR_R );
@@ -2922,6 +2904,12 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, CONST|TMPVAR|UNUSED|THIS|CV, CONST|T
2922
2904
2923
2905
SAVE_OPLINE ();
2924
2906
2907
+ object = GET_OP1_OBJ_ZVAL_PTR_UNDEF (BP_VAR_R );
2908
+
2909
+ if (OP1_TYPE == IS_UNUSED && UNEXPECTED (Z_TYPE_P (object ) == IS_UNDEF )) {
2910
+ ZEND_VM_DISPATCH_TO_HELPER (zend_this_not_in_object_context_helper );
2911
+ }
2912
+
2925
2913
function_name = GET_OP2_ZVAL_PTR_UNDEF (BP_VAR_R );
2926
2914
2927
2915
if (OP2_TYPE != IS_CONST &&
@@ -2935,24 +2923,17 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, CONST|TMPVAR|UNUSED|THIS|CV, CONST|T
2935
2923
} else if (OP2_TYPE == IS_CV && UNEXPECTED (Z_TYPE_P (function_name ) == IS_UNDEF )) {
2936
2924
GET_OP2_UNDEF_CV (function_name , BP_VAR_R );
2937
2925
if (UNEXPECTED (EG (exception ) != NULL )) {
2926
+ FREE_OP1 ();
2938
2927
HANDLE_EXCEPTION ();
2939
2928
}
2940
2929
}
2941
2930
zend_throw_error (NULL , "Method name must be a string" );
2942
2931
FREE_OP2 ();
2943
- FREE_UNFETCHED_OP1 ();
2932
+ FREE_OP1 ();
2944
2933
HANDLE_EXCEPTION ();
2945
2934
} while (0 );
2946
2935
}
2947
2936
2948
- object = GET_OP1_OBJ_ZVAL_PTR_UNDEF (BP_VAR_R );
2949
-
2950
- if (OP1_TYPE == IS_UNUSED && UNEXPECTED (Z_TYPE_P (object ) == IS_UNDEF )) {
2951
- zend_throw_error (NULL , "Using $this when not in object context" );
2952
- FREE_OP2 ();
2953
- HANDLE_EXCEPTION ();
2954
- }
2955
-
2956
2937
if (OP1_TYPE != IS_UNUSED ) {
2957
2938
do {
2958
2939
if (OP1_TYPE == IS_CONST || UNEXPECTED (Z_TYPE_P (object ) != IS_OBJECT )) {
@@ -4881,9 +4862,7 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMPVAR|UNUSED|THIS|CV, ANY)
4881
4862
obj = GET_OP1_OBJ_ZVAL_PTR_UNDEF (BP_VAR_R );
4882
4863
4883
4864
if (OP1_TYPE == IS_UNUSED && UNEXPECTED (Z_TYPE_P (obj ) == IS_UNDEF )) {
4884
- zend_throw_error (NULL , "Using $this when not in object context" );
4885
- ZVAL_UNDEF (EX_VAR (opline -> result .var ));
4886
- HANDLE_EXCEPTION ();
4865
+ ZEND_VM_DISPATCH_TO_HELPER (zend_this_not_in_object_context_helper );
4887
4866
}
4888
4867
4889
4868
do {
@@ -5554,9 +5533,7 @@ ZEND_VM_HANDLER(76, ZEND_UNSET_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV)
5554
5533
SAVE_OPLINE ();
5555
5534
container = GET_OP1_OBJ_ZVAL_PTR_PTR (BP_VAR_UNSET );
5556
5535
if (OP1_TYPE == IS_UNUSED && UNEXPECTED (Z_TYPE_P (container ) == IS_UNDEF )) {
5557
- zend_throw_error (NULL , "Using $this when not in object context" );
5558
- FREE_UNFETCHED_OP2 ();
5559
- HANDLE_EXCEPTION ();
5536
+ ZEND_VM_DISPATCH_TO_HELPER (zend_this_not_in_object_context_helper );
5560
5537
}
5561
5538
offset = GET_OP2_ZVAL_PTR (BP_VAR_R );
5562
5539
@@ -6553,10 +6530,7 @@ ZEND_VM_HANDLER(148, ZEND_ISSET_ISEMPTY_PROP_OBJ, CONST|TMPVAR|UNUSED|THIS|CV, C
6553
6530
container = GET_OP1_OBJ_ZVAL_PTR (BP_VAR_IS );
6554
6531
6555
6532
if (OP1_TYPE == IS_UNUSED && UNEXPECTED (Z_TYPE_P (container ) == IS_UNDEF )) {
6556
- zend_throw_error (NULL , "Using $this when not in object context" );
6557
- FREE_UNFETCHED_OP2 ();
6558
- ZVAL_UNDEF (EX_VAR (opline -> result .var ));
6559
- HANDLE_EXCEPTION ();
6533
+ ZEND_VM_DISPATCH_TO_HELPER (zend_this_not_in_object_context_helper );
6560
6534
}
6561
6535
6562
6536
offset = GET_OP2_ZVAL_PTR (BP_VAR_R );
@@ -8040,10 +8014,7 @@ ZEND_VM_HANDLER(184, ZEND_FETCH_THIS, UNUSED, UNUSED)
8040
8014
Z_ADDREF_P (result );
8041
8015
ZEND_VM_NEXT_OPCODE ();
8042
8016
} else {
8043
- SAVE_OPLINE ();
8044
- zend_throw_error (NULL , "Using $this when not in object context" );
8045
- ZVAL_UNDEF (EX_VAR (opline -> result .var ));
8046
- HANDLE_EXCEPTION ();
8017
+ ZEND_VM_DISPATCH_TO_HELPER (zend_this_not_in_object_context_helper );
8047
8018
}
8048
8019
}
8049
8020
0 commit comments