From: chris at lodesys dot com Operating system: Windows 2000 PHP version: 5CVS-2006-01-03 (snap) PHP Bug Type: Reproducible crash Bug description: file_get_contents fails with some combinations of offset & maxlen
Description: ------------ This one is weird. For some value of offset & maxlen, file_get_contents will fail and crash PHP. (I'm running under Apache 1.3.34 and get a Dr. Watson). The combination may have something to do with offset + maxlen just above 4096, but even that's not consistant. Reproduce code: --------------- $x = file_get_contents("C:/php/news.txt", FALSE, NULL, 500, 3596); // WORKS $x = file_get_contents("C:/php/news.txt", FALSE, NULL, 500, 3597); // FAILS $x = file_get_contents("C:/php/news.txt", FALSE, NULL, 500, 4096); // FAILS $x = file_get_contents("C:/php/news.txt", FALSE, NULL, 500, 4097); // WORKS $x = file_get_contents("C:/php/news.txt", FALSE, NULL, 1000, 4096); // FAILS $x = file_get_contents("C:/php/news.txt", FALSE, NULL, 1000, 4097); // WORKS $x = file_get_contents("C:/php/news.txt", FALSE, NULL, 0, 4096); // WORKS $x = file_get_contents("C:/php/news.txt", FALSE, NULL, 0, 4097); // WORKS Expected result: ---------------- All combinations of offset & maxlen should work as news.txt is 74 KB long. Actual result: -------------- PHP fails in some instances (see above) with Dr. Watson reporting "Application exception occurred: App: (pid=1828)[apache.exe] Exception number: c0000005 (access violation)" Using -- Edit bug report at http://bugs.php.net/?id=35886&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35886&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35886&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35886&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=35886&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=35886&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=35886&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=35886&r=needscript Try newer version: http://bugs.php.net/fix.php?id=35886&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=35886&r=support Expected behavior: http://bugs.php.net/fix.php?id=35886&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=35886&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=35886&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=35886&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35886&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=35886&r=dst IIS Stability: http://bugs.php.net/fix.php?id=35886&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=35886&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=35886&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=35886&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=35886&r=mysqlcfg