#30394 closed defect (bug) (fixed)
Multiple edits with IMAGE_EDIT_OVERWRITE define enabled causes deletion of images
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.2 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Media | Keywords: | has-patch |
Focuses: | Cc: |
Description (last modified by )
The update_attached_file()
call in wp_save_image()
(wp-admin/includes/image-edit.php
) fails when IMAGE_EDIT_OVERWRITE is enabled because the underlying update_meta_value()
call has a meta_value
(file path) that matches the value already in the DB.
$success = update_attached_file( $post_id, $new_path );
The failure there leads to subsequent file deletion at the end of wp_save_image()
.
@unlink( $delpath );
Likely related in some way: #30167
Attachments (3)
Change History (9)
#1
@
9 years ago
Steps to reproduce:
- Set IMAGE_EDIT_OVERWRITE to true.
- Upload a new image.
- Edit the image and scale it once.
- Scale it again.
- The image should now be broken. If you check the file system while doing this, you should see the creation of an edit image file upon first scale and then deletion of it when you scale the second time.
#2
@
9 years ago
BTW, it's a little flaky as I play with it but it shouldn't be limited to just scaling operations. Cropping, rotating, etc seem to accomplish much of the same thing.
Anything that calls that update_meta_value()
with the same
meta_value
.
#3
@
9 years ago
Took another brief look at this tonight with less brain fuzzies. The first stab was a little silly; patch2 seems much saner.
#4
@
9 years ago
- Description modified (diff)
- Keywords has-patch added
- Milestone changed from Awaiting Review to Future Release
Poor man's attempt at a fix