diff options
author | Anatoliy Belsky <ab@php.net> | 2012-05-10 15:27:44 +0200 |
---|---|---|
committer | Anatoliy Belsky <ab@php.net> | 2012-05-10 15:27:44 +0200 |
commit | f7d8b274c7affabd3158075ff1feec45e2cdf56f (patch) | |
tree | 206089398175e1e410b6bd006893b0defa04fa87 | |
parent | 7fb16d5bd9cd5a317c52ed36b5a94fc5e0067b4a (diff) | |
download | php-git-f7d8b274c7affabd3158075ff1feec45e2cdf56f.tar.gz |
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.
-rw-r--r-- | ext/standard/filestat.c | 7 | ||||
-rw-r--r-- | ext/standard/tests/file/realpath_cache.phpt | 2 | ||||
-rw-r--r-- | ext/standard/tests/file/realpath_cache_win32.phpt | 2 |
3 files changed, 8 insertions, 3 deletions
diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index 94a7b89b87..349526ecfd 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 a476063d66..92d6fc5b2a 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 16fc412b09..a4c663f6d1 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"]=> |