Req #66488 [Com]: 32-bit integers used internally
| From: | sixd@php.net | Date: | Wed, 15 Jan 2014 19:31:00 +0000 |
| Subject: | Req #66488 [Com]: 32-bit integers used internally | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-183813@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66488&edit=1
ID: 66488
Comment by: sixd@php.net
Reported by: scott at arciszewski dot me
Summary: 32-bit integers used internally
Status: Open
Type: Feature/Change Request
Package: GD related
Operating System: Linux
PHP Version: 5.5.8
Block user comment: N
Private report: N
New Comment:
See https://wiki.php.net/rfc/size_t_and_int64
Previous Comments:
------------------------------------------------------------------------
[2014-01-15 15:02:36] scott at arciszewski dot me
Description:
------------
Even when using PHP with GD on a 64-bit machine, the 4 GB memory limit rears its ugly head.
Thus, we have problems like this one:
https://stackoverflow.com/questions/20614686/gd-warning-product-of-memory-allocation-multiplication-would-exceed-int-max
I would propose going in and updating the integer definitions to accommodate 64-bit processors and
its larger memory space, but GD isn't my forte so I'm not sure if I would break all of the
things if I went in and patched it.
Test script:
---------------
echo PHP_INT_MAX . '<br/>';
echo 174400 * 249600 . '<br/>';
$img = imagecreatetruecolor(174400, 249600);
Expected result:
----------------
9223372036854775807
43530240000
Warning: imagecreatetruecolor(): gd warning: product of memory allocation multiplication would
exceed INT_MAX, failing operation gracefully in
/home/bartek/Documents/WWW/WOF/application/controllers/EditorController.php on line 5
Actual result:
--------------
<b>Parse error</b>: imagecreatetruecolor(): product of memory allocation multiplication
would exceed INT_MAX, failing operation gracefully
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66488&edit=1