You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* We are calling method of the other (incompatible) class,
1731
+
but passing $this. This is done for compatibility with php-4. */
1732
+
zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
Copy file name to clipboardExpand all lines: Zend/zend_vm_execute.h
+45Lines changed: 45 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -678,6 +678,15 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
678
678
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
679
679
EX(object) = NULL;
680
680
} else {
681
+
if (IS_CONST != IS_UNUSED &&
682
+
EG(This) &&
683
+
Z_OBJ_HT_P(EG(This))->get_class_entry &&
684
+
!instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
685
+
/* We are calling method of the other (incompatible) class,
686
+
but passing $this. This is done for compatibility with php-4. */
687
+
zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
688
+
689
+
}
681
690
if ((EX(object) = EG(This))) {
682
691
EX(object)->refcount++;
683
692
}
@@ -870,6 +879,15 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
870
879
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
871
880
EX(object) = NULL;
872
881
} else {
882
+
if (IS_TMP_VAR != IS_UNUSED &&
883
+
EG(This) &&
884
+
Z_OBJ_HT_P(EG(This))->get_class_entry &&
885
+
!instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
886
+
/* We are calling method of the other (incompatible) class,
887
+
but passing $this. This is done for compatibility with php-4. */
888
+
zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
889
+
890
+
}
873
891
if ((EX(object) = EG(This))) {
874
892
EX(object)->refcount++;
875
893
}
@@ -1019,6 +1037,15 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
1019
1037
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
1020
1038
EX(object) = NULL;
1021
1039
} else {
1040
+
if (IS_VAR != IS_UNUSED &&
1041
+
EG(This) &&
1042
+
Z_OBJ_HT_P(EG(This))->get_class_entry &&
1043
+
!instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
1044
+
/* We are calling method of the other (incompatible) class,
1045
+
but passing $this. This is done for compatibility with php-4. */
1046
+
zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
1047
+
1048
+
}
1022
1049
if ((EX(object) = EG(This))) {
1023
1050
EX(object)->refcount++;
1024
1051
}
@@ -1167,6 +1194,15 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_
1167
1194
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
1168
1195
EX(object) = NULL;
1169
1196
} else {
1197
+
if (IS_UNUSED != IS_UNUSED &&
1198
+
EG(This) &&
1199
+
Z_OBJ_HT_P(EG(This))->get_class_entry &&
1200
+
!instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
1201
+
/* We are calling method of the other (incompatible) class,
1202
+
but passing $this. This is done for compatibility with php-4. */
1203
+
zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
1204
+
1205
+
}
1170
1206
if ((EX(object) = EG(This))) {
1171
1207
EX(object)->refcount++;
1172
1208
}
@@ -1248,6 +1284,15 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
1248
1284
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
1249
1285
EX(object) = NULL;
1250
1286
} else {
1287
+
if (IS_CV != IS_UNUSED &&
1288
+
EG(This) &&
1289
+
Z_OBJ_HT_P(EG(This))->get_class_entry &&
1290
+
!instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
1291
+
/* We are calling method of the other (incompatible) class,
1292
+
but passing $this. This is done for compatibility with php-4. */
1293
+
zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
0 commit comments