Bug #72175 [Com]: Impossibility of creatiing multiple connections to Interbase with php 7.0

From: Date: Mon, 23 Jan 2017 14:31:03 +0000
Subject: Bug #72175 [Com]: Impossibility of creatiing multiple connections to Interbase with php 7.0
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206893@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72175&edit=1 ID: 72175 Comment by: netvicious at gmail dot com Reported by: netvicious at gmail dot com Summary: Impossibility of creatiing multiple connections to Interbase with php 7.0 Status: Open Type: Bug Package: InterBase related Operating System: Ubuntu 16.04 LTS PHP Version: 7.0.6 Block user comment: N Private report: N New Comment: Between 7.0.2 and 7.0.3 there are a lot of chantes (7.0.0 to 7.0.3 the list it's bigger). **7.0.2************************************************************************** xlink = (zend_resource*) le->ptr; if ((!persistent && xlink->type == le_link) || xlink->type == le_plink) { if (IBG(default_link) > 0) { zval *link = zend_hash_index_find(&EG(regular_list), IBG(default_link)); if (link) { zend_list_delete(Z_RES_P(link)); } } xlink->gc.refcount++; xlink->gc.refcount++; IBG(default_link) = xlink->handle; RETVAL_RES(xlink); } else { zend_hash_str_del(&EG(regular_list), hash, sizeof(hash)-1); } **7.0.3************************************************************************** xlink = (zend_resource*) le->ptr; if ((!persistent && xlink->type == le_link) || xlink->type == le_plink) { if (IBG(default_link)) { zend_list_close(IBG(default_link)); } xlink->gc.refcount++; xlink->gc.refcount++; IBG(default_link) = xlink; RETVAL_RES(xlink); } else { zend_hash_str_del(&EG(regular_list), hash, sizeof(hash)-1); } They only changed some things related to lists and a way to check the "default_link". I don't know where it's the problem, but the word default_link says to me something like there only can be one NON-persistent link to the firebird/interbase database. Because that code it paster before it's inside one if /* try to reuse a connection */ if ((le = zend_hash_str_find_ptr(&EG(regular_list), hash, sizeof(hash)-1)) != NULL) { And after that if we have something that seems to create a persistent one /* ... or a persistent one */ do { One thing I don't understand it's if we reused a connection why after the if of reusing connection we do a persistent one. If it's really one OR the RETVAL should exit the function like one return statement (I don't know if it does a return). Previous Comments: ------------------------------------------------------------------------ [2017-01-23 14:12:03] us at menatwork dot de I did the tests with Windows. In Version 7.0.0 and 5.6.28 everything is ok. The error comes into with Version 7.0.3. I am not a C Programmer, but is it so dificult to find the difference between 7.0.0 and 7.0.3 ? ------------------------------------------------------------------------ [2017-01-23 12:57:42] netvicious at gmail dot com Hi! It seems we don't had any progress on this bug from a long time ago. Nikic, the patch you published didn't worked and the question you did on 2016-07-10 obviously it's yes, if we close the conx2 the conx1 should be kept as it was before. But the problem it's not when we're closing links, the problem it's when we're connecting a new link. On this process the old link it's closed. It seems to be using a variable for the only one link supported instead of using a list and closing the correct index of the link of the list. If you do a simple echo with the link you can see the links are numbered $conx = ibase_pconnect(DB_HOST . ":" . DB_NAME,DB_USER,DB_PWD,DB_CHARACTER) or die(ibase_errcode() . ' ' . ibase_errmsg()); echo $conx . "<br/>\n"; $conx2 = ibase_pconnect(DB_HOST . ":" . DB_NAME,DB_USER,DB_PWD,DB_CHARACTER) or die(ibase_errcode() . ' ' . ibase_errmsg()); echo $conx2 . "<br/>\n"; If the connections are ok you should get something like: Resource id #1 Resource id #2 The system it's saving the connections in order. The problem should be in some place where it checks if that link was previously connected to database (or in the garbage collector). A similar code should be on the mysql connections and other database drivers. I know you tried to fix it, but I ask you to ask to other php developers which know a bit others database drivers; because that piece of code should be very similar between drivers. Regards, ------------------------------------------------------------------------ [2016-12-13 22:33:49] m dot muncke at computer1020 dot at Hello, I have this problem in freeBSD port ver. 7.0.11 and upgrading to 7.0.14 did not solve the issue. Can we have a release estimate when this fix will be included? Thank you M.Muncke ------------------------------------------------------------------------ [2016-12-06 10:32:48] us at menatwork dot de This bug is still present in version 7.1.0 for Windows ------------------------------------------------------------------------ [2016-07-11 09:22:49] netvicious at gmail dot com Hi nikic, thanks for assigning the bug. The code: $link = ibase_connect($foo); $link2 = ibase_connect($foo); ibase_close($link2); That functions are similar to mysqli, but changing the type of the DB ibase_connect = mysqli_connect ibase_close = mysqli_close If you close $link2, $link should remain open and working. The current problem it's when you're creating a new connection to a database which has another connection opened before in the same script. The first one should remain open and working instead of being closed as it's done with the current interbase module. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=72175 -- Edit this bug report at https://bugs.php.net/bug.php?id=72175&edit=1

« previous php.bugs (#206893) next »