diff --git a/NEWS b/NEWS index f9c9839d8f7..7245e6be83e 100644 --- a/NEWS +++ b/NEWS @@ -141,6 +141,7 @@ PHP NEWS - Fixed bug #51445 (var_dump() invalid/slow *RECURSION* detection). (Felipe) - Fixed bug #51435 (Missing ifdefs / logic bug in crypt code cause compile errors). (Felipe) +- Fixed bug #51424 (crypt() function hangs after 3rd call). (Pierre) - Fixed bug #51394 (Error line reported incorrectly if error handler throws an exception). (Stas) - Fixed bug #51393 (DateTime::createFromFormat() fails if format string contains diff --git a/ext/standard/php_crypt_r.c b/ext/standard/php_crypt_r.c index d04d4dd78df..91063003e76 100644 --- a/ext/standard/php_crypt_r.c +++ b/ext/standard/php_crypt_r.c @@ -81,11 +81,13 @@ void _crypt_extended_init_r(void) tsrm_mutex_lock(php_crypt_extended_init_lock); #endif - if (initialized) { - return; - } else { + if (!initialized) { +#ifdef PHP_WIN32 + InterlockedIncrement(initialized); +#elif (defined(__GNUC__) && (__GNUC__ >= 4 && __GNUC_MINOR >= 2)) + __sync_fetch_and_add(&initialized, 1); +#endif _crypt_extended_init(); - initialized = 1; } #ifdef ZTS tsrm_mutex_unlock(php_crypt_extended_init_lock);