Comments (50)
@Purus I tried to reproduce this, but for me it worked just fine. Also when I convert my directory separators to windows-style. Are you sure the source directory listing contains files?
from flysystem.
Btw, another way to close the zip is this:
$zip->getAdapter()->getArchive()->close();
Though I think setting it to null is faster, at least in typing it is.
from flysystem.
Yes. The source contains folders and files. I have used realpaht() to convert OS specific paths too.
I am still struggling to make this work.
from flysystem.
Can you share the code that works for you? May be I can find what I am missing.
from flysystem.
Sure, it's this: http://bin.fuelphp.com/~uI
from flysystem.
@Purus ^ (off to bed now, will check again tomorrow)
from flysystem.
I will test this and let you know today when I get home from work.
from flysystem.
I can not make it to work.
Here is the snipped that I am trying. The dump for the $zip object lists all files from the zip file and not when using listcontents() function.
http://bin.fuelphp.com/snippet/view/uP
from flysystem.
@Purus it's a bit hard for me to debug this, by the looks of it, it might be a windows issue. Is there any more debugging you can do to find out what's going wrong?
from flysystem.
What makes me surprised is that, the dump of the $zip object shows all files and folders in the zip. But listcontent does not show that. I think this is not something related to Windows.
from flysystem.
@Purus the dump of the zip object is the cache object, so that's correct, that's not the dump of the adapter.
from flysystem.
Thanks. In that case, if we close the adaptor, shouldn't the zip file be created? Correct me if I am wrong.
from flysystem.
@Purus in theory it should and here it does. Are you sure the directory the zip is in is writable?
from flysystem.
Yes. The directory has writable access.
from flysystem.
@Purus can you var_dump the output of $zip->write
? This should indicate whether it is actually writing something.
from flysystem.
@Purus some more questions: What version are you using? Have you tried it with some other files in a small test-case?
from flysystem.
var_dump of $zip->write() return true for all the files in the loop.
My directory has only small files count.. Plz explain what you mean by small test-case.
BTW, I have tried the latest version too
from flysystem.
I think maybe there's a problem with PHP's ZipArchive class, maybe you could see what happens if you use it normally without Flysystem and check whether it has the same results?
from flysystem.
@Purus ^
from flysystem.
I am checking in other sytesms. Please give me some time.
from flysystem.
@Purus 👍
from flysystem.
Looks like WAMP has some problem loading php_zip.dll module..
Trying with XAMPP
from flysystem.
As mentioned, it was a bug with WAMP. I installed XAAMP and treid the above code. Now I get the below error.
The folder provided as input is present and have full access. Tried with both recursive as true and false.
Message: RecursiveDirectoryIterator::__construct(\\,\\): The filename, directory name, or volume label syntax is incorrect. (code: 123)
File: C:\xampp\htdocs\backup\classes\Flysystem\Adapter\Local.php
Line: 281
#0 C:\xampp\htdocs\backup\classes\Flysystem\Adapter\Local.php(281): RecursiveDirectoryIterator->__construct('\\', 4096)
#1 C:\xampp\htdocs\backup\classes\Flysystem\Adapter\Local.php(255): Flysystem\Adapter\Local->getRecursiveDirectoryIterator('\\')
#2 C:\xampp\htdocs\backup\classes\Flysystem\Adapter\Local.php(170): Flysystem\Adapter\Local->directoryContents('', true)
#3 C:\xampp\htdocs\backup\classes\Flysystem\Filesystem.php(359): Flysystem\Adapter\Local->listContents('', true)
#4 C:\xampp\htdocs\backup\controllers\admin.php(221): Flysystem\Filesystem->listContents('', true)
Also I get below warning too.
Message: mkdir(): Invalid argument
File: C:\xampp\htdocs\backup\classes\Flysystem\Adapter\Local.php
Line: 42
from flysystem.
Hi.. any luck on this Sir?
from flysystem.
@Purus I think the adapter needs to convert directory separators, I'll get a fix up in a couple of minutes.
from flysystem.
@Purus fix is pushed to convert /
to DIRECTORY_SEPARATOR
, this should fix that error.
from flysystem.
I tried again with the new version and still the same.
Message: DirectoryIterator::__construct(\\,\\): The filename, directory name, or volume label syntax is incorrect. (code: 123)
File: C:\xampp\htdocs\backup\classes\Flysystem\Adapter\Local.php
Line: 301
Trace:
#0 C:\xampp\htdocs\backup\classes\Flysystem\Adapter\Local.php(301): DirectoryIterator->__construct('\\')
#1 C:\xampp\htdocs\backup\classes\Flysystem\Adapter\Local.php(267): Flysystem\Adapter\Local->getDirectoryIterator('\\')
#2 C:\xampp\htdocs\backup\classes\Flysystem\Adapter\Local.php(182): Flysystem\Adapter\Local->directoryContents('', false)
#3 C:\xampp\htdocs\backup\classes\Flysystem\Filesystem.php(374): Flysystem\Adapter\Local->listContents('', false)
#4 C:\xampp\htdocs\backup\controllers\admin.php(221): Flysystem\Filesystem->listContents('', false)
from flysystem.
I see that ther is a difference between old error and new error on construct() line
from flysystem.
@Purus this looks to be a non-php issue: http://support.microsoft.com/kb/318746
from flysystem.
@Purus what is the code leading up to this error?
from flysystem.
listContents('', false) is the one. You can know the trace from bottom of the above error message.
from flysystem.
@Purus what did you specify as the root? Seems like that's the problem if I read the issue on the microsoft help page.
from flysystem.
I am referring a local folder as below.
$local = new Filesystem(new Local("C:\wamp\watermark"));
from flysystem.
@Purus can you check what happens when you do:
$dir = new DirectoryIterator("C:\wamp\watermark");
foreach ($dir as $fileinfo) {
if (!$fileinfo->isDot()) {
var_dump($fileinfo->getFilename());
}
}
from flysystem.
Sure. I will check that and let you know when I get home from work.
from flysystem.
@Purus cool, hopefully we're close to killing this bug now!
from flysystem.
Sure you will. Thanks a lot for this good script.
from flysystem.
The above code that you provided failed with "Invalid directory" error for
$dir = new DirectoryIterator("C:\wamp\watermark");
But the below worked by giving out the file names in that folder. Note the double slash.
$dir = new DirectoryIterator("C:\wamp\watermark");
I tried the same for the first code I shared. But did not work. Same issue as before.
from flysystem.
Note, above "double" slash // does not display
from flysystem.
Hope you got the point and the issue related to it.
from flysystem.
@Purus what if you just did single quotes? Or do it with the double (thus escaped) slashes?
from flysystem.
I think you got me wrong. What I meant is if I use the "c: \ " instead of "c : " DirectoryIterator works. I have added spaces between the chars as GitHub removes double slashes..
from flysystem.
@Purus and when you use the double backslash with Flysystem? Does it work?
from flysystem.
Using double backslash works when used with DirectoryIterator. But not when used with the code that I posted in the first message of this post. Local class works even without the double backslash... but the Zip output is empty as per my first message here.
from flysystem.
Then this seems to be a problem PHP has with windows and the double slashed should be used. This is not something I can fix in the package.
from flysystem.
Sorry... I don't think so.. In the past I have used some other packages and they work. If you want me to test some code chunks for you, I can test and let you know.
from flysystem.
There's not much I can do to help here. I don't own a PC and I've run out of suggestions.
from flysystem.
Ok.. Thanks for your help on this.
from flysystem.
@Purus mind if I close this issue? If there are new idea's for this a new issue can be opened.
from flysystem.
Hi.. never mind. Let me close this.
from flysystem.
Related Issues (20)
- Copy from remote URL to a filesystem HOT 4
- Allow public Storage::getAdapter() to get the storage adapter HOT 3
- Error installing in Laravel 10 with sail/Docker and composer HOT 1
- async-aws-s3 adapter - send pre-calculated checksum
- Implement touch HOT 2
- ChainWriter filesystem HOT 9
- deleteDirectory does not delete directories reliably in NFS environments
- Ability to close SFTP connection on demand
- $config in AwsS3V3Adapter copy function is null/empty HOT 1
- Can't get list of files on directory with FTP adapter in PHP 8.3 HOT 1
- Local adapter private directory visibility HOT 5
- Adding and ensuring more dedicated tests HOT 1
- Strpos result comparison HOT 1
- MountManager does not transfer configs other than visibility when copying across filesystems
- documentation - aws - ListObjects privileges seems no longer exists HOT 1
- "invalid size" error in SftpAdapter after upgrading to 3.25 HOT 6
- Error Message: Unable to list contents for '', shallow listing HOT 3
- SimpleConnectivityChecker causes unexpected behavior when use the ping method to check connectivity HOT 1
- How can i get one element on listContent?
- Batch interface HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flysystem.