Bug #73555 [NEW]: imagepng() doesn't properly report failure
| From: | cmb@php.net | Date: | Thu, 17 Nov 2016 13:18:59 +0000 |
| Subject: | Bug #73555 [NEW]: imagepng() doesn't properly report failure | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-205433@lists.php.net to get a copy of this message | ||
From: cmb
Operating system: *
PHP version: 5.6Git-2016-11-17 (Git)
Package: GD related
Bug Type: Bug
Bug description:imagepng() doesn't properly report failure
Description:
------------
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:
---------------
<?php
$filename = __DIR__ . DIRECTORY_SEPARATOR . 'bug.png';
touch($filename);
$stream = fopen($filename, 'r');
$im = imagecreatetruecolor(100, 100);
var_dump(imagepng($im, $stream));
var_dump(filesize($filename));
Expected result:
----------------
bool(false)
int(0)
Actual result:
--------------
bool(true)
int(0)
--
Edit bug report at https://bugs.php.net/bug.php?id=73555&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73555&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73555&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73555&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73555&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73555&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73555&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73555&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73555&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73555&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73555&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73555&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73555&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73555&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73555&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73555&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73555&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73555&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73555&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73555&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73555&r=mysqlcfg