Doc #65089 [NEW]: Please clarify how to use modes together

From: Date: Fri, 21 Jun 2013 16:41:22 +0000
Subject: Doc #65089 [NEW]: Please clarify how to use modes together
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-9963@lists.php.net to get a copy of this message
From: truenrush at gmail dot com Operating system: Any PHP version: 5.5.0 Package: Documentation problem Bug Type: Documentation Problem Bug description:Please clarify how to use modes together Description: ------------ I am confused, that there are not examples how to use read-write mode (w+) with binary modificator (b). Should it be "w+b"? Or "wb+"? or "bw+"? I've spend some time to understand how it works (i can test only on linux, so i am not sure in test results about "t" mode, but read-write operations should be done same on the any OS). Please, explain on http://www.php.net/manual/en/function.fopen.php page, how can i use modes altogether, which ways are acceptable, thanks! Test script: --------------- // In this example i use "t" modificator, but it does not matter exactly // w+t $h = fopen('test.file', 'w+t'); fwrite($h, "test \ntest \ntest \n"); fseek($h, 0); $data = fread($h, filesize('test.file')); var_dump($data); // data is written and read normally fclose($h); // wt+, same result $h = fopen('test.file', 'wt+'); fwrite($h, "test \ntest \ntest \n"); fseek($h, 0); $data = fread($h, filesize('test.file')); var_dump($data); // data is written and read normally, fclose($h); Expected result: ---------------- It is decribed in documentation: 1) how it is possible to combine modes ("t" and "b" in addition to usual ones), should it be w+b, wb+, etc. What is correct syntax? 2) is it enough to use "t" mode only when reading under windows, or i should write file first of all (to replace all \n with \r\n), and then read it normally? It is not clear Actual result: -------------- Documentation description exists, but is not clear. -- Edit bug report at https://bugs.php.net/bug.php?id=65089&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65089&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=65089&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65089&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=65089&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=65089&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=65089&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=65089&r=needscript Try newer version: https://bugs.php.net/fix.php?id=65089&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=65089&r=support Expected behavior: https://bugs.php.net/fix.php?id=65089&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=65089&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=65089&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=65089&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65089&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=65089&r=dst IIS Stability: https://bugs.php.net/fix.php?id=65089&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=65089&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=65089&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=65089&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=65089&r=mysqlcfg

« previous php.doc.bugs (#9963) next »