-
Notifications
You must be signed in to change notification settings - Fork 254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix beforeMarshall if file uploads are array #588
Conversation
Codecov Report
@@ Coverage Diff @@
## master #588 +/- ##
============================================
- Coverage 95.68% 95.50% -0.18%
- Complexity 108 109 +1
============================================
Files 11 11
Lines 278 267 -11
============================================
- Hits 266 255 -11
Misses 12 12
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
A few small bits to tidy up. |
Done! |
You have some build failures still to address, looking at the pipeline |
return array_map( | ||
fn(UploadedFileInterface $file) => [ | ||
'tmp_name' => '', | ||
'error' => $file->getError(), | ||
'name' => $file->getClientFilename(), | ||
'type' => $file->getClientMediaType(), | ||
'size' => $file->getSize(), | ||
], | ||
$data | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parse error: syntax error, unexpected '$file' (T_VARIABLE), expecting ',' or ')' in /home/runner/work/cakephp-upload/cakephp-upload/tests/TestCase/Model/Behavior/UploadBehaviorTest.php on line 805
To fix the above error:
return array_map( | |
fn(UploadedFileInterface $file) => [ | |
'tmp_name' => '', | |
'error' => $file->getError(), | |
'name' => $file->getClientFilename(), | |
'type' => $file->getClientMediaType(), | |
'size' => $file->getSize(), | |
], | |
$data | |
); | |
} | |
return array_map( | |
function (UploadedFileInterface $file) { | |
return [ | |
'tmp_name' => '', | |
'error' => $file->getError(), | |
'name' => $file->getClientFilename(), | |
'type' => $file->getClientMediaType(), | |
'size' => $file->getSize(), | |
]; | |
}, | |
$data | |
); | |
} |
@albertcansado the code needs to have PHP 7.2 compat as it needs to keep CakePHP 4.x before 4.4 compatibility. Line 19 in 878cba2
@TerryKern's changes take care of that. |
Fix error "Call to a member function getError() on array" when uploaded file is an array.