Doc #62761 [Opn->Csd]: Returns an ODBC connection id or 0 (FALSE) on error. Which is it?

From: Date: Fri, 16 Nov 2012 14:13:21 +0000
Subject: Doc #62761 [Opn->Csd]: Returns an ODBC connection id or 0 (FALSE) on error. Which is it?
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-9165@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=62761&edit=1 ID: 62761 Updated by: krakjoe@php.net Reported by: mmellon at ecrs dot com Summary: Returns an ODBC connection id or 0 (FALSE) on error. Which is it? -Status: Open +Status: Closed Type: Documentation Problem Package: Documentation problem Operating System: Windows PHP Version: Irrelevant -Assigned To: +Assigned To: krakjoe 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. The function returns false on failure, additionally, you should use var_dump to inspect the internal type and content of data. Previous Comments: ------------------------------------------------------------------------ [2012-11-16 14:09:26] krakjoe@php.net Automatic comment from SVN on behalf of krakjoe Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=328382 Log: bug #62761 ------------------------------------------------------------------------ [2012-08-06 19:57:52] mmellon at ecrs dot com Description: ------------ --- From manual page: http://www.php.net/function.odbc-connect#refsect1- function.odbc-connect-returnvalues --- "Returns an ODBC connection id or 0 (FALSE) on error." Out of habit, I usually code with the following sort of conditional construct if (false !== ($foo = bar())) { echo 'Houston we have a problem'; } else { echo 'bar() was good'; } The documentation is not good enough for this function to test equality with type equivalence. The function odbc_connect does not actually return FALSE. It returns 0 or a connection id. The documentation should state "Returns an ODBC connection id if successful, or returns 0 on error." Test script: --------------- <?php // requires ODBC support $db = odbc_connect('this','should','fail'); print_r($db); ?> Expected result: ---------------- According to the documentation, it could spit out FALSE. Actual result: -------------- It always spits out 0. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=62761&edit=1

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