php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29637 fwrite needs pass by reference for string
Submitted: 2004-08-12 18:52 UTC Modified: 2004-08-12 20:01 UTC
From: pearcec at poss dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.0.0 OS: any
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: pearcec at poss dot com
New email:
PHP Version: OS:

 

 [2004-08-12 18:52 UTC] pearcec at poss dot com
Description:
------------
It would be great to pass the string by reference in fwrite.  Otherwise it makes a copy of the data.  This is a problem for very large files.

PHP Warning:  Call-time pass-by-reference has been deprecated - argument passed by value;  If you would like to pass it by reference, modify the declaration of fwrite().  If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file.  However, future versions may not support this any longer.  in /home/pearcec/saturn/www/include/file/cnFileBlob.inc on line 156

Reproduce code:
---------------
fwrite($fp, $inContents);



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-12 20:01 UTC] derick@php.net
That is not true, PHP does not copy the data in this case. PHP does a copy on write, and because the fwrite function does not change the string nothing will be copied (it's actually more efficient then passing by reference in this case).
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Dec 15 21:00:01 2025 UTC