|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-11-15 11:03 UTC] soenke dot ruempler at northclick dot de
Description:
------------
While iteratering over an Directory with SPL RecursiveDirectoryIterator, I get warnings:
PHP Warning: main(): stream does not support seeking in /home/soenke/tests/libssh.php on line 10
However, the example below seems to work.
Reproduce code:
---------------
<?php
$session = ssh2_connect('localhost', 22);
ssh2_auth_password($session, 'blub', 'xxxx');
$sftp = ssh2_sftp($session);
$remoteDir = 'ssh2.sftp://' . $sftp;
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($remoteDir . getcwd()));
foreach ($it as $e) {
echo $e->getFileName() . "\n";
}
Expected result:
----------------
libssh.php
Actual result:
--------------
PHP Warning: main(): stream does not support seeking in /home/soenke/tests/libssh.php on line 10
Warning: main(): stream does not support seeking in /home/soenke/tests/libssh.php on line 10
libssh.php
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 16:00:02 2025 UTC |
I've just had this same problem in PHP 8.1, in principle the code looks like so: $path = 'ftps://user:pass@host:21/htdocs'; $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST ); $items = iterator_to_array($iterator); // <- error thrown here Similar to the previous comment, I don't understand what's wrong or where rewind() is being triggered. Additionally, I don't know about ssh, but this is just listing files from ftp, which in my view, does not relate to ssh. On top of this, I also tried using `ftp://` instead and the same problem happened.