kbsali / php-redmine-api

A simple PHP Redmine API client, Object Oriented

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uploads: is_file(): File name is longer than the maximum allowed path length on this platform (4096)

Commifreak opened this issue · comments

When I try to upload binary files, I get the message:

yii\base\ErrorException: is_file(): File name is longer than the maximum allowed path length on this platform (4096): MZ������@������	�!��L�!This program cannot be run in DOS mode.

$�1��P���P���P��*_���P���P��OP��*_���P�ҽs���P��.V���P��Rich�P��PEL��1�MX������b*���2��@����������U��@��������� �h��@hU�`5���.text�`�b� `.rdata����f@@.data�����z@�.ndatap�����.rsrch�� ����@@U���\�}�t+�}F�E�u
.......

Stack:

Stack trace:
#0 /var/www/dev.fopro-plus.jki.intern/robin/vendor/kbsali/redmine-api/src/Redmine/Client.php(670): yii\web\ErrorHandler->handleError('2', ''is_file(): Fil...', ''/var/www/dev.f...', '670', '['path' => '/up...')
#1 /var/www/dev.fopro-plus.jki.intern/robin/vendor/kbsali/redmine-api/src/Redmine/Client.php(670): ::is_file(''MZ\x90\\003\\004\xFF\xFF\xB8...')
#2 /var/www/dev.fopro-plus.jki.intern/robin/vendor/kbsali/redmine-api/src/Redmine/Client.php(641): Redmine\Client->isUploadCall(''/uploads.json?...', ''MZ\x90\\000\\003\\00...')
#3 /var/www/dev.fopro-plus.jki.intern/robin/vendor/kbsali/redmine-api/src/Redmine/Client.php(754): Redmine\Client->prepareRequest(''/uploads.json?...', ''POST'', ''MZ\x90\\000\\003\\00...')
#4 /var/www/dev.fopro-plus.jki.intern/robin/vendor/kbsali/redmine-api/src/Redmine/Client.php(306): Redmine\Client->runRequest(''/uploads.json?...', ''POST'', ''MZ\x90\\000\\003\\00...')
#5 /var/www/dev.fopro-plus.jki.intern/robin/vendor/kbsali/redmine-api/src/Redmine/Client.php(200): Redmine\Client->post(''/uploads.json?...', ''MZ\x90\\000\\003\\00...')
#6 /var/www/dev.fopro-plus.jki.intern/robin/vendor/kbsali/redmine-api/src/Redmine/Api/AbstractApi.php(79): Redmine\Client->requestPost(''/uploads.json?...', ''MZ\x90\\000\\003\\00...')
#7 /var/www/dev.fopro-plus.jki.intern/robin/vendor/kbsali/redmine-api/src/Redmine/Api/Attachment.php(54): Redmine\Api\Attachment->post(''/uploads.json?...', ''MZ\x90\\000\\003\\00...')
#8 /var/www/dev.fopro-plus.jki.intern/robin/vendor/jki/yii2-proma/controllers/PromaController.php(70): Redmine\Api\Attachment->upload(''MZ\x90\\000\\003\\00...', '???')

is_file seems to not be liking the raw content??

Any ideas?

Using: v1.7.0

It turns out, that ->upload does not take the CONTENT or any DATA!
It has to be the FILEPATH! That isnt well documented...

Hey @Commifreak thank you for this issue.

The upload() method could be a path or the data. is_file() is using to determine between a content and a filepath. But the error shows, that is_file() throws an error if the content is to large.

See https://www.php.net/manual/en/function.is-file.php

Note: Because PHP's integer type is signed and many platforms use 32bit integers, some filesystem functions may return unexpected results for files which are larger than 2GB.

So we should find a way to check for content or filepath in better way. I reopen this issue as a bug.