Re: fwrite( ) gives Notice with Unicode ON

From: Date: Thu, 31 May 2007 13:18:43 +0000
Subject: Re: fwrite( ) gives Notice with Unicode ON
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-29999@lists.php.net to get a copy of this message
Hi, yes, the notice is expected. You either have to cast to a binary string or by setting the stream's encoding using stream_encode() since we can't guess which encoding you're going to use for a stream. johannes On Thu, 2007-05-31 at 05:38 -0700, Nikhil Gupta wrote: > Hi, > I'm writing some PHPT test cases for PHP 6 and wanted to check that I was seeing the > correct behaviour with unicode. > I tried the following simple testcase and gets Notice message with php6 unicode ON. > > --TEST-- > test.phpt > --FILE-- > <?php > $fh = fopen ("tempfile.tmp", "w" ); > fwrite( $fh, "Sample text" ); > fclose( $fh ); > ?> > --UEXPECT-- > > command: > php run-tests.php -u test.phpt > cat test.u.out > > Following Notice is displayed: > Notice: fwrite(): 11 character unicode buffer downcoded for binary stream runtime_encoding in > %s on line %d > > There in no notice message with PHP6 unicode OFF, please would you confirm that the additional > notices with Unicode on are intended? I think it will result in a large number of additional Notices > if we use fwrite in a for loop. > > Thanks & Regards > Nikhil > > > ____________________________________________________________________________________ > Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on > us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7

« previous php.internals (#29999) next »