]> granicus.if.org Git - php/commitdiff
Fixed bug concerning mysql default_link that got freed too soon (Mc).
authorMarc Boeren <mboeren@php.net>
Tue, 12 Jun 2001 15:32:22 +0000 (15:32 +0000)
committerMarc Boeren <mboeren@php.net>
Tue, 12 Jun 2001 15:32:22 +0000 (15:32 +0000)
Added the test-case to te connect-test-file (Mc).

ext/dbx/dbx_mysql.c
ext/dbx/tests/003.phpt

index d11b2accc9de8f70526817ba201ad901639afafa..2102d3a734fe918e23ca497cb2827a81d80781f7 100644 (file)
@@ -51,6 +51,7 @@ int dbx_mysql_connect(zval ** rv, zval ** host, zval ** db, zval ** username, zv
         /* also close connection */
         number_of_arguments=1;
         arguments[0]=&returned_zval;
+        zend_list_addref(returned_zval->value.lval);
         dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_close", &select_db_zval, number_of_arguments, arguments);
         if (select_db_zval) zval_ptr_dtor(&select_db_zval);
         zval_ptr_dtor(&returned_zval);
@@ -88,6 +89,7 @@ int dbx_mysql_pconnect(zval ** rv, zval ** host, zval ** db, zval ** username, z
         /* also close connection */
         number_of_arguments=1;
         arguments[0]=&returned_zval;
+        zend_list_addref(returned_zval->value.lval);
         dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_close", &select_db_zval, number_of_arguments, arguments);
         if (select_db_zval) zval_ptr_dtor(&select_db_zval);
         zval_ptr_dtor(&returned_zval);
index 254b9038780ede394f7ea0c64ecffee776060615..2c5a8ec76264b7d4ba9c0ac86449a6c2ee81534d 100644 (file)
@@ -79,6 +79,19 @@ else {
     print_r($dlo);
        dbx_close($dlo);
     }
+$dlo1 = dbx_connect($module, $host, $database, $username, $password);
+$dlo2 = dbx_connect($module, $host, $database, $username, $password);
+if ($dlo1!=0 && $dlo2!=0) {
+       print('multiple connects ok'."\n");
+       dbx_close($dlo1);
+       dbx_close($dlo2);
+       }
+$dlo1 = dbx_connect($module, $host, $database, $username, $password);
+$dlo2 = dbx_connect($module, $host, $nonexisting_database, $username, $password);
+if ($dlo1!=0 && $dlo2==0) {
+       print('multiple connects (2nd fails on database-name) ok'."\n");
+       dbx_close($dlo1);
+       }
 ?>
 --EXPECT--
 connect using string ok
@@ -90,4 +103,6 @@ persistent connect using constant ok
 persistent connect to non-existing database failed, so it's ok
 persistent connect with false username/password combi failed, so it's ok
 too many parameters: connect failure works ok
-too few parameters: connect failure works ok
\ No newline at end of file
+too few parameters: connect failure works ok
+multiple connects ok
+multiple connects (2nd fails on database-name) ok
\ No newline at end of file