ID:               48179
 User updated by:  ronald dot muller at gmail dot com
 Reported By:      ronald dot muller at gmail dot com
-Status:           Feedback
+Status:           Open
 Bug Type:         GD related
 Operating System: *
 PHP Version:      5.2.9
 New Comment:

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;


?>


Previous Comments:
------------------------------------------------------------------------

[2009-05-07 12:51:26] j...@php.net

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.



------------------------------------------------------------------------

[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

Reply via email to