@@ -1603,7 +1603,7 @@ static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim,
1603
1603
s = zend_string_init (Z_STRVAL_P (str ), Z_STRLEN_P (str ), 0 );
1604
1604
ZSTR_H (s ) = ZSTR_H (Z_STR_P (str ));
1605
1605
if (Z_REFCOUNTED_P (str )) {
1606
- zend_string_release_ex (Z_STR_P (str ), 0 );
1606
+ GC_DELREF (Z_STR_P (str ));
1607
1607
}
1608
1608
ZVAL_NEW_STR (str , s );
1609
1609
}
@@ -1615,7 +1615,7 @@ static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim,
1615
1615
* Temporarily increase the refcount to detect this situation. */
1616
1616
GC_ADDREF (s );
1617
1617
offset = zend_check_string_offset (dim , BP_VAR_W EXECUTE_DATA_CC );
1618
- if (GC_DELREF (s ) == 0 ) {
1618
+ if (UNEXPECTED ( GC_DELREF (s ) == 0 ) ) {
1619
1619
zend_string_efree (s );
1620
1620
if (UNEXPECTED (RETURN_VALUE_USED (opline ))) {
1621
1621
ZVAL_NULL (EX_VAR (opline -> result .var ));
@@ -1655,8 +1655,11 @@ static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim,
1655
1655
}
1656
1656
/* Convert to string, just the time to pick the 1st byte */
1657
1657
tmp = zval_try_get_string_func (value );
1658
- if (GC_DELREF (s ) == 0 ) {
1658
+ if (UNEXPECTED ( GC_DELREF (s ) == 0 ) ) {
1659
1659
zend_string_efree (s );
1660
+ if (tmp ) {
1661
+ zend_string_release_ex (tmp , 0 );
1662
+ }
1660
1663
if (UNEXPECTED (RETURN_VALUE_USED (opline ))) {
1661
1664
ZVAL_NULL (EX_VAR (opline -> result .var ));
1662
1665
}
@@ -1691,7 +1694,7 @@ static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim,
1691
1694
* Temporarily increase the refcount to detect this situation. */
1692
1695
GC_ADDREF (s );
1693
1696
zend_error (E_WARNING , "Only the first byte will be assigned to the string offset" );
1694
- if (GC_DELREF (s ) == 0 ) {
1697
+ if (UNEXPECTED ( GC_DELREF (s ) == 0 ) ) {
1695
1698
zend_string_efree (s );
1696
1699
if (UNEXPECTED (RETURN_VALUE_USED (opline ))) {
1697
1700
ZVAL_NULL (EX_VAR (opline -> result .var ));
@@ -2515,11 +2518,11 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z
2515
2518
case IS_UNDEF :
2516
2519
/* The string may be destroyed while throwing the notice.
2517
2520
* Temporarily increase the refcount to detect this situation. */
2518
- if (!(GC_FLAGS (str ) & IS_ARRAY_IMMUTABLE )) {
2521
+ if (!(GC_FLAGS (str ) & IS_STR_INTERNED )) {
2519
2522
GC_ADDREF (str );
2520
2523
}
2521
2524
ZVAL_UNDEFINED_OP2 ();
2522
- if (!(GC_FLAGS (str ) & IS_ARRAY_IMMUTABLE ) && GC_DELREF (str ) == 0 ) {
2525
+ if (!(GC_FLAGS (str ) & IS_STR_INTERNED ) && UNEXPECTED ( GC_DELREF (str ) == 0 ) ) {
2523
2526
zend_string_efree (str );
2524
2527
ZVAL_NULL (result );
2525
2528
return ;
@@ -2532,11 +2535,11 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z
2532
2535
if (type != BP_VAR_IS ) {
2533
2536
/* The string may be destroyed while throwing the notice.
2534
2537
* Temporarily increase the refcount to detect this situation. */
2535
- if (!(GC_FLAGS (str ) & IS_ARRAY_IMMUTABLE )) {
2538
+ if (!(GC_FLAGS (str ) & IS_STR_INTERNED )) {
2536
2539
GC_ADDREF (str );
2537
2540
}
2538
2541
zend_error (E_WARNING , "String offset cast occurred" );
2539
- if (!(GC_FLAGS (str ) & IS_ARRAY_IMMUTABLE ) && GC_DELREF (str ) == 0 ) {
2542
+ if (!(GC_FLAGS (str ) & IS_STR_INTERNED ) && UNEXPECTED ( GC_DELREF (str ) == 0 ) ) {
2540
2543
zend_string_efree (str );
2541
2544
ZVAL_NULL (result );
2542
2545
return ;
0 commit comments