file icon indicating copy to clipboard operation
file copied to clipboard

Permission Error Writing a file on Windows 10 & PHP 7.4

Open teleclient opened this issue 5 years ago • 12 comments

The same error happens, no matter what the permissions are.
The same exact code works fine under Linux.


Exception: fwrite(): write of 8192 bytes failed with errno=13 Permission denied in BlockingFile.php:66

Previous TL trace: exceptionErrorHandler() BlockingFile.php(66): fwrite() Files.php(1153): write()

teleclient avatar Feb 18 '20 09:02 teleclient

Same here: https://del.dog/uthobinaca.txt

Pato05 avatar Apr 13 '20 20:04 Pato05

I also have this problem, no solution yet?

valery-lavrik avatar Feb 09 '21 12:02 valery-lavrik

image

Failed writing to file handle: fwrite(): write of 8192 bytes failed with errno=13 Permission denied

valery-lavrik avatar Feb 09 '21 12:02 valery-lavrik

Does it work without amphp/file?

kelunik avatar Feb 09 '21 18:02 kelunik

image Oh sure. I tried to reproduce this example, it worked great Can fopen() open in the wrong mode?

valery-lavrik avatar Feb 10 '21 05:02 valery-lavrik

Yes, maybe that's the case. How do you open the file?

kelunik avatar Feb 10 '21 07:02 kelunik

I don't know, this is not my library. I just use it and find it breaks at this point. And I have no idea why ...

valery-lavrik avatar Feb 10 '21 07:02 valery-lavrik

Can the developer of this library tell me? @amphp-bot

valery-lavrik avatar Feb 10 '21 07:02 valery-lavrik

Not within the library, but rather how you use the library to open the file. Please post a full example to reproduce the issue.

kelunik avatar Feb 10 '21 08:02 kelunik

Issue happens in \Amp\File\BlockingFile::write, which used in MadelineProto downloadTo* methods

I think trace should be like this:

  1. https://github.com/danog/MadelineProto/blob/06bc28e093a238591e9983e6110f1e3f871931be/src/danog/MadelineProto/MTProtoTools/Files.php#L801
  2. https://github.com/danog/MadelineProto/blob/d31b798df9347022a06026c18a012bc39762537d/src/danog/MadelineProto/MTProtoTools/FilesLogic.php#L101
  3. https://github.com/danog/MadelineProto/blob/d31b798df9347022a06026c18a012bc39762537d/src/danog/MadelineProto/MTProtoTools/FilesLogic.php#L129

xtrime-ru avatar Feb 16 '21 21:02 xtrime-ru

Yes, maybe that's the case. How do you open the file?

https://github.com/danog/MadelineProto/blob/06bc28e093a238591e9983e6110f1e3f871931be/src/danog/MadelineProto/MTProtoTools/Files.php#L815

xtrime-ru avatar Feb 16 '21 21:02 xtrime-ru

i love you

phonesorvixay avatar Feb 23 '22 10:02 phonesorvixay