php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #69878 Undocumented change in imagejpeg behavior
Submitted: 2015-06-18 17:22 UTC Modified: 2015-06-18 19:23 UTC
From: teo8976 at gmail dot com Assigned: cmb (profile)
Status: Closed Package: GD related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: teo8976 at gmail dot com
New email:
PHP Version: OS:

 

 [2015-06-18 17:22 UTC] 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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-18 17:27 UTC] 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 18:58 UTC] cmb@php.net
-Status: Open +Status: Verified -Package: Documentation problem +Package: GD related -Assigned To: +Assigned To: cmb
 [2015-06-18 18:58 UTC] cmb@php.net
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>
 [2015-06-18 19:22 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=337000
Log: added changelog (fixes #69878)
 [2015-06-18 19:23 UTC] cmb@php.net
-Status: Verified +Status: Closed
 [2015-06-18 19:23 UTC] cmb@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 02:01:29 2024 UTC