Bug #66204 [Com]: disabling XPM support in GD still enables gdImageCreateFromXpm() for PHP

From: Date: Fri, 24 May 2019 18:00:41 +0000
Subject: Bug #66204 [Com]: disabling XPM support in GD still enables gdImageCreateFromXpm() for PHP
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-220983@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66204&edit=1

 ID:                 66204
 Comment by:         admin at inwebse dot com
 Reported by:        rob dot de dot langhe at twistfare dot be
 Summary:            disabling XPM support in GD still enables
                     gdImageCreateFromXpm() for PHP
 Status:             Not a bug
 Type:               Bug
 Package:            GD related
 Operating System:   Solaris-10
 PHP Version:        5.5.6
 Block user comment: N
 Private report:     N

 New Comment:

Up. Problem is still here. PHP version is 7.3.5.


Previous Comments:
------------------------------------------------------------------------
[2015-07-07 02:58:59] uncle dot ziba at gmail dot com

Ran into this as well with version 5.6.10 on AIX.  I wonder if there is a more reliable way for the
configure script to determine if the GD library has xmp support.

workaround in  the main/php_config.h comment out:

#define HAVE_GD_XPM 1

make clean; make

------------------------------------------------------------------------
[2015-06-20 00:27:50] iggyvolz at gmail dot com

This bug is still in PHP - it is impossible to install with GD without libXpm, as PHP will always
report that it is installed even if it is not.  My workaround was to edit ext/gd/gd.c and remove all
code that depended on HAVE_GD_XPM.

------------------------------------------------------------------------
[2013-11-30 13:02:38] rob dot de dot langhe at twistfare dot be

If you consider this not to be a bug, where do you want me to report this (at least incorrect)
behaviour ?

------------------------------------------------------------------------
[2013-11-29 17:29:59] pajoye@php.net

right, but you get the error in userland too.

------------------------------------------------------------------------
[2013-11-29 16:08:43] rob dot de dot langhe at twistfare dot be

The "libgd" library will apparently always contain a function
"gdImageCreateFromXpm()", but which will return an error when it is called in case the
building of "libgd" was done with "--with-xpm=no" :

in ./src/gdxpm.c :
...
#ifndef HAVE_LIBXPM
BGD_DECLARE(gdImagePtr) gdImageCreateFromXpm(char *filename)
{
        (void)filename;
        gd_error_ex(GD_ERROR, "libgd was not built with xpm support\n");
        return NULL;
}
#else
...

So the check done by PHP with a linking of a test program to see if there is XPM support in the
"libgd" library, despite the fact that the 'configure' flags
"--without-xpm" or "--with-xpm-dir=no" were given, is incorrect. It will always
return success, because that function "gdImageCreateFromXpm()" will always be in the libgd
library file.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=66204


--
Edit this bug report at https://bugs.php.net/bug.php?id=66204&edit=1


Thread (8 messages)

« previous php.bugs (#220983) next »