Behaviour of put_file_contents()?
| From: | Paul Hudson | Date: | Sat, 28 Jun 2003 00:51:55 +0000 |
| Subject: | Behaviour of put_file_contents()? | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-2917@lists.php.net to get a copy of this message | ||
All,
The manual currently doesn't specify what the function file_put_contents
returns beyond just "int". The code prototype says string, and the function
appears to return a boolean rather than any integer (at least in the latest
CVS). Which of the three should it be?
I was /expecting/ it to return an integer of the number of bytes written, as
in the included (albeit very simplistic!) patch.
Paul
--
[paul@alice standard]$ diff -u file.c.old file.c
--- file.c.old 2003-06-28 01:13:19.000000000 +0100
+++ file.c 2003-06-28 01:13:29.000000000 +0100
@@ -474,7 +474,7 @@
}
/* }}} */
-/* {{{ proto string file_put_contents(string file, string data[, int flags[,
resource context]])
+/* {{{ proto int file_put_contents(string file, string data[, int flags[,
resource context]])
Write/Create a file with contents data */
PHP_FUNCTION(file_put_contents)
{
@@ -506,7 +506,7 @@
}
php_stream_close(stream);
- RETURN_TRUE;
+ RETURN_LONG(numbytes);
}
/* }}} */