Code Monkey home page Code Monkey logo

Comments (50)

frankdejonge avatar frankdejonge commented on May 18, 2024

@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.

frankdejonge avatar frankdejonge commented on May 18, 2024

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.

Purus avatar Purus commented on May 18, 2024

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.

Purus avatar Purus commented on May 18, 2024

Can you share the code that works for you? May be I can find what I am missing.

from flysystem.

frankdejonge avatar frankdejonge commented on May 18, 2024

Sure, it's this: http://bin.fuelphp.com/~uI

from flysystem.

frankdejonge avatar frankdejonge commented on May 18, 2024

@Purus ^ (off to bed now, will check again tomorrow)

from flysystem.

Purus avatar Purus commented on May 18, 2024

I will test this and let you know today when I get home from work.

from flysystem.

Purus avatar Purus commented on May 18, 2024

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.

frankdejonge avatar frankdejonge commented on May 18, 2024

@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.

Purus avatar Purus commented on May 18, 2024

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.

frankdejonge avatar frankdejonge commented on May 18, 2024

@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.

Purus avatar Purus commented on May 18, 2024

Thanks. In that case, if we close the adaptor, shouldn't the zip file be created? Correct me if I am wrong.

from flysystem.

frankdejonge avatar frankdejonge commented on May 18, 2024

@Purus in theory it should and here it does. Are you sure the directory the zip is in is writable?

from flysystem.

Purus avatar Purus commented on May 18, 2024

Yes. The directory has writable access.

from flysystem.

frankdejonge avatar frankdejonge commented on May 18, 2024

@Purus can you var_dump the output of $zip->write? This should indicate whether it is actually writing something.

from flysystem.

frankdejonge avatar frankdejonge commented on May 18, 2024

@Purus some more questions: What version are you using? Have you tried it with some other files in a small test-case?

from flysystem.

Purus avatar Purus commented on May 18, 2024

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.

frankdejonge avatar frankdejonge commented on May 18, 2024

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.

frankdejonge avatar frankdejonge commented on May 18, 2024

@Purus ^

from flysystem.

Purus avatar Purus commented on May 18, 2024

I am checking in other sytesms. Please give me some time.

from flysystem.

frankdejonge avatar frankdejonge commented on May 18, 2024

@Purus 👍

from flysystem.

Purus avatar Purus commented on May 18, 2024

Looks like WAMP has some problem loading php_zip.dll module..

Trying with XAMPP

from flysystem.

Purus avatar Purus commented on May 18, 2024

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.

Purus avatar Purus commented on May 18, 2024

Hi.. any luck on this Sir?

from flysystem.

frankdejonge avatar frankdejonge commented on May 18, 2024

@Purus I think the adapter needs to convert directory separators, I'll get a fix up in a couple of minutes.

from flysystem.

frankdejonge avatar frankdejonge commented on May 18, 2024

@Purus fix is pushed to convert / to DIRECTORY_SEPARATOR, this should fix that error.

from flysystem.

Purus avatar Purus commented on May 18, 2024

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.

Purus avatar Purus commented on May 18, 2024

I see that ther is a difference between old error and new error on construct() line

from flysystem.

frankdejonge avatar frankdejonge commented on May 18, 2024

@Purus this looks to be a non-php issue: http://support.microsoft.com/kb/318746

from flysystem.

frankdejonge avatar frankdejonge commented on May 18, 2024

@Purus what is the code leading up to this error?

from flysystem.

Purus avatar Purus commented on May 18, 2024

listContents('', false) is the one. You can know the trace from bottom of the above error message.

from flysystem.

frankdejonge avatar frankdejonge commented on May 18, 2024

@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.

Purus avatar Purus commented on May 18, 2024

I am referring a local folder as below.

$local = new Filesystem(new Local("C:\wamp\watermark"));

from flysystem.

frankdejonge avatar frankdejonge commented on May 18, 2024

@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.

Purus avatar Purus commented on May 18, 2024

Sure. I will check that and let you know when I get home from work.

from flysystem.

frankdejonge avatar frankdejonge commented on May 18, 2024

@Purus cool, hopefully we're close to killing this bug now!

from flysystem.

Purus avatar Purus commented on May 18, 2024

Sure you will. Thanks a lot for this good script.

from flysystem.

Purus avatar Purus commented on May 18, 2024

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.

Purus avatar Purus commented on May 18, 2024

Note, above "double" slash // does not display

from flysystem.

Purus avatar Purus commented on May 18, 2024

Hope you got the point and the issue related to it.

from flysystem.

frankdejonge avatar frankdejonge commented on May 18, 2024

@Purus what if you just did single quotes? Or do it with the double (thus escaped) slashes?

from flysystem.

Purus avatar Purus commented on May 18, 2024

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.

frankdejonge avatar frankdejonge commented on May 18, 2024

@Purus and when you use the double backslash with Flysystem? Does it work?

from flysystem.

Purus avatar Purus commented on May 18, 2024

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.

frankdejonge avatar frankdejonge commented on May 18, 2024

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.

Purus avatar Purus commented on May 18, 2024

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.

frankdejonge avatar frankdejonge commented on May 18, 2024

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.

Purus avatar Purus commented on May 18, 2024

Ok.. Thanks for your help on this.

from flysystem.

frankdejonge avatar frankdejonge commented on May 18, 2024

@Purus mind if I close this issue? If there are new idea's for this a new issue can be opened.

from flysystem.

Purus avatar Purus commented on May 18, 2024

Hi.. never mind. Let me close this.

from flysystem.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.