Skip to content

Commit be64a06

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
2 parents b3935ed + fe4d724 commit be64a06

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ PHP NEWS
2929
- phpdbg:
3030
. Fixed bug #76596 (phpdbg support for display_errors=stderr). (kabel)
3131

32+
- Standard:
33+
. Fixed bug #77552 (Unintialized php_stream_statbuf in stat functions).
34+
(John Stevenson)
35+
3236
07 Feb 2019, PHP 7.3.2
3337

3438
- Core:

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
@@ -1884,6 +1884,8 @@ PHPAPI int _php_stream_stat_path(const char *path, int flags, php_stream_statbuf
18841884
const char *path_to_open = path;
18851885
int ret;
18861886

1887+
memset(ssb, 0, sizeof(*ssb));
1888+
18871889
if (!(flags & PHP_STREAM_URL_STAT_NOCACHE)) {
18881890
/* Try to hit the cache first */
18891891
if (flags & PHP_STREAM_URL_STAT_LINK) {

0 commit comments

Comments
 (0)