This bug https://bugs.php.net/bug.php?id=73597related to the PECL ssh2 extension bit us yesterday, so this post is a public service announcement that will (hopefully) save you from writing your own workaround like I almost did.
您需要 登录 才可以下载或查看，没有帐号？立即注册
Problem: PHP 5.6.28 (and apparently 7.0.13) introduced a security fix to URL parsing, that caused the string interpolation of the $sftp resource handle to no-longer be recognized as a valid URL. In turn, that causes opendir(), readdir(), etc. to fail when you use an $sftp resource in the path string, after an upgrade to one of those PHP versions.
Solution: Instead of using "ssh2.sftp://$sftp"as a stream path, convert $sftp to an integer like so: "ssh2.sftp://" . intval($sftp) . "/". Then it will work just fine.
Thanks to the people who fixed the URL parsing security flaw, thanks to the people who wrote the PECL ssh2 extension, and thanks to the people who provided the fix.
上一篇：Build A Media Library With React, Redux, and Redux-saga – Part 2
下一篇：Why I Wrote a Book About Interpreters