php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #68239 Incorrect documentation or library bug
Submitted: 2014-10-15 18:14 UTC Modified: 2014-11-07 10:17 UTC
From: richard at sublogic dot se Assigned: aharvey (profile)
Status: Closed Package: GD related
PHP Version: 5.6.1 OS: Archlinux
Private report: No CVE-ID: None
 [2014-10-15 18:14 UTC] richard at sublogic dot se
Description:
------------
---
From manual page: http://www.php.net/function.imagescale
---

The function imagescale either has an implementation bug floating around or the documentation is wrong.

The issue is with the $height parameter. The docs say it can optionally be provided but the reality is the following error:

Warning: imagescale(): gd warning: one parameter to a memory allocation 
multiplication is negative or zero, failing operation gracefully ...

Link: https://bugs.php.net/bug.php?id=65171

The only way for imagescale() to function properly at present is to explicitly provide a value for $height.

It would be very helpful if the docs gave a warning on this issue.

Test script:
---------------
$imageres = imagecreatetruecolor(600, 500);


$imageres = imagescale($imageres, 380, 380);


imagejpeg($imageres, $dstdir . $filename);
imagedestroy($imageres);


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-10-17 13:44 UTC] tyrael@php.net
-Status: Open +Status: Verified
 [2014-10-17 13:44 UTC] tyrael@php.net
I think we should either fix the arginfo and the docs to make the height mandatory, or it should work when the argument is omitted.
 [2014-10-17 13:44 UTC] tyrael@php.net
-Assigned To: +Assigned To: pajoye
 [2014-11-05 15:13 UTC] remi@php.net
FYI the bug #65171 is fix in upcoming 5.5.19 / 5.6.3
 [2014-11-07 10:16 UTC] aharvey@php.net
Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&revision=335164
Log: Note the fix for bug #65171, and generally flesh out the imagescale() docs.

Fixes doc bug #68239 (Incorrect documentation or library bug).
 [2014-11-07 10:17 UTC] aharvey@php.net
-Status: Verified +Status: Closed -Assigned To: pajoye +Assigned To: aharvey
 [2014-11-07 10:17 UTC] aharvey@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-2021 The PHP Group
All rights reserved.
Last updated: Mon Oct 18 05:03:33 2021 UTC