Re: PHP (anti) crash policy?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On 10/04/2004 11:53 AM, Olaf Van Der Spek wrote:
Why?
I think a large number of data handling functions would benefit from such a function.
And it'd make PHP more robust.



Because it is an hack to work around the lack of support for detection of corrupted data in zlib.


In the end you will be able to handle the failure of zlib but you will not be able to tell whether it failed because the file was too large to decompress or because it failed due to corrupted data.

I think it would be better that zlib would be able to detect corrupted data so you could eventually tell the user that the file is corrupted instead of misleading with a message saying there was not enough memory.


I know zlib itself doesn't crash due to invalid input.

Until you insist on this non-sense I am afraid you will have an hard convinicing anybody to change anything.


PHP does not crash. It just exits because an external library tells it to allocate more memory than the current limit.


However, even in that case, what do you do with valid input that causes out of memory errors?

Raise the memory limit.

The problem is that a corrupted file is not a valid input. It is making zlib behave abnormally and request an absurd amount of memory. If zlib behaved properly it would detect the corrupted data and would fail without attempting to request an erroneous amound of memory.

You certainly can't blame it on PHP memory allocation code because it has no way to determine if the requested amount of memory is erroneous or not.

I think you would do better if you complained to zlib developers than to PHP developers. I am sure that this problem does not affect only PHP but also other languages that use zlib for the same purposes.


--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux