Doc #66897 [Ana->Csd]: stream_set_read_buffer / stream_set_write_buffer return EOF

From: Date: Thu, 23 Jul 2015 11:40:45 +0000
Subject: Doc #66897 [Ana->Csd]: stream_set_read_buffer / stream_set_write_buffer return EOF
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-12543@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66897&edit=1 ID: 66897 Updated by: cmb@php.net Reported by: php-bugs at allenjb dot me dot uk Summary: stream_set_read_buffer / stream_set_write_buffer return EOF -Status: Analyzed +Status: Closed Type: Documentation Problem Package: Streams related Operating System: * PHP Version: n/a Assigned To: cmb Block user comment: N Private report: N New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2015-07-23 11:40:09] cmb@php.net Automatic comment from SVN on behalf of cmb Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=337225 Log: corrected return value documentation (fixes #66897) ------------------------------------------------------------------------ [2015-07-22 21:24:28] cmb@php.net Well, looking at the code shows that the functions return either zero or the value of the C constant EOF[1][2], which is AFAIK not clearly defined by the C standards. glibc defines it as -1, but other libraries may use some other value. So it seems best to check for === 0 (success) resp. !== 0 (failure). Anyhow, it seems that it would have been more PHPish to return TRUE on success, FALSE on failure, and NULL for argument mismatches. [1] <https://github.com/php/php-src/blob/php-5.6.11/ext/standard/streamsfuncs.c#L1426> [2] <https://github.com/php/php-src/blob/php-5.6.11/ext/standard/streamsfuncs.c#L1489> ------------------------------------------------------------------------ [2014-03-13 10:02:33] php-bugs at allenjb dot me dot uk Description: ------------ The stream_set_read_buffer and stream_set_write_buffer functions are documented to return EOF on failure, but there is no EOF constant and there is no example of how to correctly check for this. Expected result: ---------------- There should be a documented example of how to correctly check the return value of these functions. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66897&edit=1

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