View Issue Details

This issue affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
06038Bug reportsSurvey participants (Tokens)public2012-04-22 14:21
Reporterledut Assigned Toc_schmitz  
PrioritynormalSeverityminor 
Status closedResolutionnot fixable 
Product Version1.92+ 
Summary06038: Token date validation fails if GMT is not 0 because Php date and ADODB date are not synchronized !
Description

The dates set for a token ('Valid from' and 'valid until' dates) on the token management page may not be respected if local time zone is not the GMT one.
Consequence : a token is set to be valid for a certain period but when a user try to use it during this period, the system throw an error and the user can not fill the survey despite it should be able to.

This bug occurs because the database date time and the php date time are not equal by default !! (explanation below)

Steps To Reproduce
  • Check your local machine time zone, it should not be the GMT one (edit it if needed).
  • Create a survey with access controled by tokens
  • on the token management page, create a token from now to the next hour.
  • Try to fill the survey (click on 'Do survey' next to your token entry).
    ---> the error message is displayed : 'We are sorry but you are not allowed to enter this survey. Your token seems to be valid but can be used only during a certain time period.'
Additional Information

The error message is throw from the /index.php file, line 724.
Here is a fast debug code expliciting the bug, comparing the current time from Php and adodb :

echo "

Date :
php =\t".date("Y-m-d H:i:s"). "
mysql =\t". $connect->getOne('SELECT NOW()');
echo "

Timestamp :
php =\t".time(). "
mysql =\t". $connect->getOne('SELECT UNIX_TIMESTAMP()');
echo "

GMT :
php =\t". date_default_timezone_get() ."
mysql =\t". $connect->getOne('SELECT @@global.time_zone') . '
';

It returns :

Date :
php = 2012-04-21 22:00:50 --> error !
mysql = 2012-04-22 00:00:50

Timestamp :
php = 1335045650
mysql = 1335045650

GMT :
php = UTC --> GMT time zone (+0)
mysql = SYSTEM --> on my local machine, it is +2h

As an example :
For a token set to be valid from 00:00:00 to 01:00:00, if we try to fill the survey at 00:00:50 : the php validation time becomes 22:00:00 to 23:00:00, that why the system throw an error.

Note : this date bug may affect the survey start date and expire date to !

TagsNo tags attached.
Bug heat6
Complete LimeSurvey version number (& build)120418
I will donate to the project if issue is resolvedNo
Browserfirefox
Database type & versionmysql v5.5.20
Server OS (if known)windows7
Webserver software & version (if known)wamp v2.2
PHP Version5.3.9
Git branch / Pull Request URL

Users monitoring this issue

ledut

Activities

c_schmitz

c_schmitz

2012-04-22 07:55

administrator   ~18462

Did you set the time difference correction in global settings (general tab) ?

ledut

ledut

2012-04-22 08:54

reporter   ~18463

No, it is the defaut value (0).
But I suggest it should automatically be set to the machine local time, because that what is done for the mysql date.

c_schmitz

c_schmitz

2012-04-22 09:10

administrator   ~18464

I am sorry, but in general PHP (and so LimeSurvey) does not know about your local machine time timezone unless you configure it correctly.
Please have a look at http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone

Issue History

Date Modified Username Field Change
2012-04-22 00:46 ledut New Issue
2012-04-22 00:47 ledut Issue Monitored: ledut
2012-04-22 07:55 c_schmitz Note Added: 18462
2012-04-22 07:55 c_schmitz Assigned To => c_schmitz
2012-04-22 07:55 c_schmitz Status new => feedback
2012-04-22 08:54 ledut Note Added: 18463
2012-04-22 08:54 ledut Status feedback => assigned
2012-04-22 09:10 c_schmitz Note Added: 18464
2012-04-22 14:21 c_schmitz Status assigned => closed
2012-04-22 14:21 c_schmitz Resolution open => not fixable
2016-12-08 10:39 c_schmitz Category Tokens => Survey participants (Tokens)
2021-08-02 17:23 guest Bug heat 4 => 6