Opened 10 years ago
Closed 10 years ago
#31124 closed defect (bug) (fixed)
PHP unit tests fail with fatal error, imagecreatefrompng() not defined
Reported by: | iseulde | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 4.2 | Priority: | normal |
Severity: | normal | Version: | 4.2 |
Component: | Media | Keywords: | |
Focuses: | Cc: |
Description
PHP Fatal error: Call to undefined function imagecreatefrompng() in .../wp/svn/trunk/tests/phpunit/tests/image/editor_gd.php on line 510
Change History (12)
This ticket was mentioned in Slack in #core by iseulde. View the logs.
10 years ago
#2
@
10 years ago
- Component changed from General to Media
- Milestone changed from Awaiting Review to 4.2
#4
follow-up:
↓ 5
@
10 years ago
- Keywords reporter-feedback added
Odd. You should only get that message if the PHP GD extension isn't installed. But the test suite should detect that it's not installed and skip the tests. So I'm not sure what's happening.
Do you have GD installed? $ php -i | grep "with\-gd"
#5
in reply to:
↑ 4
@
10 years ago
Replying to boonebgorges:
Odd. You should only get that message if the PHP GD extension isn't installed.
I think it's possible for GD to be installed without PNG support.
#6
@
10 years ago
According to http://php.net/manual/en/image.installation.php it does seem like you have to enable png support when compiling.
We can check if PNG support is enabled with something like
$arr = gd_info(); if ( $arr['PNG Support'] === true ) { // do stuff }
to determine whether PNG tests should be run or not.
#7
@
10 years ago
Thanks, SergeyBiryukov and voldemortensen.
As you note, it's easy enough to do set this flag in the unit tests, but first I want to be sure that this isn't exposing a core bug. Are we doing the necessary checks in core to avoid png conversion? Or does the situation simply not arise if PNG support is not compiled with PHP?
#8
@
10 years ago
I haven't dug deep into everything to make sure all cases are covered, but anything using _wp_image_editor_choose has the mime type check in it. https://core.trac.wordpress.org/browser/trunk/src/wp-includes/media.php#L2491
#9
@
10 years ago
- Keywords reporter-feedback removed
Sorry for the late reply, for some reason I'm not getting Trac emails.
Here's the output:
Configure Command => '/BinaryCache/apache_mod_php/apache_mod_php-93~55/Objects/php/configure' '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--sysconfdir=/private/etc' '--with-apxs2=/usr/sbin/apxs' '--enable-cli' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/Library/Server/Web/Config/php' '--with-libxml-dir=/usr' '--with-openssl=/usr' '--with-kerberos=/usr' '--with-zlib=/usr' '--enable-bcmath' '--with-bz2=/usr' '--enable-calendar' '--disable-cgi' '--with-curl=/usr' '--enable-dba' '--with-ndbm=/usr' '--enable-exif' '--enable-fpm' '--enable-ftp' '--with-png-dir=no' '--with-gd' '--with-jpeg-dir=/BinaryCache/apache_mod_php/apache_mod_php-93~55/Root/usr/local' '--enable-gd-native-ttf' '--with-icu-dir=/usr' '--with-ldap=/usr' '--with-ldap-sasl=/usr' '--with-libedit=/usr' '--enable-mbstring' '--enable-mbregex' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--without-pear' '--with-pear=no' '--with-pdo-mysql=mysqlnd' '--with-mysql-sock=/var/mysql/mysql.sock' '--with-readline=/usr' '--enable-shmop' '--with-snmp=/usr' '--enable-soap' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--with-tidy' '--enable-wddx' '--with-xmlrpc' '--with-iconv-dir=/usr' '--with-xsl=/usr' '--enable-zend-multibyte' '--enable-zip' '--with-pcre-regex=/usr'
#11
@
10 years ago
Looking more into this, it appears that we're only using imagecreatefrompng()
to set up some test fixtures. We don't use the function in this way in core, and in the related places in core that do manipulate pngs, there are appropriate function_exists()
checks. So I think we can just fix this in the tests.
Here are all the tests that fail and are related: