core
core copied to clipboard
Undefined index warning when restoring multiple files from trashbin
I see in the logs Undefined index: files at /var/www/owncloud/apps/files_trashbin/ajax/undelete.php#31 when using feature in trashbin that user can select multiple files and delete at once.
related: https://github.com/owncloud/enterprise/issues/5222#issuecomment-1190809708
@pmaier1 fyi comment from holger https://github.com/owncloud/enterprise/issues/5222#issuecomment-1191769523 , not sure how to handle the tracking for this and prio
@mrow4a we need some more information here
@NannaBarz what kind of information? This is warning that some variable is accessed but is not being set. Some code is out of sync on client and server. I did not see any other bug related to it, but it could lead to some problem (as is definition of warning)
@mrow4a wouldn't just be enough to check if the variable is set, like changing https://github.com/owncloud/core/blob/master/apps/files_trashbin/ajax/undelete.php#L31 to:
$files = isset($_POST['files']) ? $_POST['files'] : '';
I rather though on why it is there in a first place. Otherwise we could be curing broken leg with painkiller. Feels good but leg is still broken.
btw, moving https://github.com/owncloud/core/blob/master/apps/files_trashbin/ajax/undelete.php#L31 just before https://github.com/owncloud/core/blob/master/apps/files_trashbin/ajax/undelete.php#L52 seems to do the trick.
https://github.com/owncloud/core/blob/master/apps/files_trashbin/ajax/delete.php is implemented the same way.
@pako81 just a little bit dived, yes you are right. this would be the correct fix!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed.