Bug #67108 [Nab]: imageCreateFromJpeg (or any other function) must not terminate script silently
Edit report at https://bugs.php.net/bug.php?id=67108&edit=1
ID: 67108
User updated by: romtek at gmail dot com
Reported by: romtek at gmail dot com
Summary: imageCreateFromJpeg (or any other function) must not
terminate script silently
Status: Not a bug
Type: Bug
Package: GD related
Operating System: Windows, Linux
PHP Version: 5.5.11
Block user comment: N
Private report: N
New Comment:
OK, how about this: when imageCreateFromJpeg() reaches the memory limit, it should release all
memory it had been able to allocate. This will probably create enough memory for handling the error.
The VM should keep enough memory in its pool to let scripts handle such errors gracefully.
Previous Comments:
------------------------------------------------------------------------
[2014-04-22 06:54:45] pajoye@php.net
It is by design. Out of memory (be with memory limit or system) should not allow any other operation
as it can't end well anyway. Nothing can be allocated anymore, so how would we manage errors
(msg, stack, etc)?
If you use a the memory limite and need more for specific areas, you can change it via php.ini (and
the likes).
------------------------------------------------------------------------
[2014-04-22 06:44:57] romtek at gmail dot com
Description:
------------
The notorious situation: calling imageCreateFromJpeg() terminates the calling script SILENTLY when
it can't allocate enough memory, leaving no way to gracefully handle the situation. Even using
set_error_handler() is useless in this case.
This problem is widely known and talked about for a long time. While terminating a script silently
is OK for a project in Programming 101 course, it unacceptable for a business website.
Please make it so this function (and all other functions in PHP) allow for graceful handling of
errors. This could be throwing an exception or returning an error code.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67108&edit=1
Thread (3 messages)