@@ -1622,9 +1622,8 @@ PHP_RINIT_FUNCTION(mbstring)
1622
1622
CG (compiler_options ) |= ZEND_COMPILE_NO_BUILTIN_STRLEN ;
1623
1623
while (p -> type > 0 ) {
1624
1624
if ((MBSTRG (func_overload ) & p -> type ) == p -> type &&
1625
- (orig = zend_hash_str_find_ptr (EG (function_table ), p -> save_func ,
1626
- strlen (p -> save_func ))) == NULL ) {
1627
-
1625
+ !zend_hash_str_exists (EG (function_table ), p -> save_func , strlen (p -> save_func ))
1626
+ ) {
1628
1627
func = zend_hash_str_find_ptr (EG (function_table ), p -> ovld_func , strlen (p -> ovld_func ));
1629
1628
1630
1629
if ((orig = zend_hash_str_find_ptr (EG (function_table ), p -> orig_func , strlen (p -> orig_func ))) == NULL ) {
@@ -1633,11 +1632,14 @@ PHP_RINIT_FUNCTION(mbstring)
1633
1632
} else {
1634
1633
ZEND_ASSERT (orig -> type == ZEND_INTERNAL_FUNCTION );
1635
1634
zend_hash_str_add_mem (EG (function_table ), p -> save_func , strlen (p -> save_func ), orig , sizeof (zend_internal_function ));
1635
+ function_add_ref (orig );
1636
1636
1637
1637
if (zend_hash_str_update_mem (EG (function_table ), p -> orig_func , strlen (p -> orig_func ), func , sizeof (zend_internal_function )) == NULL ) {
1638
1638
php_error_docref ("ref.mbstring" TSRMLS_CC , E_WARNING , "mbstring couldn't replace function %s." , p -> orig_func );
1639
1639
return FAILURE ;
1640
1640
}
1641
+
1642
+ function_add_ref (func );
1641
1643
}
1642
1644
}
1643
1645
p ++ ;
@@ -1684,6 +1686,7 @@ PHP_RSHUTDOWN_FUNCTION(mbstring)
1684
1686
(orig = zend_hash_str_find_ptr (EG (function_table ), p -> save_func , strlen (p -> save_func )))) {
1685
1687
1686
1688
zend_hash_str_update_mem (EG (function_table ), p -> orig_func , strlen (p -> orig_func ), orig , sizeof (zend_internal_function ));
1689
+ function_add_ref (orig );
1687
1690
zend_hash_str_del (EG (function_table ), p -> save_func , strlen (p -> save_func ));
1688
1691
}
1689
1692
p ++ ;
0 commit comments