found more return inconsistacies

From: Date: Fri, 08 Nov 2002 21:00:35 +0000
Subject: found more return inconsistacies
References: 1 2  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969349493@lists.php.net to get a copy of this message
Just because I was on it, I grep'ed my local tree over and over looking for wrong "-1" returns. And so I found more. Here is a little snapshot for every function I found. Tell me what you think so I go and fix those. dio_open: DOCS: <function>dio_open</function> opens a file and returns a new file descriptor for it, or -1 if any error occurred. If... SOURCE: if (fd == -1) { php_error(E_WARNING, "%s(): cannot open file %s with flags %d and permissions %d: %s", get_active_function_name(TSRMLS_C), file_name, flags, mode, strerror(errno)); RETURN_FALSE; } // It obiosely sends a FALSE fbsql_list_fields: DOCS: A result identifier is a positive integer. The function returns -1 if a error occurs. A string describing the error will be SOURCE: ... if (!php_fbsql_select_db(databaseName, phpLink TSRMLS_CC)) { RETURN_FALSE; } ... // Same here FTP extension: ftp_mdtm: DOCS: <function>ftp_mdtm</function> checks the last modified time for a file, and returns it as a UNIX timestamp. If an error occurs, or the file does not exist, -1 is returned. </para> <para> Returns a UNIX timestamp on success, or -1 on error. ftp_size: DOCS: <function>ftp_size</function> returns the size of a file in bytes. If an error occurs, of if the file does not exist, -1 is returned. Not all servers support this feature. </para> <para> Returns the file size on success, or -1 on error. // Both functions are documented correctly - sources indeed return -1. (though, wouldn't it be better having them returning FALSE? I know this would break existing scripts, but would keep us consistent). Anyhow, there are also some documentation problems: "return" is repeatedly mentioned in both cases. Should I change the description to something more readable? gmp_sign: DOCS: Return sign of <parameter>a</parameter> - 1 if <parameter>a</parameter> is positive and -1 if it's negative. // I had to read it more than once... (because I never used the extension?) What should I fix this into to be more clear? What does it actually return? -- Maxim Maletsky maxim@php.net Maxim Maletsky <maxim@php.net> wrote... : > > You're absolutely right. Recommitted. Thanks! > > > -- > Maxim Maletsky > maxim@php.net > > > > Derick Rethans <derick@php.net> wrote... : > > > On Fri, 8 Nov 2002, Maxim Maletsky wrote: > > > > > maxim Fri Nov 8 14:42:32 2002 EDT > > > > > > Modified files: > > > /phpdoc/en/reference/filesystem/functions fwrite.xml > > > Log: > > > Fixed Bug #20318 - confusing return value (False instead -1) > > > > The entity is "&false;" not "&false". > > > > Derick > > > > > > > > > > > Index: phpdoc/en/reference/filesystem/functions/fwrite.xml > > > diff -u phpdoc/en/reference/filesystem/functions/fwrite.xml:1.3 > > > phpdoc/en/reference/filesystem/functions/fwrite.xml:1.4 > > > --- phpdoc/en/reference/filesystem/functions/fwrite.xml:1.3 Thu Oct 17 22:59:42 2002 > > > +++ phpdoc/en/reference/filesystem/functions/fwrite.xml Fri Nov 8 14:42:32 2002 > > > @@ -1,5 +1,5 @@ > > > <?xml version="1.0" encoding="iso-8859-1"?> > > > -<!-- $Revision: 1.3 $ --> > > > +<!-- $Revision: 1.4 $ --> > > > <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> > > > <refentry id="function.fwrite"> > > > <refnamediv> > > > @@ -25,7 +25,7 @@ > > > </simpara> > > > <simpara> > > > <function>fwrite</function> returns the number of bytes > > > - written, or -1 on error. > > > + written, or &false on error. > > > </simpara> > > > <simpara> > > > Note that if the <parameter>length</parameter> argument is given, > > > > > > > > > > > > -- > > > PHP Documentation Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- > > > > --------------------------------------------------------------------------- > > Derick Rethans > > http://derickrethans.nl/ > > JDI Media Solutions > > --------------[ if you hold a unix shell to your ear, do you hear the c? ]- > > > > > > -- > > PHP Documentation Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > PHP Documentation Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.doc (#969349493) next »