ID: 48179 Updated by: j...@php.net Reported By: ronald dot muller at gmail dot com -Status: Open +Status: Bogus Bug Type: GD related Operating System: * PHP Version: 5.2.9 New Comment:
To be able to read huge images you just have to increase the memory_limit. There is no other fix for this. Previous Comments: ------------------------------------------------------------------------ [2009-05-07 13:08:36] ronald dot muller at gmail dot com new example url: http://www.plasticdaisy.net/dlvs/pr/index.php reports: Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 13056 bytes) in /mounted-storage/home6a/sub004/sc11402-FHCV/www/dlvs/pr/index.php on line 5 script contains following lines: <?php ini_set('memory_limit', '8M'); $someVar = imagecreatefromjpeg('P5011513.JPG'); echo $someVar; ?> ------------------------------------------------------------------------ [2009-05-07 12:45:20] ronald dot muller at gmail dot com Description: ------------ imagecreatefromjpeg() should return FALSE on errors (as documented), not crash - hence aborting the php script. http://www.plasticdaisy.net/dlvs/dlvs.php?c=pr shows "Fatal error: Allowed memory size of 33554432 bytes exhausted" and aborts the script. The crash occurs because memory_limit is exceeded, as mentioned in previous submissions on the same bug. In the example case a 3.8MB jpg is expanded internally to somewhere in between 32MB and 64MB. Increasing the memory_limit does not solve the bug, it merely hides it again. The function should be made according to spec, i.e. return FALSE. Then the php script can act properly on this error. Reproduce code: --------------- ini_set('memory_limit', $TOO_SMALL); $someVar = imagecreatefromjpeg($img); echo $someVar; Expected result: ---------------- return FALSE i.s.o. crash, as documented. Actual result: -------------- Fatal error: Allowed memory size of 33554432 bytes exhausted http://www.plasticdaisy.net/dlvs/dlvs.php?c=pr ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48179&edit=1