[wp-trac] [WordPress Trac] #35959: Functon 'wp_generate_attachment_metadata(...)' silently swallowing errors from 'wp_get_image_editor(...)'.
WordPress Trac
noreply at wordpress.org
Sun Nov 12 19:47:35 UTC 2017
#35959: Functon 'wp_generate_attachment_metadata(...)' silently swallowing errors
from 'wp_get_image_editor(...)'.
-------------------------------------+------------------------------
Reporter: maratbn | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: 3.5
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses:
-------------------------------------+------------------------------
Changes (by grapplerulrich):
* keywords: has-patch needs-refresh needs-testing => has-patch needs-
testing
Comment:
The attached patch should fix the issue.
I realized this problem with `wp media regenerate 892` would not work on
PDF. When running `wp eval
"var_dump(wp_generate_attachment_metadata(892,get_attached_file(892)));"`
I would get an empty array which did not make sense.
With the patch when I run `wp eval
"var_dump(wp_generate_attachment_metadata(892,get_attached_file(892)));"`
I get
{{{
object(WP_Error)#11341 (2) {
["errors"]=>
array(1) {
["image_no_editor"]=>
array(1) {
[0]=>
string(41) "No editor could be selected."
}
}
["error_data"]=>
array(0) {
}
}
}}}
Or for `wp media regenerate 892`
{{{
Found 1 image to regenerate.
Warning: No editor could be selected.
Error: No images regenerated.
}}}
The patch also makes sure that `$uploaded = $editor->save( $preview_file,
'image/jpeg' );` does not fail silently too. Though I have not been able
to test this.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35959#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list