View Issue Details

IDProjectCategoryView StatusLast Update
13339Bug reports[All Projects] Otherpublic2018-02-22 11:49
Reporterdapster105 Assigned Toc_schmitz  
Status closedResolutionfixed 
Product Version3.1.x 
Target VersionFixed in Version3.4.x 
Summary13339: ipaddr field always records 'invalid'

ip addresses are not recorded properly

Steps To Reproduce

create survey as non-anonymous and request ip addresses are captured. Check database for completed responses. ipaddr field will be filled with 'invalid'

TagsNo tags attached.
Complete LimeSurvey version number (& build)3.1.0+180124
I will donate to the project if issue is resolvedNo
Database & DB-VersionSql Server
Server OS (if known)Win
Webserver software & version (if known)IIS
PHP Versionlatest




2018-02-13 14:29

administrator   ~46408

Last edited: 2018-02-16 18:22

View 2 revisions

This might happen if your LImeSurvey installation cannot properly determine the IP address to a server misconfiguration.

In application/helpers/common_helper.php around line 4709
modify the existing code to look like that

if (!filter_var($sIPAddress, FILTER_VALIDATE_IP)) {
    var_dump($_SERVER); var_dump($sIPAddress); die();
    return 'Invalid';

and run the survey. This will dump some information on screen - if your screen is just white look at the HTML source.

Let us know what output you get.



2018-02-20 13:22

administrator   ~46607

Feedback please?



2018-02-21 11:12

reporter   ~46635

Thanks for the hint, it helped me find a local fix in the GetIPAddress function in common_helper.

On Azure (my host) $_SERVER['HTTP_X_FORWARDED_FOR'] returns a non-empty string, though not a valid ip address.

My local solution was to promote $_SERVER['REMOTE_ADDR'] higher up the ifelse block so this value is picked up.

A proper 'fix' would probably be to have the ifelse block checking for a valid ip address, not just checking if !empty?



2018-02-21 11:41

administrator   ~46641

Just out of curiosity: What string did it return?



2018-02-21 11:56

administrator   ~46643

Fix committed to master branch:



2018-02-21 12:39

administrator   ~46649

Fix committed to master branch:



2018-02-22 11:49

reporter   ~46717

I actually didn't note it at the time (just observed the non-empty invalid ip condition) but just ran a test and on Azure I get (real ips hidden):


REMOTE_ADDR: 999.99.99.999

HTTP_X_FORWARDED_FOR: 999.99.99.999:99999

so the HTTP_X_FORWARDED_FOR includes a port number which could, presumably, be stripped off. The IP itself is identical to REMOTE_ADDR in my case.

Interestingly, I have read elsewhere ( that in certain conditions, HTTP_X_FORWARDED_FOR can contain a sequence of comma-separated IP addresses.

Related Changesets

LimeSurvey: master 829e5122

2018-02-21 11:49:15


Details Diff
Fixed issue 13339: IP address field always records 'invalid'
Dev All available methods are tried now until a valid email address is found, otherwise is assumed.
Dev The value 'Invalid' will not be used anymore.
Affected Issues
mod - application/helpers/common_helper.php Diff File

LimeSurvey: master 6151cda8

2018-02-21 12:31:35


Details Diff
Fixed issue 13339: IP address field always records 'invalid' Affected Issues
mod - application/helpers/common_helper.php Diff File

Issue History

Date Modified Username Field Change
2018-02-12 23:50 dapster105 New Issue
2018-02-13 14:29 c_schmitz Assigned To => c_schmitz
2018-02-13 14:29 c_schmitz Status new => feedback
2018-02-13 14:29 c_schmitz Note Added: 46408
2018-02-16 18:22 c_schmitz Note Edited: 46408 View Revisions
2018-02-20 13:22 c_schmitz Note Added: 46607
2018-02-21 11:12 dapster105 Note Added: 46635
2018-02-21 11:12 dapster105 Status feedback => assigned
2018-02-21 11:41 c_schmitz Note Added: 46641
2018-02-21 11:55 c_schmitz Status assigned => resolved
2018-02-21 11:55 c_schmitz Resolution open => fixed
2018-02-21 11:55 c_schmitz Fixed in Version => 3.4.x
2018-02-21 11:56 c_schmitz Changeset attached => LimeSurvey master 829e5122
2018-02-21 11:56 c_schmitz Note Added: 46643
2018-02-21 12:39 c_schmitz Changeset attached => LimeSurvey master 6151cda8
2018-02-21 12:39 c_schmitz Note Added: 46649
2018-02-21 16:37 ollehar Status resolved => closed
2018-02-22 11:49 dapster105 Note Added: 46717