php.net |  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
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: woeterman at gmail dot com Assigned: pajoye (profile)
Status: Closed Package: GD related
PHP Version: 5.2CVS-2008-04-01 (CVS) OS: Linux
Private report: No CVE-ID: None
 [2008-04-01 12:44 UTC] woeterman at gmail dot com
Description:
------------
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:
---------------
<?php
// 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.
imagegif($resource);
?>

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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-01 23:48 UTC] felipe@php.net
Index: ext/gd/gd.c
===================================================================
RCS file: /repository/php-src/ext/gd/gd.c,v
retrieving revision 1.312.2.20.2.32.2.3
diff -u -p -r1.312.2.20.2.32.2.3 gd.c
--- ext/gd/gd.c 10 Mar 2008 22:12:34 -0000      1.312.2.20.2.32.2.3
+++ 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] felipe@php.net
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
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC