#23014 [NoF->Opn]: Wrong output with funtion fwrite(), fputs()

From: Date: Fri, 11 Apr 2003 13:41:07 +0000
Subject: #23014 [NoF->Opn]: Wrong output with funtion fwrite(), fputs()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-37565@lists.php.net to get a copy of this message
ID: 23014 User updated by: c dot ferrari at gmx dot net Reported By: c dot ferrari at gmx dot net -Status: No Feedback +Status: Open Bug Type: Filesystem function related Operating System: Windows XP PHP Version: 4.3.2RC1 New Comment: There ist definitly a problem in this both function fgets(), fwrite() or in the function fopen()! It look's like a problem with the binary option in the function fopen(). If I use fopen($fp,"wb+") in the PHP version 4.3.2RC1 it works similar like fopen($fp, "w+") in the PHP version 4.2.3 and 4.3.0 . If it's not so, why this functions works so different from PHP 4.3.2RC1 and 4.3.0 and 4.2.x. Previous Comments: ------------------------------------------------------------------------ [2003-04-07 18:43:26] sniper@php.net No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. ------------------------------------------------------------------------ [2003-04-02 10:59:49] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip ------------------------------------------------------------------------ [2003-04-02 04:35:28] c dot ferrari at gmx dot net Since PHP version 4.3.1 an also in version 4.3.2RC1 I have found some problems with the function fputs() fwrite(). If you write only one character the functinon write two!! Example 1: <?php $fp=fopen("test.txt","w+"); fputs($fp, "*"); fclose($fp); ?> Result: With a Hexeditor you can see 2A 0A. Example 2: <?php $fp=fopen("test.txt","w+"); fputs($fp, "**"); fclose($fp); ?> Result: With a Hexeditor you can see the correct result 2A 2A. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23014&edit=1

« previous php.bugs (#37565) next »