diff --git a/include/class.file.php b/include/class.file.php index 2316301535b672fc4c8f6fc35283ba74bd3fc1cd..d4b24184c3a29994248efd620a3fb7961e91508c 100644 --- a/include/class.file.php +++ b/include/class.file.php @@ -389,11 +389,11 @@ class AttachmentFile extends VerySimpleModel { } } - if (!isset($file['data']) && isset($file['dataclb']) - && is_callable($file['dataclb'])) { + if (!isset($file['data']) && isset($file['data_cbk']) + && is_callable($file['data_cbk'])) { // Allow a callback function to delay or avoid reading or // fetching ihe file contents - $file['data'] = $file['dataclb'](); + $file['data'] = $file['data_cbk'](); } if (isset($file['data'])) { diff --git a/include/class.forms.php b/include/class.forms.php index 484be2059ad98083c614b24b2452d5fa587b1022..4e56c0f12c2ebddda36f0ae4c79543b2e2c6d750 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -3475,9 +3475,11 @@ class FileUploadField extends FormField { if (!$this->isValidFileType($file['name'], $file['type'])) throw new FileUploadError(__('File type is not allowed')); - if (is_callable($file['data'])) - $file['data'] = $file['data'](); - if (!isset($file['size'])) { + if (!isset($file['data']) && isset($file['data_cbk']) + && is_callable($file['data_cbk'])) + $file['data'] = $file['data_cbk'](); + + if (!isset($file['size']) && isset($file['data'])) { // bootstrap.php include a compat version of mb_strlen if (extension_loaded('mbstring')) $file['size'] = mb_strlen($file['data'], '8bit'); diff --git a/include/class.mailfetch.php b/include/class.mailfetch.php index d814d1d9fe6289aa20bf0747b84fb1b7aa9b6f62..77e5a6db0da4fc77f5e9ac601195fdf08c78a7b7 100644 --- a/include/class.mailfetch.php +++ b/include/class.mailfetch.php @@ -831,7 +831,7 @@ class MailFetcher { else { // only fetch the body if necessary $self = $this; - $file['dataclb'] = function() use ($self, $mid, $a) { + $file['data_cbk'] = function() use ($self, $mid, $a) { return $self->decode(imap_fetchbody($self->mbox, $mid, $a['index']), $a['encoding']); };