@@ -585,6 +585,13 @@ static zend_string* ZEND_FASTCALL accel_new_interned_string_for_php(zend_string
585585 return ret ;
586586 }
587587 }
588+ #if ZEND_RC_DEBUG
589+ /* PHP shouldn't create persistent strings during request, but at least
590+ * dl() may do this. They belong to the temporary module and are not shared. */
591+ if (!zend_rc_debug && !ZSTR_IS_INTERNED (str ) && (GC_FLAGS (str ) & GC_PERSISTENT )) {
592+ GC_MAKE_PERSISTENT_LOCAL (str );
593+ }
594+ #endif
588595 return str ;
589596}
590597
@@ -609,19 +616,31 @@ static zend_always_inline zend_string *accel_find_interned_string_ex(zend_ulong
609616
610617static zend_string * ZEND_FASTCALL accel_init_interned_string_for_php (const char * str , size_t size , bool permanent )
611618{
619+ zend_string * ret ;
620+
612621 if (ZCG (counted )) {
613622 zend_ulong h = zend_inline_hash_func (str , size );
614- zend_string * ret = accel_find_interned_string_ex (h , str , size );
623+ ret = accel_find_interned_string_ex (h , str , size );
615624
616- if (!ret ) {
617- ret = zend_string_init (str , size , permanent );
618- ZSTR_H (ret ) = h ;
625+ if (ret ) {
626+ return ret ;
619627 }
620628
621- return ret ;
629+ ret = zend_string_init (str , size , permanent );
630+ ZSTR_H (ret ) = h ;
631+ } else {
632+ ret = zend_string_init (str , size , permanent );
622633 }
623634
624- return zend_string_init (str , size , permanent );
635+ #if ZEND_RC_DEBUG
636+ /* PHP shouldn't create persistent strings during request, but at least
637+ * dl() may do this. They belong to the temporary module and are not shared. */
638+ if (!zend_rc_debug && permanent ) {
639+ GC_MAKE_PERSISTENT_LOCAL (ret );
640+ }
641+ #endif
642+
643+ return ret ;
625644}
626645
627646static inline void accel_copy_permanent_list_types (
0 commit comments