Bug #52802 [Opn->Asn]: Out-of-date comment for file_get_contents/php_stream_copy_to_mem
Edit report at http://bugs.php.net/bug.php?id=52802&edit=1
ID: 52802
Updated by: aharvey@php.net
Reported by: cataphract@php.net
Summary: Out-of-date comment for
file_get_contents/php_stream_copy_to_mem
-Status: Open
+Status: Assigned
Type: Bug
Package: Streams related
PHP Version: trunk-SVN-2010-09-09 (SVN)
-Assigned To:
+Assigned To: aharvey
Block user comment: N
New Comment:
Good catch. :)
Previous Comments:
------------------------------------------------------------------------
[2010-09-09 13:38:42] cataphract@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] cataphract@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
Thread (4 messages)