[wp-trac] [WordPress Trac] #26155: Tests_Image_Functions failures

WordPress Trac noreply at wordpress.org
Thu Dec 5 23:17:14 UTC 2013


#26155: Tests_Image_Functions failures
----------------------------+-----------------------------
 Reporter:  SergeyBiryukov  |       Owner:  SergeyBiryukov
     Type:  defect (bug)    |      Status:  reopened
 Priority:  normal          |   Milestone:  3.8
Component:  Unit Tests      |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |
----------------------------+-----------------------------
Changes (by bpetty):

 * cc: bpetty (added)
 * keywords:  has-patch commit => has-patch
 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 These tests still continue to fail under many PHP 5.2 environments
 (including Travis).

 The tests are there to ensure the files saved using the appropriate image
 format, and it actually turns out that they have (as run under one of
 these environments):

 {{{
 $ file /tmp/1386267844.jpg
 /tmp/1386267844.jpg: JPEG image data, JFIF standard 1.01, comment:
 "CREATOR: gd-jpeg v1.0 (using IJ"
 }}}

 `Tests_Image_Functions::get_mime_type()` relies on either the `fileinfo`
 extension (which was only built into PHP by default in 5.3+), or uses
 [http://us2.php.net/mime_content_type mime_content_type()] to take a stab
 at guessing what it is. The latter is what is being used in these 5.2
 configurations.

 However, using `mime_content_type()` requires that the
 [http://us2.php.net/manual/en/mime-magic.configuration.php
 mime_magic.magicfile] INI setting has been configured with a hacked up
 version of "magic.mime". This file is loosely based on libmagic format,
 but PHP never supported the full format, you can find an old incomplete
 version in [https://github.com/php/php-
 src/blob/PHP-5.2/ext/mime_magic/tests/magic.mime mime_magic's unit tests],
 do not confuse this with Apache's mime.type file.

 Anyway, this INI setting and magic file is not distributed or configured
 with PHP 5.2 by default, and this is why these tests fail in those
 environments.

 The fact that a file was still saved with the appropriate file extension
 is probably a good enough test here, and we actually have a few other unit
 tests that still check that, so I'm just suggesting we skip attempting to
 use the `mime_content_type()` at all for these tests in
 [attachment:ticket-26155-php52-mime.patch]. This just effectively skips
 the tests on PHP 5.2.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/26155#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list