#42544 [NEW]: mssql_select_db changes all open connections OR new_link boolean doesn't work
| From: | walter at wjd dot nu | Date: | Tue, 04 Sep 2007 14:31:29 +0000 |
| Subject: | #42544 [NEW]: mssql_select_db changes all open connections OR new_link boolean doesn't work | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-117108@lists.php.net to get a copy of this message | ||
From: walter at wjd dot nu
Operating system: linux/debian, linux/ubuntu
PHP version: 4.4.7
PHP Bug Type: Sybase-ct (ctlib) related
Bug description: mssql_select_db changes all open connections OR new_link boolean doesn't work
Description:
------------
The new_link boolean in mssql_connect does not do what its supposed to do
for me. When select_db'ing the second open link, the first link gets
affected. var_dump tells me that both connections are the same.
When I'm using mssql_pconnect instead of connect, I do get another
resource number for the second connection, but the bug that selects the
wrong database, still remains.
Is this a wrong version thing? Does mssql_select_db/mssql_query use the
wrong database handle? Does the new_link boolean not work as it should?
I'm lying about the PHP version in the select box; I don't have that exact
version lying around. But I've seen that this bug was dismissed in March
2006 (http://bugs.php.net/bug.php?id=36639) when there was no 4.4.7.
Latest version I've tested it on, is (I've tested on 4.4.4 as well):
$ php5 -v
PHP 5.1.6 (cli) (built: Jul 17 2007 17:45:52)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
$ dpkg -l *sybase | grep syb
ii php5-sybase 5.1.6-1ubuntu2.6 Sybase / MS SQL Server module for
php5
Reproduce code:
---------------
<?php
// call me as:
// php5 test.php server user pass database_right database_wrong
// or:
// php5 test.php server user pass database_right database_wrong bug
// when calling with 'bug' you get success for the wrong reason.
$users = mssql_connect($argv[1], $argv[2], $argv[3], true);
mssql_select_db($argv[4], $users);
$management = mssql_connect($argv[1], $argv[2], $argv[3], true);
mssql_select_db($argv[5], $management);
if (@$argv[6] == 'bug')
mssql_select_db($argv[4], $management);
echo '$users: '; var_dump($users);
echo '$management: '; var_dump($management);
if (($q = mssql_query("SELECT TOP 1 LDN_id FROM LEDEN", $users)))
echo "\nSuccess!\n";
else
echo "\nFailed!\n";
?>
Expected result:
----------------
$users: resource(4) of type (sybase-ct link)
$management: resource(5) of type (sybase-ct link)
Success!
Actual result:
--------------
$users: resource(4) of type (sybase-ct link)
$management: resource(4) of type (sybase-ct link)
Warning: mssql_query(): Sybase: Server message: Invalid object name
'LEDEN'. (severity 16, procedure N/A) in /tmp/test.php on line 14
Failed!
--
Edit bug report at http://bugs.php.net/?id=42544&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42544&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42544&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42544&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42544&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=42544&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42544&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42544&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42544&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42544&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42544&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=42544&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=42544&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42544&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42544&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42544&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42544&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42544&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42544&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42544&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42544&r=mysqlcfg