@@ -1677,7 +1677,7 @@ static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim,
1677
1677
s = zend_string_init (Z_STRVAL_P (str ), Z_STRLEN_P (str ), 0 );
1678
1678
ZSTR_H (s ) = ZSTR_H (Z_STR_P (str ));
1679
1679
if (Z_REFCOUNTED_P (str )) {
1680
- zend_string_release_ex (Z_STR_P (str ), 0 );
1680
+ GC_DELREF (Z_STR_P (str ));
1681
1681
}
1682
1682
ZVAL_NEW_STR (str , s );
1683
1683
}
@@ -1689,7 +1689,7 @@ static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim,
1689
1689
* Temporarily increase the refcount to detect this situation. */
1690
1690
GC_ADDREF (s );
1691
1691
offset = zend_check_string_offset (dim , BP_VAR_W EXECUTE_DATA_CC );
1692
- if (GC_DELREF (s ) == 0 ) {
1692
+ if (UNEXPECTED ( GC_DELREF (s ) == 0 ) ) {
1693
1693
zend_string_efree (s );
1694
1694
if (UNEXPECTED (RETURN_VALUE_USED (opline ))) {
1695
1695
ZVAL_NULL (EX_VAR (opline -> result .var ));
@@ -1729,8 +1729,11 @@ static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim,
1729
1729
}
1730
1730
/* Convert to string, just the time to pick the 1st byte */
1731
1731
tmp = zval_try_get_string_func (value );
1732
- if (GC_DELREF (s ) == 0 ) {
1732
+ if (UNEXPECTED ( GC_DELREF (s ) == 0 ) ) {
1733
1733
zend_string_efree (s );
1734
+ if (tmp ) {
1735
+ zend_string_release_ex (tmp , 0 );
1736
+ }
1734
1737
if (UNEXPECTED (RETURN_VALUE_USED (opline ))) {
1735
1738
ZVAL_NULL (EX_VAR (opline -> result .var ));
1736
1739
}
@@ -1765,7 +1768,7 @@ static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim,
1765
1768
* Temporarily increase the refcount to detect this situation. */
1766
1769
GC_ADDREF (s );
1767
1770
zend_error (E_WARNING , "Only the first byte will be assigned to the string offset" );
1768
- if (GC_DELREF (s ) == 0 ) {
1771
+ if (UNEXPECTED ( GC_DELREF (s ) == 0 ) ) {
1769
1772
zend_string_efree (s );
1770
1773
if (UNEXPECTED (RETURN_VALUE_USED (opline ))) {
1771
1774
ZVAL_NULL (EX_VAR (opline -> result .var ));
@@ -2589,11 +2592,11 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z
2589
2592
case IS_UNDEF :
2590
2593
/* The string may be destroyed while throwing the notice.
2591
2594
* Temporarily increase the refcount to detect this situation. */
2592
- if (!(GC_FLAGS (str ) & IS_ARRAY_IMMUTABLE )) {
2595
+ if (!(GC_FLAGS (str ) & IS_STR_INTERNED )) {
2593
2596
GC_ADDREF (str );
2594
2597
}
2595
2598
ZVAL_UNDEFINED_OP2 ();
2596
- if (!(GC_FLAGS (str ) & IS_ARRAY_IMMUTABLE ) && GC_DELREF (str ) == 0 ) {
2599
+ if (!(GC_FLAGS (str ) & IS_STR_INTERNED ) && UNEXPECTED ( GC_DELREF (str ) == 0 ) ) {
2597
2600
zend_string_efree (str );
2598
2601
ZVAL_NULL (result );
2599
2602
return ;
@@ -2606,11 +2609,11 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z
2606
2609
if (type != BP_VAR_IS ) {
2607
2610
/* The string may be destroyed while throwing the notice.
2608
2611
* Temporarily increase the refcount to detect this situation. */
2609
- if (!(GC_FLAGS (str ) & IS_ARRAY_IMMUTABLE )) {
2612
+ if (!(GC_FLAGS (str ) & IS_STR_INTERNED )) {
2610
2613
GC_ADDREF (str );
2611
2614
}
2612
2615
zend_error (E_WARNING , "String offset cast occurred" );
2613
- if (!(GC_FLAGS (str ) & IS_ARRAY_IMMUTABLE ) && GC_DELREF (str ) == 0 ) {
2616
+ if (!(GC_FLAGS (str ) & IS_STR_INTERNED ) && UNEXPECTED ( GC_DELREF (str ) == 0 ) ) {
2614
2617
zend_string_efree (str );
2615
2618
ZVAL_NULL (result );
2616
2619
return ;
0 commit comments