Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:2917 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51741 invoked from network); 28 Jun 2003 00:54:06 -0000 Received: from unknown (HELO smtp1.ex.eclipse.net.uk) (212.104.129.225) by pb1.pair.com with SMTP; 28 Jun 2003 00:54:06 -0000 Received: from 10.0.0.1 (unknown [213.152.58.41]) by smtp1.ex.eclipse.net.uk (Postfix) with ESMTP id BE5525A3 for ; Sat, 28 Jun 2003 01:53:16 +0100 (BST) Reply-To: hudzilla@php.net To: internals@lists.php.net Date: Sat, 28 Jun 2003 01:51:55 +0100 User-Agent: KMail/1.5 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <200306280151.55639.hudzilla@php.net> Subject: Behaviour of put_file_contents()? From: hudzilla@php.net (Paul Hudson) 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); } /* }}} */