Menu

#125 [PHP]Connect will not fail when passing a error userid value to the second parameter

open
nobody
None
5
2012-03-15
2012-03-15
Jira Trac
No

Test Build: CUBRID 2008 R4.1 (8.4.1.1018) (64bit release build for linux_gnu)
OS: Linux 64
Description:
Passing a error userid value to the second parameter and correct userid value contained by conn_url parameter, connect will not fail.
Passing a error passwd value to the third parameter and correct passwd value contained by conn_url parameter, connect will fail.
[cubrid_connect_with_url|http://www.php.net/manual/en/function.cubrid-connect-with-url.php] method
resource cubrid_connect_with_url ( string $conn_url [, string $userid [, string $passwd [, bool $new_link = false ]]] )

Repro steps:
1. execute: php urlTest.phpt
statement in urlTest.phpt
{noformat}
include_once(connect.inc);
$conn1=cubrid_connect_with_url(CUBRID:$host:$port:$db:$user:$passwd:::?autocommit=on,aaaa);
if (FALSE == $conn1) {
printf([001]Expect: return value false. [%d] [%s]\n, cubrid_error_code(), cubrid_error_msg());
}elseif(TRUE == $conn1){
printf([001]No Expect: return value true\n);
cubrid_close($conn1);
}else{
printf([001]no true and no false);
}

$conn2=cubrid_connect_with_url(CUBRID:$host:$port:$db:$user:$passwd:::?autocommit=on,dba,123456);
if (FALSE == $conn2) {
printf([002]Expect: return value false. [%d] [%s]\n, cubrid_error_code(), cubrid_error_msg());
}elseif(TRUE == $conn2){
printf([002]No Expect: return value true\n);
cubrid_close($conn2);
}else{
printf([002]no true and no false);
}

$conn3=cubrid_connect_with_url(CUBRID:$host:$port:$db:$user:$passwd:::?autocommit=on);
if (FALSE == $conn3) {
printf([003]No Expect: return value false. [%d] [%s]\n, cubrid_error_code(), cubrid_error_msg());
}elseif(TRUE == $conn3){
printf([003]Expect: return value true\n);
cubrid_close($conn3);
}else{
printf([003]no true and no false);
}
{noformat}

Actual result:
{noformat}
[001]No Expect: return value true
PHP Warning: Error: DBMS, 0, Unknown DBMS error in /home/php/phpTestcases/_03_close/urlTest.phpt on line 21
[002]Expect: return value false. [0] [Unknown DBMS error]
[003]Expect: return value true
{noformat}

Expect result:
Maybe the connect in those two situation will be same. Both fail or both success.

Discussion

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.