Re: note 57992 rejected and deleted from function.fwrite by notes editor betz
| From: | M. Sokolewicz | Date: | Sun, 23 Oct 2005 18:19:10 +0000 |
| Subject: | Re: note 57992 rejected and deleted from function.fwrite by notes editor betz | ||
| References: | 1 2 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-97466@lists.php.net to get a copy of this message | ||
first of all, null is *not* a string; it's a null value. When you're writing a null value, you're writing null bytes worth of data; meaning *no bytes at all*. fwrite() returns the amount of bytes written to file. You wrote 0 bytes to the file, so that's returned. In your if() 0 is interpreted as false, and thus the error is shown.
Basically your code is wrong; it's not a bug or anything strange; just basic PHP working.
- Tularis
Roland Krystian Alberciak wrote:
What did I do wrong in posting this note? I still don't understand.-----Original Message----- From: php-notes@lists.php.net [mailto:php-notes@lists.php.net] Sent: Friday, October 21, 2005 05:01 AM To: krystian@gatech.edu Subject: note 57992 rejected and deleted from function.fwrite by notes editor betz You are receiving this email because your note posted to the online PHP manual has been removed by one of the editors. Read the following paragraphs carefully, because they contain pointers to resources better suited for requesting support or reporting bugs, none of which are to be included in manual notes because there are mechanisms and groups in place to deal with those issues. The user contributed notes are not an appropriate place to ask questions, report bugs or suggest new features; please use the resources listed on <http://php.net/support> for those purposes. This was clearly stated in the page you used to submit your note, please carefully re-read those instructions before submitting future contributions. Bug submissions and feature requests should be entered at <http://bugs.php.net/>. For documentation errors use the bug system, and classify the bug as "Documentation problem". Support and ways to find answers to your questions can be found at <http://php.net/support>. Your note has been removed from the online manual. ----- Copy of your note below ----- Given the following hypothetical code: $fp = fopen("some.dat", "w"); $result = fwrite($fp, null); if (! $result) { echo "couldn't write"; } fclose($fp); The output will be "couldn't write". It appears as though you cannot write a null string to a file.