rasmus Thu, 19 May 2011 23:09:58 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=311274
Log: Fix bug 54866 Bug: http://bugs.php.net/54866 (Open) incorrect accounting for realpath_cache_size Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c U php/php-src/branches/PHP_5_4/TSRM/tsrm_virtual_cwd.c U php/php-src/trunk/TSRM/tsrm_virtual_cwd.c Modified: php/php-src/branches/PHP_5_3/NEWS =================================================================== --- php/php-src/branches/PHP_5_3/NEWS 2011-05-19 22:49:47 UTC (rev 311273) +++ php/php-src/branches/PHP_5_3/NEWS 2011-05-19 23:09:58 UTC (rev 311274) @@ -32,8 +32,9 @@ (tomas dot brastavicius at quantum dot lt, Pierrick) . Fixed bug #48465 (sys_get_temp_dir() possibly inconsistent when using TMPDIR on Windows). (Pierre) + . Fixed bug 54866 (incorrect accounting for realpath_cache_size) (Dustin Ward) -- cURL +- cURL: . Added CURLINFO_REDIRECT_URL support. (Daniel Stenberg, Pierre) . Added support for CURLOPT_MAX_RECV_SPEED_LARGE and CURLOPT_MAX_SEND_SPEED_LARGE. FR #51815. (Pierrick) Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c =================================================================== --- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c 2011-05-19 22:49:47 UTC (rev 311273) +++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c 2011-05-19 23:09:58 UTC (rev 311274) @@ -629,7 +629,13 @@ memcmp(path, (*bucket)->path, path_len) == 0) { realpath_cache_bucket *r = *bucket; *bucket = (*bucket)->next; - CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1; + + /* if the pointers match then only subtract the length of the path */ + if(r->path == r->realpath) + CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1; + else + CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1; + free(r); return; } else { @@ -704,7 +710,13 @@ if (CWDG(realpath_cache_ttl) && (*bucket)->expires < t) { realpath_cache_bucket *r = *bucket; *bucket = (*bucket)->next; - CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1; + + /* if the pointers match then only subtract the length of the path */ + if(r->path == r->realpath) + CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1; + else + CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1; + free(r); } else if (key == (*bucket)->key && path_len == (*bucket)->path_len && memcmp(path, (*bucket)->path, path_len) == 0) { Modified: php/php-src/branches/PHP_5_4/TSRM/tsrm_virtual_cwd.c =================================================================== --- php/php-src/branches/PHP_5_4/TSRM/tsrm_virtual_cwd.c 2011-05-19 22:49:47 UTC (rev 311273) +++ php/php-src/branches/PHP_5_4/TSRM/tsrm_virtual_cwd.c 2011-05-19 23:09:58 UTC (rev 311274) @@ -617,7 +617,13 @@ memcmp(path, (*bucket)->path, path_len) == 0) { realpath_cache_bucket *r = *bucket; *bucket = (*bucket)->next; - CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1; + + /* if the pointers match then only subtract the length of the path */ + if(r->path == r->realpath) + CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1; + else + CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1; + free(r); return; } else { @@ -692,7 +698,13 @@ if (CWDG(realpath_cache_ttl) && (*bucket)->expires < t) { realpath_cache_bucket *r = *bucket; *bucket = (*bucket)->next; - CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1; + + /* if the pointers match then only subtract the length of the path */ + if(r->path == r->realpath) + CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1; + else + CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1; + free(r); } else if (key == (*bucket)->key && path_len == (*bucket)->path_len && memcmp(path, (*bucket)->path, path_len) == 0) { Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.c =================================================================== --- php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2011-05-19 22:49:47 UTC (rev 311273) +++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2011-05-19 23:09:58 UTC (rev 311274) @@ -617,7 +617,13 @@ memcmp(path, (*bucket)->path, path_len) == 0) { realpath_cache_bucket *r = *bucket; *bucket = (*bucket)->next; - CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1; + + /* if the pointers match then only subtract the length of the path */ + if(r->path == r->realpath) + CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1; + else + CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1; + free(r); return; } else { @@ -692,7 +698,13 @@ if (CWDG(realpath_cache_ttl) && (*bucket)->expires < t) { realpath_cache_bucket *r = *bucket; *bucket = (*bucket)->next; - CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1; + + /* if the pointers match then only subtract the length of the path */ + if(r->path == r->realpath) + CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1; + else + CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1; + free(r); } else if (key == (*bucket)->key && path_len == (*bucket)->path_len && memcmp(path, (*bucket)->path, path_len) == 0) {
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php