View Issue Details

This bug affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
17423Bug reportsInstallationpublic2021-07-29 10:10
Reportergaelrayot Assigned Togalads  
PrioritynoneSeveritypartial_block 
Status closedResolutionfixed 
Product Version5.x 
Summary17423: Unable to use a custom DB port
Description

During the install, in the wizard, when configuring the DB, if a port is set in the DB location field, the connection to the database fail.

Steps To Reproduce

put localhost:5432 in the DB location field to test with a postgres DB. Fail with a MySQL DB also.

Additional Information

Looking in application/models/InstallerConfigForm.php, the function getDbPort return the port but does not remove it from the host, leading the DSN construct to return host=localhost:5432;port:5432 instead of host=localhost;port:5432.
Seems to affect 4.x and 5.x

TagsNo tags attached.
Bug heat8
Complete LimeSurvey version number (& build)4.4.10
I will donate to the project if issue is resolvedNo
Browser
Database type & versionPostgresql13
Server OS (if known)Debian
Webserver software & version (if known)
PHP Version7.4

Users monitoring this issue

There are no users monitoring this issue.

Activities

gaelrayot

gaelrayot

2021-07-19 11:43

reporter   ~65509

Here is a fix for application/models/InstallerConfigForm.php file.

installer.patch (744 bytes)   
@@ -47,6 +47,8 @@
     public $dbtype;
     /** @var string $dblocation */
     public $dblocation = 'localhost';
+    /** @var string $dbport */
+    public $dbport;
     /** @var  string $dbname */
     public $dbname;
 
@@ -570,10 +572,11 @@
         if (strpos($this->dblocation, ':') !== false) {
             $pieces = explode(':', $this->dblocation, 2);
             if (isset($pieces[1]) && is_numeric($pieces[1])) {
-                return $pieces[1];
+                $this->dblocation = str_replace(":" . $pieces[1], "", $this->dblocation);
+                $this->dbport = $pieces[1];
             }
         }
-        return $this->getDbDefaultPort();
+        return $this->dbport ?? $this->getDbDefaultPort();
     }
 
     /**
installer.patch (744 bytes)   
ollehar

ollehar

2021-07-22 17:58

administrator   ~65580

Last edited: 2021-07-29 10:09

Can you do a PR on github for this, perhaps?

gaelrayot

gaelrayot

2021-07-23 13:13

reporter   ~65594

Last edited: 2021-07-29 10:09

https://github.com/LimeSurvey/LimeSurvey/pull/1980

guest

guest

2021-07-28 12:27

viewer   ~65672

Last edited: 2021-07-29 10:09

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=32405

galads

galads

2021-07-29 10:10

reporter   ~65726

Fixed and merged

Related Changesets

LimeSurvey: master 1c4a45ab

2021-07-28 12:11:09

grayot


Committer: GitHub Details Diff
Fixed issue 17423: Fix database custom port not being used (#1980) Affected Issues
17423
mod - application/controllers/InstallerController.php Diff File
mod - application/models/InstallerConfigForm.php Diff File

Issue History

Date Modified Username Field Change
2021-07-08 07:31 gaelrayot New Issue
2021-07-08 09:30 galads Assigned To => galads
2021-07-08 09:30 galads Status new => ready for testing
2021-07-19 11:43 gaelrayot Note Added: 65509
2021-07-19 11:43 gaelrayot File Added: installer.patch
2021-07-22 12:49 galads Status ready for testing => confirmed
2021-07-22 17:58 ollehar Note Added: 65580
2021-07-23 13:13 gaelrayot Note Added: 65594
2021-07-28 12:27 Changeset attached => LimeSurvey master 1c4a45ab
2021-07-28 12:27 guest Note Added: 65672
2021-07-29 10:09 galads Sync to Zoho Project => |Yes|
2021-07-29 10:10 galads Note Added: 65726
2021-07-29 10:10 galads Status confirmed => closed
2021-07-29 10:10 galads Resolution open => fixed