|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44591 imagegif's filename parameter
Submitted: 2008-04-01 12:44 UTC Modified: 2008-04-04 17:40 UTC
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: woeterman at gmail dot com Assigned: pajoye
Status: Closed Package: GD related
PHP Version: 5.2CVS-2008-04-01 (CVS) OS: Linux
Private report: No CVE-ID:
 [2008-04-01 12:44 UTC] woeterman at gmail dot com
The documentation says:
'The path to save the file to. If not set or NULL, the raw image stream will be outputted directly.'

But when using null, the image is not saved to a file, but not displayed on the screen either.

Reproduce code:
// This will save the image to 'test.gif'
imagegif($resource, 'test.gif');

// This should display the image on the screen, but doesnt save nor display
imagegif($resource, null);

// This displays the image on the screen.

Expected result:
First line to save the file to 'test.jpg', which works.

The last 2 lines to display the image on the screen, but only the last one does.

Actual result:
First line saves the file, middle line seems to do nothing, and the last line displays the image on the screen.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-01 23:48 UTC]
Index: ext/gd/gd.c
RCS file: /repository/php-src/ext/gd/gd.c,v
retrieving revision 1.312.
diff -u -p -r1.312. gd.c
--- ext/gd/gd.c 10 Mar 2008 22:12:34 -0000      1.312.
+++ ext/gd/gd.c 1 Apr 2008 23:45:00 -0000
@@ -2812,7 +2812,7 @@ static void _php_image_output(INTERNAL_F
-       if ((argc == 2) || (argc > 2 && Z_STRLEN_PP(file))) {
+       if (argc >= 2 && Z_STRLEN_PP(file)) {
                PHP_GD_CHECK_OPEN_BASEDIR(fn, "Invalid filename");
                fp = VCWD_FOPEN(fn, "wb");

I think that this should solve this problem.
 [2008-04-04 17:40 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Wed Oct 14 04:01:38 2015 UTC