Gaufrette icon indicating copy to clipboard operation
Gaufrette copied to clipboard

Bug/Feature Request: Access violations not caught

Open jpalawaga opened this issue 12 years ago • 2 comments

Steps to reproduce:

Setup Gaufrette and configure a local adapter Configure it to write to any file in any place (say, foobar.txt), with any text (say, 'hello world!') and tell set overwrite to true.

Before writing executing the script, give ownership to a user of higher permission than you. In Unix, you can probably give it to root and be okay (provided you're not running as root, for some reason).

Attempt to execute the script.

What Happens:

PHP throws an permission denied error

What Should Happen:

...not that. Since this is FS abstraction, it becomes really difficult to write a writable() function without breaking the whole idea behind FS abstraction. Throwing of some sort of an exception if the file cannot be written would be excellent.

I understand the lib is still under intensive development, but this is certainly something that would be really nice to have.

jpalawaga avatar Jan 30 '13 00:01 jpalawaga

Any more news on this? It would be nice to be able to check if directories/files are readable & writeable. If i'm given some guidance on how to implement this, I'll give it a go :)

AydinHassan avatar Jun 10 '14 10:06 AydinHassan

@jpalawaga @AydinHassan I've just submitted #308, which allows for us to treat specific error situations like this on the adapter level and pass an exception above the execution.

drgomesp avatar Sep 25 '14 14:09 drgomesp

Hi @jpalawaga. Thank you for your issue. Gaufrette has been abandoned for several years and we at KNPLabs are trying to revive our open-source projects. This issue is almost 10 years old now and I'm going to close it due to its inactivity. Feel free to reopen it if you need to.

For your information, @akerouanton gave an answer here https://github.com/KnpLabs/Gaufrette/pull/308#issuecomment-172317631

PedroTroller avatar Apr 05 '23 13:04 PedroTroller