pajoye                                   Tue, 15 Jun 2010 09:26:06 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=300459

Log:
- Fix #51424, crypt() function hangs after 3rd call

Bug: http://bugs.php.net/51424 (Assigned) crypt() function hangs after 3rd call
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/standard/php_crypt_r.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2010-06-15 08:45:27 UTC (rev 300458)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-06-15 09:26:06 UTC (rev 300459)
@@ -141,6 +141,7 @@
 - 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

Modified: php/php-src/branches/PHP_5_3/ext/standard/php_crypt_r.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/php_crypt_r.c     2010-06-15 
08:45:27 UTC (rev 300458)
+++ php/php-src/branches/PHP_5_3/ext/standard/php_crypt_r.c     2010-06-15 
09:26:06 UTC (rev 300459)
@@ -81,11 +81,13 @@
        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);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to