Skip to content

Commit babe7f3

Browse files
committed
Merge branch 'PHP-7.4'
2 parents f56895f + 52c2d47 commit babe7f3

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

ext/standard/tests/file/bug77552.phpt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
--TEST--
2+
Bug #77552 Unintialized php_stream_statbuf in stat functions
3+
--SKIPIF--
4+
<?php
5+
if (substr(PHP_OS, 0, 3) != 'WIN') {
6+
die('skip windows only test');
7+
}
8+
?>
9+
--FILE--
10+
<?php
11+
// Check lstat on a Windows junction to ensure that st_mode is zero
12+
$tmpDir = __DIR__.'/test-bug77552';
13+
14+
$target = $tmpDir.'/folder/target';
15+
mkdir($target, 0777, true);
16+
17+
$junction = $tmpDir.'/junction';
18+
$cmd = sprintf('mklink /J "%s" "%s"', $junction, $target);
19+
exec($cmd);
20+
21+
$stat = lstat($junction);
22+
var_dump($stat['mode']);
23+
24+
?>
25+
--CLEAN--
26+
<?php
27+
$tmpDir = __DIR__.'/test-bug77552';
28+
$cmd = sprintf('rmdir /S /Q "%s"', $tmpDir);
29+
exec($cmd);
30+
?>
31+
--EXPECT--
32+
int(0)

main/streams/streams.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1888,6 +1888,8 @@ PHPAPI int _php_stream_stat_path(const char *path, int flags, php_stream_statbuf
18881888
const char *path_to_open = path;
18891889
int ret;
18901890

1891+
memset(ssb, 0, sizeof(*ssb));
1892+
18911893
if (!(flags & PHP_STREAM_URL_STAT_NOCACHE)) {
18921894
/* Try to hit the cache first */
18931895
if (flags & PHP_STREAM_URL_STAT_LINK) {

0 commit comments

Comments
 (0)