@@ -1460,7 +1460,7 @@ static zend_never_inline zend_long zend_check_string_offset(zval *dim, int type
1460
1460
goto try_again ;
1461
1461
default :
1462
1462
zend_illegal_string_offset (dim );
1463
- break ;
1463
+ return 0 ;
1464
1464
}
1465
1465
1466
1466
offset = zval_get_long_func (dim , /* is_strict */ false);
@@ -2405,51 +2405,12 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z
2405
2405
if (!is_list && EXPECTED (Z_TYPE_P (container ) == IS_STRING )) {
2406
2406
zend_long offset ;
2407
2407
2408
- try_string_offset :
2409
- if (UNEXPECTED (Z_TYPE_P (dim ) != IS_LONG )) {
2410
- switch (Z_TYPE_P (dim )) {
2411
- case IS_STRING :
2412
- {
2413
- bool trailing_data = false;
2414
- /* For BC reasons we allow errors so that we can warn on leading numeric string */
2415
- if (IS_LONG == is_numeric_string_ex (Z_STRVAL_P (dim ), Z_STRLEN_P (dim ), & offset ,
2416
- NULL , /* allow errors */ true, NULL , & trailing_data )) {
2417
- if (UNEXPECTED (trailing_data )) {
2418
- zend_error (E_WARNING , "Illegal string offset \"%s\"" , Z_STRVAL_P (dim ));
2419
- }
2420
- goto out ;
2421
- }
2422
- if (type == BP_VAR_IS ) {
2423
- ZVAL_NULL (result );
2424
- return ;
2425
- }
2426
- zend_illegal_string_offset (dim );
2427
- break ;
2428
- }
2429
- case IS_UNDEF :
2430
- ZVAL_UNDEFINED_OP2 ();
2431
- ZEND_FALLTHROUGH ;
2432
- case IS_DOUBLE :
2433
- case IS_NULL :
2434
- case IS_FALSE :
2435
- case IS_TRUE :
2436
- if (type != BP_VAR_IS ) {
2437
- zend_error (E_WARNING , "String offset cast occurred" );
2438
- }
2439
- break ;
2440
- case IS_REFERENCE :
2441
- dim = Z_REFVAL_P (dim );
2442
- goto try_string_offset ;
2443
- default :
2444
- zend_illegal_string_offset (dim );
2445
- break ;
2446
- }
2447
-
2448
- offset = zval_get_long_func (dim , /* is_strict */ false);
2449
- } else {
2450
- offset = Z_LVAL_P (dim );
2408
+ offset = zend_check_string_offset (dim , BP_VAR_IS EXECUTE_DATA_CC );
2409
+ /* Illegal offset */
2410
+ if (UNEXPECTED (EG (exception ) != NULL )) {
2411
+ ZVAL_NULL (result );
2412
+ return ;
2451
2413
}
2452
- out :
2453
2414
2454
2415
if (UNEXPECTED (Z_STRLEN_P (container ) < ((offset < 0 ) ? - (size_t )offset : ((size_t )offset + 1 )))) {
2455
2416
if (type != BP_VAR_IS ) {
0 commit comments