]> granicus.if.org Git - php/commitdiff
Fixed bug #39979 (PGSQL_CONNECT_FORCE_NEW will causes next connect to
authorIlia Alshanetsky <iliaa@php.net>
Sun, 7 Jan 2007 04:36:40 +0000 (04:36 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 7 Jan 2007 04:36:40 +0000 (04:36 +0000)
establish a new connection).

NEWS
ext/pgsql/pgsql.c

diff --git a/NEWS b/NEWS
index bc1ab09422f826f023a1263e0751f11407eade2c..3ded00318b987c8bb487445d98d1f54c50ad87b8 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ PHP                                                                        NEWS
   CMD.EXE. (Dmitry)  
 - Fixed bug #40036 (empty() does not work correctly with ArrayObject when using
   ARRAY_AS_PROPS). (Ilia)
+- Fixed bug #39979 (PGSQL_CONNECT_FORCE_NEW will causes next connect to
+  establish a new connection). (Ilia)
 - Fixed bug #39504 (xmlwriter_write_dtd_entity() creates Attlist tag,
   not entity). (Hannes)
 
index e5c9fd823fca9114ee78de8e6fdb68b6c6bc28ad..d055170c196666e3ec4108e086439ba763878671 100644 (file)
@@ -629,6 +629,16 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
        smart_str_appends(&str, "pgsql");
        
        for (i = 0; i < ZEND_NUM_ARGS(); i++) {
+               /* make sure that the PGSQL_CONNECT_FORCE_NEW bit is not part of the hash so that subsequent connections
+                * can re-use this connection. Bug #39979
+                */ 
+               if (i == 1 && ZEND_NUM_ARGS() == 2 && Z_TYPE_PP(args[i]) == IS_LONG) {
+                       if (Z_LVAL_PP(args[1]) == PGSQL_CONNECT_FORCE_NEW) {
+                               continue;
+                       } else if (Z_LVAL_PP(args[1]) & PGSQL_CONNECT_FORCE_NEW) {
+                               smart_str_append_long(&str, Z_LVAL_PP(args[1]) ^ PGSQL_CONNECT_FORCE_NEW);
+                       }
+               }
                convert_to_string_ex(args[i]);
                smart_str_appendc(&str, '_');
                smart_str_appendl(&str, Z_STRVAL_PP(args[i]), Z_STRLEN_PP(args[i]));