mirror of
https://github.com/php/php-src.git
synced 2026-04-27 10:16:41 +02:00
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.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -19,7 +19,7 @@ echo "Done\n";
|
||||
int(%d)
|
||||
array(4) {
|
||||
["key"]=>
|
||||
int(%i)
|
||||
%s(%d)
|
||||
["is_dir"]=>
|
||||
bool(true)
|
||||
["realpath"]=>
|
||||
|
||||
@@ -19,7 +19,7 @@ echo "Done\n";
|
||||
int(%d)
|
||||
array(8) {
|
||||
["key"]=>
|
||||
int(%d)
|
||||
%s(%d)
|
||||
["is_dir"]=>
|
||||
bool(true)
|
||||
["realpath"]=>
|
||||
|
||||
Reference in New Issue
Block a user