php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #46702 On odbc_pconnect() error empty string returned instead of 0
Submitted: 2008-11-27 21:48 UTC Modified: 2008-11-28 13:43 UTC
From: yusp at bk dot ru Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: Windows XP Pro SP2
Private report: No CVE-ID: None
 [2008-11-27 21:48 UTC] yusp at bk dot ru
Description:
------------
Documentation on ODBC functions:
http://www.php.net/manual/en/function.odbc-pconnect.php
http://www.php.net/manual/en/function.odbc-connect.php

On odbc_pconnect() and odbc_pconnect() error empty string is really returned instead of 0 agree to documentation.

Reproduce code:
---------------
<script Language="PHP">
@$ODBCConnect = odbc_connect ("NonExistentDSN", "", "", SQL_CUR_USE_ODBC);
echo "[$ODBCConnect]";
</script>


Expected result:
----------------
[0]

Actual result:
--------------
[]

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-28 13:43 UTC] rquadling@php.net
Doing a var_dump() on $ODBCConnect shows that a boolean False is 
returned.

When False is expressed as a string (as in your example), an empty 
string is the result.

This is expected behaviour.

http://www.php.net/manual/en/language.types.string.php#language.types
.string.casting

"A boolean TRUE value is converted to the string "1". Boolean FALSE 
is converted to "" (the empty string). This allows conversion back 
and forth between boolean and string values."
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 14:01:32 2024 UTC