diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-02-11 11:32:42 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-02-11 11:33:04 +0100 |
commit | be64a06b1cf37a560384ee568498f870e77be168 (patch) | |
tree | 5ec71690f430a9b7d21a38281e4a427f17630e28 | |
parent | b3935ed2afb25312a73bc68ff6380f3b7ccead29 (diff) | |
parent | fe4d7248cc09cf4d4f7b289e6db8299e8d7ac6d2 (diff) | |
download | php-git-be64a06b1cf37a560384ee568498f870e77be168.tar.gz |
Merge branch 'PHP-7.2' into PHP-7.3
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | ext/standard/tests/file/bug77552.phpt | 32 | ||||
-rw-r--r-- | main/streams/streams.c | 2 |
3 files changed, 38 insertions, 0 deletions
@@ -29,6 +29,10 @@ PHP NEWS - phpdbg: . Fixed bug #76596 (phpdbg support for display_errors=stderr). (kabel) +- Standard: + . Fixed bug #77552 (Unintialized php_stream_statbuf in stat functions). + (John Stevenson) + 07 Feb 2019, PHP 7.3.2 - Core: diff --git a/ext/standard/tests/file/bug77552.phpt b/ext/standard/tests/file/bug77552.phpt new file mode 100644 index 0000000000..9404b8e09f --- /dev/null +++ b/ext/standard/tests/file/bug77552.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #77552 Unintialized php_stream_statbuf in stat functions +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip windows only test'); +} +?> +--FILE-- +<?php +// Check lstat on a Windows junction to ensure that st_mode is zero +$tmpDir = __DIR__.'/test-bug77552'; + +$target = $tmpDir.'/folder/target'; +mkdir($target, 0777, true); + +$junction = $tmpDir.'/junction'; +$cmd = sprintf('mklink /J "%s" "%s"', $junction, $target); +exec($cmd); + +$stat = lstat($junction); +var_dump($stat['mode']); + +?> +--CLEAN-- +<?php +$tmpDir = __DIR__.'/test-bug77552'; +$cmd = sprintf('rmdir /S /Q "%s"', $tmpDir); +exec($cmd); +?> +--EXPECT-- +int(0) diff --git a/main/streams/streams.c b/main/streams/streams.c index df98bdace6..626c7f6a54 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -1884,6 +1884,8 @@ PHPAPI int _php_stream_stat_path(const char *path, int flags, php_stream_statbuf const char *path_to_open = path; int ret; + memset(ssb, 0, sizeof(*ssb)); + if (!(flags & PHP_STREAM_URL_STAT_NOCACHE)) { /* Try to hit the cache first */ if (flags & PHP_STREAM_URL_STAT_LINK) { |