Bug #52802 [NEW]: Out-of-date comment for file_get_contents/php_stream_copy_to_mem

From: Date: Thu, 09 Sep 2010 11:36:58 +0000
Subject: Bug #52802 [NEW]: Out-of-date comment for file_get_contents/php_stream_copy_to_mem
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-154211@lists.php.net to get a copy of this message
From:             cataphract
Operating system: 
PHP version:      trunk-SVN-2010-09-09 (SVN)
Package:          Streams related
Bug Type:         Bug
Bug description:Out-of-date comment for file_get_contents/php_stream_copy_to_mem

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 bug report at http://bugs.php.net/bug.php?id=52802&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=52802&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=52802&r=trysnapshot53
Try a snapshot (trunk):              http://bugs.php.net/fix.php?id=52802&r=trysnapshottrunk
Fixed in SVN:                        http://bugs.php.net/fix.php?id=52802&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52802&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=52802&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=52802&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=52802&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=52802&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=52802&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=52802&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=52802&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=52802&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=52802&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=52802&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=52802&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=52802&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=52802&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=52802&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=52802&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=52802&r=mysqlcfg



Thread (4 messages)

« previous php.bugs (#154211) next »