From: pavel dot stratil-jun at fenix dot cz
Operating system: gentoo (amd64smp)
PHP version: 5.1.6
PHP Bug Type: *Encryption and hash functions
Bug description: script times out long befor reaching max. execution time
Description:
------------
when trying to hash large files (cant say yet how large, but a 800MB file
was hashed without problems but a 1300MB file not), the script times out
after about 1 minute even if max. execution time is set to half an hour.
smaller files, such as the 800MB file were successfully hashed a few times
using different hashing methods (in total the script took about 4 minutes
to run).
Reproduce code:
---------------
// tried both:
$fp = fopen('file.ext', "r");
$ctx = hash_init('sha512');
while (!feof($fp)) {
hash_update($ctx, fgets($fp,$bytes));
}
$res_hash = hash_final($ctx); // this would be line 58
fclose($fp);
// and
hash_file('sha512', 'file.ext'); // this would be line 67
// $bytes were set to anywhere from 4kB to 32MB.. same result all the time
Expected result:
----------------
obviously, a hash.
Actual result:
--------------
Fatal error: Maximum execution time of 1800 seconds exceeded in
/opt/apache/htdocs/hashtest.php on line 58.
or
Fatal error: Maximum execution time of 1800 seconds exceeded in
/opt/apache/htdocs/hashtest.php on line 67.
depending what piece of code was commented.
--
Edit bug report at http://bugs.php.net/?id=38950&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=38950&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=38950&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=38950&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38950&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=38950&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38950&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38950&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38950&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38950&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38950&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=38950&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=38950&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38950&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38950&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38950&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38950&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38950&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38950&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38950&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38950&r=mysqlcfg