Editor PHP Multiple Upload Fields

Editor PHP Multiple Upload Fields

arboraustarboraust Posts: 1Questions: 0Answers: 0

When using two or more upload fields with the Editor PHP library there is an issue where only some or none of the file data is returned. This happens when one of the fields is set to null.

After some digging I have found the issue in the _fileDataFields method of Editor.php.

if ( count($ids) === 0 ) {
    // If no data to fetch, then don't bother
    return;
}

This should continue not return as returning on a field with no data means the following fields are not processed.
Issue is in 1.9.6 and 2.0.4.

Replies

  • allanallan Posts: 54,909Questions: 1Answers: 8,606 Site admin

    Many thanks for flagging this up to me!

    I think the error in the method actually goes a little deeper than that while I was looking at it. The $ids is getting modified inside the loop and reused, which is not good. I've committed a change that combines your own with with better handling of that.

    Regards,
    Allan

Sign In or Register to comment.