[wp-trac] [WordPress Trac] #42064: wp_crop_image() does not work when fopen() is disabled
WordPress Trac
noreply at wordpress.org
Mon Oct 2 19:10:09 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 | Keywords:
Focuses: |
--------------------------+-----------------------------
While running the WordPress PHP Unit testing framework, a single test for
wp_crop_image() failed consistently. After @danielbachhuber debugged the
test, he found that wp_crop_image() was failing because it depended on
_load_image_to_edit_path, which he said is dependent on fopen(). WordPress
is supposed to function when fopen() is disabled. wp_crop_image's
dependency on fopen is incorrect.
To reproduce the issue:
Disable allow_url_fopen in PHP
Setup the PHPUnit Test Runner (https://github.com/WordPress/phpunit-test-
runner)
Run the PHPUnit Test Runner.
The test runner should report the following failed test:
Tests_Image_Functions::test_wp_crop_image_url Failed asserting that
WP_Error Object (...) is not an instance of class "WP_Error".
/../../../phpunit-test-runner/wp-test-
runner/tests/phpunit/tests/image/functions.php:317
The WP_Error object reports the following:
Fobject(WP_Error)#9993 (2) {
["errors"]=>
array(1) {
["invalid_image"]=>
array(1) {
[0]=>
string(21) "File is not an image."
}
}
["error_data"]=>
array(1) {
["invalid_image"]=>
string(60)
"https://asdftestblog1.files.wordpress.com/2008/04/canola.jpg"
}
}
The image is a valid image otherwise, such as when viewed through the
browser. The test fails on PHP 5.6, PHP 7.0, and PHP 7.1 when fopen is
disabled.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42064>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list