|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-03-29 16:20 UTC] c dot affolter at stepping-stone dot ch
Description: ------------ The bug #36359 doesn't seems to be fixed in the latest CVS version: http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/internal/splfileobject.inc?view=markup&rev=1.3&pathrev=HEAD The string to be written ($str) doesn't gets passed to the fwrite() function. The method SplFileObject::fwrite() has to be corrected: <?php ... function fwrite($str, $length = NULL) { // wrong: //return fwrite($this->fp, $length); // correct: return fwrite($this->fp, $str, $length); } ... ?> Thanks! Reproduce code: --------------- <?php splFileObject = new FileObject('test.txt', 'w'); splFileObject->fwrite('test'); ?> Expected result: ---------------- cat test.txt test Actual result: -------------- cat test.txt [empty] PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 22:00:01 2025 UTC |
Your code is wrong, but this code works perfectly fine: <?php $splFileObject = new SplFileObject('test.txt', 'w'); $splFileObject->fwrite('test'); ?>