Doc #69878 [Opn->Ver]: Undocumented change in imagejpeg behavior
| From: | cmb@php.net | Date: | Thu, 18 Jun 2015 18:58:58 +0000 |
| Subject: | Doc #69878 [Opn->Ver]: Undocumented change in imagejpeg behavior | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-12449@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69878&edit=1
ID: 69878
Updated by: cmb@php.net
Reported by: teo8976 at gmail dot com
Summary: Undocumented change in imagejpeg behavior
-Status: Open
+Status: Verified
Type: Documentation Problem
-Package: Documentation problem
+Package: GD related
PHP Version: Irrelevant
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
The behavior to not accept an empty string for the $filename
parameter has been changed as of PHP 5.4.0 (ZPP sâp). However, the
relevant part of the documentation has already been changed nearly
nine years ago[1] (i.e. long before PHP 5.4.0 has been released).
[1] <https://svn.php.net/viewvc/phpdoc/en/trunk/reference/image/functions/imagejpeg.xml?r1=218723&r2=218722&pathrev=218723>
Previous Comments:
------------------------------------------------------------------------
[2015-06-18 17:27:36] teo8976 at gmail dot com
I've found 2 unrelated php-based softwares (vBulletin and MyClientBase) that in old versions
used
imagejpeg($someimage, '', $quality);
That seems a strange coincidence, which makes me suspect that either the documentation was less
clear in the past about the value to use for skipping the argument, or it explicitly allowed the use
of ''.
Either way, this is one more reason for documenting the change in behavior.
------------------------------------------------------------------------
[2015-06-18 17:22:50] teo8976 at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.imagejpeg
---
bool imagejpeg ( resource $image [, string $filename [, int $quality ]] )
"To skip this argument [$filename] in order to provide the quality parameter, use NULL."
At some version between 5.2.17 and 5.4.29, the behavior has changed in the case where $filename
equals ''.
In 5.2.17, passing '' would yield the same result as passing NULL.
In 5.4.29, passing '' results in the error message "filename cannot be empty"
(as expected).
Although the documentation says that the value to use is null (dunnow if it has always been stated
as clearly as it is now), and even if the change in behavior is a fix to a bug, the change MUST be
documented, including the exact version when the behavior has changed.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69878&edit=1