@@ -685,10 +685,11 @@ static void ZEND_FASTCALL zend_jit_fetch_dim_str_r_helper(zval *container, zval
685
685
switch (Z_TYPE_P (dim )) {
686
686
case IS_STRING :
687
687
{
688
- /* allow errors in string offset for BC reasons */
689
- if (IS_LONG == is_numeric_string (Z_STRVAL_P (dim ), Z_STRLEN_P (dim ), & offset , NULL , true)) {
690
- /* emit Illegal string warning on leading numerical string */
691
- if (0 == is_numeric_string (Z_STRVAL_P (dim ), Z_STRLEN_P (dim ), NULL , NULL , false)) {
688
+ bool trailing_data = false;
689
+ /* For BC reasons we allow errors so that we can warn on leading numeric string */
690
+ if (IS_LONG == is_numeric_string_ex (Z_STRVAL_P (dim ), Z_STRLEN_P (dim ), & offset , NULL ,
691
+ /* allow errors */ true, NULL , & trailing_data )) {
692
+ if (UNEXPECTED (trailing_data )) {
692
693
zend_error (E_WARNING , "Illegal string offset \"%s\"" , Z_STRVAL_P (dim ));
693
694
}
694
695
goto out ;
@@ -832,11 +833,11 @@ static zend_never_inline zend_long zend_check_string_offset(zval *dim, int type)
832
833
switch (Z_TYPE_P (dim )) {
833
834
case IS_STRING :
834
835
{
835
- /* 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)) {
837
- /* emit Illegal string warning on leading numerical string */
838
- if ( 0 == is_numeric_string ( Z_STRVAL_P ( dim ), Z_STRLEN_P ( dim ) , NULL , NULL , false)
839
- && type != BP_VAR_UNSET ) {
836
+ bool trailing_data = false;
837
+ /* For BC reasons we allow errors so that we can warn on leading numeric string */
838
+ if ( IS_LONG == is_numeric_string_ex ( Z_STRVAL_P ( dim ), Z_STRLEN_P ( dim ), & offset , NULL ,
839
+ /* allow errors */ true , NULL , & trailing_data )) {
840
+ if ( UNEXPECTED ( trailing_data ) && type != BP_VAR_UNSET ) {
840
841
zend_error (E_WARNING , "Illegal string offset \"%s\"" , Z_STRVAL_P (dim ));
841
842
}
842
843
return offset ;
0 commit comments