In file_save_upload(), a foreach loop contains a switch statement that in turn has 'continue' after each case. My understanding is that 'continue' in this context means the same as 'break', and if that is what is meant then it should be written thus.
Note: In PHP the switch statement is considered a looping structure for the purposes of continue. continue behaves like break (when no arguments are passed). If a switch is inside a loop, continue 2 will continue with the next iteration of the outer loop.
http://php.net/manual/en/control-structures.continue.php
If 'continue' was actually meant to move on to the next 'foreach' item (which seems very likely in this case), then 'continue 2;' or perhaps a 'return' of some sort is needed and this is a bug: it would appear this loop is checking conditions on files in preparation for saving them, and simply breaking the switch means bad files are being manipulated.
An extract of the code starting line 742:
foreach ($uploaded_files as $i => $file_info) {
// Check for file upload errors and return FALSE for this file if a lower
// level system error occurred. For a complete list of errors:
// See http://php.net/manual/features.file-upload.errors.php.
switch ($file_info->getError()) {
case UPLOAD_ERR_INI_SIZE:
case UPLOAD_ERR_FORM_SIZE:
drupal_set_message(t('The file %file could not be saved because it exceeds %maxsize, the maximum allowed size for uploads.', array('%file' => $file_info->getFilename(), '%maxsize' => format_size(file_upload_max_size()))), 'error');
$files[$i] = FALSE;
continue;
case UPLOAD_ERR_PARTIAL:
...[snip]...
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | 2833099-10.patch | 1.36 KB | joshua.boltz |
Comments
Comment #2
rivimeyComment #3
cilefen commentedComment #8
steinmb commentedComment #9
alexpottThis will be fixed in #2989734: PHP 7.3 compatibility
Comment #10
joshua.boltz commentedAttached quick, simple patch that removes the warnings due to PHP 7.3 and the continue/switch statements.