Doc #62761 [NEW]: Returns an ODBC connection id or 0 (FALSE) on error. Which is it?
| From: | mmellon at ecrs dot com | Date: | Mon, 06 Aug 2012 19:57:52 +0000 |
| Subject: | Doc #62761 [NEW]: Returns an ODBC connection id or 0 (FALSE) on error. Which is it? | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-8703@lists.php.net to get a copy of this message | ||
From: mmellon at ecrs dot com
Operating system: Windows
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:Returns an ODBC connection id or 0 (FALSE) on error. Which is it?
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 bug report at https://bugs.php.net/bug.php?id=62761&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62761&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62761&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62761&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=62761&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62761&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=62761&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=62761&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=62761&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=62761&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=62761&r=support
Expected behavior: https://bugs.php.net/fix.php?id=62761&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=62761&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=62761&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=62761&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62761&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62761&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=62761&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=62761&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=62761&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=62761&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=62761&r=mysqlcfg