Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#41216 closed defect (bug) (fixed)

Avoid using 'http://localhost/foo-cropped.png' in tests

Reported by: danielbachhuber's profile danielbachhuber Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.9 Priority: normal
Severity: normal Version:
Component: Media Keywords: has-patch
Focuses: Cc:


Two image header tests use a http://localhost/foo-cropped.png value:

  • Tests_Image_Header::test_create_attachment_object
  • Tests_Image_Header::test_insert_cropped_attachment

In some system configurations, this can cause ImageMagick to throw an exception:

ImagickException: getimagesize(http://localhost/foo-cropped.png): failed to open stream: Connection refused

This was originally added in r27847. In skimming through #21785, it doesn't appear to be a deliberate decision to use http://localhost/foo-cropped.png. It would be better to use a value that doesn't trigger an outbound HTTP request.

Attachments (1)

41216.1.diff (1.6 KB) - added by danielbachhuber 7 years ago.

Download all attachments as: .zip

Change History (9)

#1 @danielbachhuber
7 years ago

41216.1.diff updates the tests to use foo-cropped.png instead of http://localhost/foo-cropped.php, and corrects the order of arguments passed to assertions.

This ticket was mentioned in Slack in #hosting-community by danielbachhuber. View the logs.

7 years ago

#3 @desrosj
7 years ago

  • Keywords has-patch added; needs-patch removed

#4 @SergeyBiryukov
7 years ago

  • Milestone changed from Awaiting Review to 4.9

#5 @SergeyBiryukov
7 years ago

In 41016:

Media: Correct the order of arguments passed to assertions in Tests_Image_Header.

Props danielbachhuber.
See #41216.

#6 @SergeyBiryukov
7 years ago

I think the GUID should remain a URL, otherwise it gets sanitized to an invalid URL: http://foo-cropped.png.

#7 @SergeyBiryukov
7 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 41017:

Media: Use a filename instead of a URL in image header tests to avoid triggering an outbound HTTP request causing an ImageMagick exception on some configurations.

Props danielbachhuber.
Fixes #41216.

#8 @ocean90
6 years ago

#36589 was marked as a duplicate.

Note: See TracTickets for help on using tickets.