Edit report at http://bugs.php.net/bug.php?id=52802&edit=1
ID: 52802 Updated by: ahar...@php.net Reported by: cataphr...@php.net Summary: Out-of-date comment for file_get_contents/php_stream_copy_to_mem -Status: Assigned +Status: Closed Type: Bug Package: Streams related PHP Version: trunk-SVN-2010-09-09 (SVN) Assigned To: aharvey Block user comment: N New Comment: This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2010-09-10 05:08:07] ahar...@php.net Automatic comment from SVN on behalf of aharvey Revision: http://svn.php.net/viewvc/?view=revision&revision=303249 Log: Fix bug #52802 (Out-of-date comment for file_get_contents/php_stream_copy_to_mem) by updating the relevant comments. ------------------------------------------------------------------------ [2010-09-10 05:04:54] ahar...@php.net Good catch. :) ------------------------------------------------------------------------ [2010-09-09 13:38:42] cataphr...@php.net Forgot the tell. The behavior of php_stream_copy_to_mem was modified in March 2008: http://svn.php.net/viewvc?view=revision&revision=255970 ------------------------------------------------------------------------ [2010-09-09 13:36:58] cataphr...@php.net Description: ------------ ext/standard/file.c#560 560 /* uses mmap if possible */ 561 if ((len = php_stream_copy_to_mem(stream, &contents, maxlen, 0)) > 0) { main/php_streams.h 431 /* read all data from stream and put into a buffer. Caller must free buffer when done. 432 * The copy will use mmap if available. */ 433 PHPAPI size_t _php_stream_copy_to_mem(php_stream *src, char **buf, size_t maxlen, 434 int persistent STREAMS_DC TSRMLS_DC); 435 #define php_stream_copy_to_mem(src, buf, maxlen, persistent) _php_stream_copy_to_mem((src), (buf), (maxlen), (persistent) STREAMS_CC TSRMLS_CC) main/php_streams.h 419 /* copy up to maxlen bytes from src to dest. If maxlen is PHP_STREAM_COPY_ALL, copy until eof(src). 420 * Uses mmap if the src is a plain file and at offset 0 */ 421 #define PHP_STREAM_COPY_ALL ((size_t)-1) In this last case, PHP_STREAM_COPY_ALL is also passed to php_stream_copy_to_stream_ex, which still uses mmap+mmap_unmap, so it's half correct (except for the part is works with any maxlen, not just PHP_STREAM_COPY_ALL). ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=52802&edit=1