@@ -680,13 +680,20 @@ static void ZEND_FASTCALL zend_jit_fetch_dim_str_r_helper(zval *container, zval
680680 case IS_STRING :
681681 {
682682 /* allow errors in string offset for BC reasons */
683- if (IS_LONG == is_numeric_string (Z_STRVAL_P (dim ), Z_STRLEN_P (dim ), & offset , NULL , true)) {
683+ zend_uchar numeric_string_type = is_numeric_string (Z_STRVAL_P (dim ), Z_STRLEN_P (dim ), & offset , NULL , true);
684+ if (IS_LONG == numeric_string_type ) {
684685 /* emit Illegal string warning on leading numerical string */
685686 if (0 == is_numeric_string (Z_STRVAL_P (dim ), Z_STRLEN_P (dim ), NULL , NULL , false)) {
686687 zend_error (E_WARNING , "Illegal string offset \"%s\"" , Z_STRVAL_P (dim ));
687688 }
688689 goto out ;
689690 }
691+ if (IS_DOUBLE == numeric_string_type ) {
692+ if (IS_DOUBLE == is_numeric_string (Z_STRVAL_P (dim ), Z_STRLEN_P (dim ), NULL , NULL , false)) {
693+ zend_error (E_WARNING , "String offset cast occurred" );
694+ break ;
695+ }
696+ }
690697 zend_type_error ("Illegal offset type" );
691698 break ;
692699 }
@@ -833,14 +840,21 @@ static zend_never_inline zend_long zend_check_string_offset(zval *dim, int type)
833840 case IS_STRING :
834841 {
835842 /* allow errors in string offset for BC reasons */
836- if (IS_LONG == is_numeric_string (Z_STRVAL_P (dim ), Z_STRLEN_P (dim ), & offset , NULL , true)) {
843+ zend_uchar numeric_string_type = is_numeric_string (Z_STRVAL_P (dim ), Z_STRLEN_P (dim ), & offset , NULL , true);
844+ if (IS_LONG == numeric_string_type ) {
837845 /* emit Illegal string warning on leading numerical string */
838846 if (0 == is_numeric_string (Z_STRVAL_P (dim ), Z_STRLEN_P (dim ), NULL , NULL , false)
839847 && type != BP_VAR_UNSET ) {
840848 zend_error (E_WARNING , "Illegal string offset \"%s\"" , Z_STRVAL_P (dim ));
841849 }
842850 return offset ;
843851 }
852+ if (IS_DOUBLE == numeric_string_type ) {
853+ if (IS_DOUBLE == is_numeric_string (Z_STRVAL_P (dim ), Z_STRLEN_P (dim ), NULL , NULL , false)) {
854+ zend_error (E_WARNING , "String offset cast occurred" );
855+ break ;
856+ }
857+ }
844858 zend_type_error ("Illegal offset type" );
845859 break ;
846860 }
0 commit comments