请选择 进入手机版 | 继续访问电脑版

技术控

    今日:9| 主题:61554
收藏本版 (1)
最新软件应用技术尽在掌握

[其他] PHP ssh2.sftp opendir/readdir fix

[复制链接]
幸福依旧不清 发表于 2016-12-1 05:01:54
280 3
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.
哇哒嘻哇阿啦嗒 发表于 2016-12-3 17:37:13
做爱做的事,交配交的人。  
回复 支持 反对

使用道具 举报

正在输入◇ 发表于 2016-12-4 12:36:16
我对楼主的敬仰如滔滔江水,绵延不绝!
回复 支持 反对

使用道具 举报

如果云知道 发表于 2016-12-22 17:20:09
幸福依旧不清的帖子越来越有深度了!
回复 支持 反对

使用道具 举报

我要投稿

推荐阅读


回页顶回复上一篇下一篇回列表
手机版/c.CoLaBug.com ( 粤ICP备05003221号 | 文网文[2010]257号 | 粤公网安备 44010402000842号 )

© 2001-2017 Comsenz Inc.

返回顶部 返回列表