[wp-trac] [WordPress Trac] #42064: wp_crop_image() does not work when fopen() is disabled

WordPress Trac noreply at wordpress.org
Mon Oct 16 13:57:47 UTC 2017


#42064: wp_crop_image() does not work when fopen() is disabled
--------------------------+------------------------------
 Reporter:  jadonn        |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by danielbachhuber):

 Related: https://core.trac.wordpress.org/ticket/37681#comment:1

 > It appears to be hit if you're editing an image which was uploaded
 pre-2.7 and/or if the file metadata has gone missing. In that case, the
 image editors will treat the image URL as the source image through the
 filesystem wrappers, bypassing `wp_remote_get()`, which is why the `fopen`
 and `allow_url_fopen` are there.

 Originally committed in r20384

 I see a couple of options:

 1. Use `download_url()` to download a copy of the image to `/tmp`, and
 permit image modifications from that.
     * Advantage: Greater cross-platform compatibility for this feature.
     * Disadvantage: Web server has a potentially duplicate copy of the
 image on the filesystem (which is likely inconsequential).
 2. Mark `Tests_Image_Functions::test_wp_crop_image_url` as skipped when
 `fopen` isn't available or `allow_url_fopen` is false.
     * Advantage: Least risky approach.
     * Disadvantage: Adds yet another skipped test to the test suite.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42064#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list