|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52802 Out-of-date comment for file_get_contents/php_stream_copy_to_mem
Submitted: 2010-09-09 13:36 UTC Modified: 2010-09-10 05:08 UTC
From: Assigned: aharvey (profile)
Status: Closed Package: Streams related
PHP Version: trunk-SVN-2010-09-09 (SVN) OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2010-09-09 13:36 UTC]

    560 	/* uses mmap if possible */
    561 	if ((len = php_stream_copy_to_mem(stream, &contents, maxlen, 0)) > 0) {


    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)


    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).


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-09-09 13:38 UTC]
Forgot the tell. The behavior of php_stream_copy_to_mem was modified in March 2008:
 [2010-09-10 05:04 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: aharvey
 [2010-09-10 05:04 UTC]
Good catch. :)
 [2010-09-10 05:08 UTC]
Automatic comment from SVN on behalf of aharvey
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:08 UTC]
-Status: Assigned +Status: Closed
 [2010-09-10 05:08 UTC]
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
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 22 08:01:43 2024 UTC