|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-09-03 13:36 UTC] rangercairns@php.net
-Status: Open
+Status: Wont fix
[2015-09-03 13:36 UTC] rangercairns@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 16:00:01 2025 UTC |
Description: ------------ I think the extension should either ignore i5_lib or throw an exception when i5_naming is set to DB2_I5_NAMING_ON. What it actually does is it uses the i5_lib on the 2nd call to the connection. This is a very hard to find bug When making a connection with db2_pconnect with the options i5_lib set to a library and i5_naming set to DB2_I5_NAMING_ON the executed SQL on the first call to the connection uses the default library of the previous connection. In the documentation, it states i5_lib is not valid if the connection is using system naming mode. Test Script: In the test script below you'll see 4 connections are made to production and then 6 connections and sql calls are made to Development. On the 1st connection to development it still goes against a PRODUCTION library. PHP Documentation: i5_lib - A character value that indicates the default library that will be used for resolving unqualified file references. This is not valid if the connection is using system naming mode. Test script: --------------- <?php // Simulate connections to production applications $db = connectToProduction('USER1','MYPASS'); $db = connectToProduction('USER2','MYPASS'); $db = connectToProduction('USER3','MYPASS'); $db = connectToProduction('USER4','WEBUSER'); $i = 0; while($i <= 5) { // Simulate connection to development application 6 times $db = connectToDevelopment(); $sql = "SELECT ENV FROM LIBTEST"; $stmt = db2_prepare($db, $sql); $result = db2_execute($stmt); $row = db2_fetch_assoc($stmt); echo $row['ENV']."<br>"; $i++; } function connectToProduction($username, $password) { $db = db2_pconnect('*LOCAL', $username, $password, [ 'i5_naming' => DB2_I5_NAMING_ON, 'i5_libl' => 'PRODLIB', 'i5_lib' => 'PRODLIB' ] ); if (!$db){throw new Exception('Connection failed');} echo "Production DB connection successful<br>"; return $db; } function connectToDevelopment() { $db = db2_pconnect('*LOCAL', 'WEBTEST', 'WEBTEST', [ 'i5_naming' => DB2_I5_NAMING_ON, 'i5_libl' => 'DEVLIB', 'i5_lib' => 'DEVLIB' ] ); if (!$db){throw new Exception('Connection failed');} echo "Development DB connection successful<br>"; return $db; } Expected result: ---------------- Production DB connection successful<br> Production DB connection successful<br> Production DB connection successful<br> Production DB connection successful<br> Development DB connection successful<br> development Development DB connection successful<br> development Development DB connection successful<br> development Development DB connection successful<br> development Development DB connection successful<br> development Development DB connection successful<br> development Actual result: -------------- Production DB connection successful<br> Production DB connection successful<br> Production DB connection successful<br> Production DB connection successful<br> Development DB connection successful<br> production Development DB connection successful<br> development Development DB connection successful<br> development Development DB connection successful<br> development Development DB connection successful<br> development Development DB connection successful<br> development