Commit: f7d8b274c7affabd3158075ff1feec45e2cdf56f Author: Anatoliy Belsky <a...@php.net> Thu, 10 May 2012 15:27:44 +0200 Parents: 7fb16d5bd9cd5a317c52ed36b5a94fc5e0067b4a Branches: PHP-5.3 PHP-5.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f7d8b274c7affabd3158075ff1feec45e2cdf56f Log: Fix bug ext\standard\tests\file\realpath_cache_win32.phpt fails What happens here is trivial long overflow. Despite the bug attracted attention on windows, the same story is on linux. Just wait for a big anough bucket->key . The linux test had %i to check the key value which should be %d all the way. Changed paths: M ext/standard/filestat.c M ext/standard/tests/file/realpath_cache.phpt M ext/standard/tests/file/realpath_cache_win32.phpt Diff: diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index 94a7b89..349526e 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -1160,7 +1160,12 @@ PHP_FUNCTION(realpath_cache_get) MAKE_STD_ZVAL(entry); array_init(entry); - add_assoc_long(entry, "key", bucket->key); + /* bucket->key is unsigned long */ + if (LONG_MAX >= bucket->key) { + add_assoc_long(entry, "key", bucket->key); + } else { + add_assoc_double(entry, "key", (double)bucket->key); + } add_assoc_bool(entry, "is_dir", bucket->is_dir); add_assoc_stringl(entry, "realpath", bucket->realpath, bucket->realpath_len, 1); add_assoc_long(entry, "expires", bucket->expires); diff --git a/ext/standard/tests/file/realpath_cache.phpt b/ext/standard/tests/file/realpath_cache.phpt index a476063..92d6fc5 100644 --- a/ext/standard/tests/file/realpath_cache.phpt +++ b/ext/standard/tests/file/realpath_cache.phpt @@ -19,7 +19,7 @@ echo "Done\n"; int(%d) array(4) { ["key"]=> - int(%i) + %s(%d) ["is_dir"]=> bool(true) ["realpath"]=> diff --git a/ext/standard/tests/file/realpath_cache_win32.phpt b/ext/standard/tests/file/realpath_cache_win32.phpt index 16fc412..a4c663f 100644 --- a/ext/standard/tests/file/realpath_cache_win32.phpt +++ b/ext/standard/tests/file/realpath_cache_win32.phpt @@ -19,7 +19,7 @@ echo "Done\n"; int(%d) array(8) { ["key"]=> - int(%d) + %s(%d) ["is_dir"]=> bool(true) ["realpath"]=> -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php