|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73555 imagepng() doesn't properly report failure
Submitted: 2016-11-17 13:18 UTC Modified: 2017-08-16 16:30 UTC
From: Assigned:
Status: Suspended Package: GD related
PHP Version: 5.6Git-2016-11-17 (Git) OS: *
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-11-17 13:18 UTC]
imagepng() and other output functions don't properly report
failure. For instance, if a read-only stream is passed to
imagepng(), the function returns TRUE without any warning or
notice, but obviously the image has not been written to the file.

Test script:

$filename = __DIR__ . DIRECTORY_SEPARATOR . 'bug.png';
$stream = fopen($filename, 'r');
$im = imagecreatetruecolor(100, 100);
var_dump(imagepng($im, $stream));

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-11-17 13:19 UTC]
-Assigned To: +Assigned To: cmb
 [2016-11-17 13:34 UTC]
-Status: Assigned +Status: Suspended
 [2016-11-17 13:34 UTC]
Unfortunately, this issue can't be resolved, because GD's image
output functions don't return success/failure[1]. I'm suspending
this ticket until this is resolved.

[1] <>
 [2017-08-16 16:30 UTC]
-Assigned To: cmb +Assigned To:
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 23 00:01:31 2024 UTC