View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
14338Bug reportsSurvey editingpublic2018-12-12 09:53
Reporterming123ABC Assigned ToDenisChenu  
PrioritynoneSeveritypartial_block 
Status closedResolutionno change required 
Product Version3.4.x 
Fixed in Version3.6.x 
Summary14338: question type:Date can not use
Description

I uses question type:Date in my survey

But i try to view question before actives survey

It showes

:Internal Server Error
Unknown "json_encode" function. Did you mean "json_decode"?
An internal error occurred while the Web server was processing your request. Please contact the webmaster to report this problem.

TagsNo tags attached.
Attached Files
Bug heat4
Complete LimeSurvey version number (& build)3.4.0+180219
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMSSQL 2008
Server OS (if known)Windows server 2012 R2
Webserver software & version (if known)IIS
PHP Version5.5.36

Users monitoring this issue

There are no users monitoring this issue.

Activities

ming123ABC

ming123ABC

2018-12-12 07:44

reporter   ~49931

If i need to po more information

Plz tell me

ming123ABC

ming123ABC

2018-12-12 07:45

reporter   ~49932

I try to po some # to code

filename: answer.twig

{# Set option for launch, can not set to default : maybe more than one datetimepicker in page #}
{# get the same default value than qanda_helper #}
{#% set aJsonOption = json_encode({#
#'format' : dateformatdetailsjs,#
#'minDate' : mindate[0] == '{' ? '2018-01-01' : mindate,#
#'maxDate' : maxdate[0] == '{' ? '2037-12-31' : maxdate,#
#'sideBySide' : true#

})

#%#}

I view survey,datepick can show

BUT i finish survey, it show:[Could not convert date 11/19/2018 1:49 PM to format d.m.Y. Please check your date format settings.

ming123ABC

ming123ABC

2018-12-12 07:46

reporter   ~49933

I list my error code

LimeSurvey 3.5.0\application\views\survey\questions\answer\date\selector\answer.twig(52)

{% set aJsonOption = json_encode({
53 'format' : dateformatdetailsjs,
54 'minDate' : mindate[0] == '{' ? '1900-01-01' : mindate,
55 'maxDate' : maxdate[0] == '{' ? '2037-12-31' : maxdate,
56 'sideBySide' : true
57 })
58 %}

DenisChenu

DenisChenu

2018-12-12 08:01

developer   ~49934

Last edited: 2018-12-12 08:02

Related forum post : https://www.limesurvey.org/forum/design-issues/117185-question-type-date-can-not-use?start=15#178185
issue with twig

https://github.com/LimeSurvey/LimeSurvey/blob/a794eb59b0d90e0a21507b57ab761547942065c5/application/config/internal.php#L280
added in 3.5 : https://github.com/LimeSurvey/LimeSurvey/commit/71e7fbf949de45ec77632c83ed38fa20c907b0d8

Didn't understand why it break for you, but there are something in your config, instance or server.

ming123ABC

ming123ABC

2018-12-12 08:06

reporter   ~49935

So i need to po config file?

ming123ABC

ming123ABC

2018-12-12 08:25

reporter   ~49936

config.php

config.php (2,511 bytes)   
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| DATABASE CONNECTIVITY SETTINGS
| -------------------------------------------------------------------
| This file will contain the settings needed to access your database.
|
| For complete instructions please consult the 'Database Connection'
| page of the User Guide.
|
| -------------------------------------------------------------------
| EXPLANATION OF VARIABLES
| -------------------------------------------------------------------
|
|    'connectionString' Hostname, database, port and database type for 
|     the connection. Driver example: mysql. Currently supported:
|                 mysql, pgsql, mssql, sqlite, oci
|    'username' The username used to connect to the database
|    'password' The password used to connect to the database
|    'tablePrefix' You can add an optional prefix, which will be added
|                 to the table name when using the Active Record class
|
*/
return array(
	'components' => array(
		'db' => array(
			'connectionString' => 'sqlsrv:Server=localhost;Database=limesurveyDevelop',
			'username' => '',
			'password' => '',
			'charset' => 'utf8',
			'tablePrefix' => 'lime_',
			'initSQLs'=>array('SET DATEFORMAT ymd;','SET QUOTED_IDENTIFIER ON;'),
		),
		
		// Uncomment the following line if you need table-based sessions
		// 'session' => array (
			// 'class' => 'application.core.web.DbHttpSession',
			// 'connectionID' => 'db',
			// 'sessionTableName' => '{{sessions}}',
		// ),
		
		'urlManager' => array(
			'urlFormat' => 'get',
			'rules' => array(
				// You can add your own rules here
			),
			'showScriptName' => true,
		),
	
	),
	// Use the following config variable to set modified optional settings copied from config-defaults.php
	'config'=>array(
	// debug: Set this to 1 if you are looking for errors. If you still get no errors after enabling this
	// then please check your error-logs - either in your hosting provider admin panel or in some /logs directory
	// on your webspace.
	// LimeSurvey developers: Set this to 2 to additionally display STRICT PHP error messages and get full access to standard templates
		'debug'=>1,//1
		'debugsql'=>0, //0 // Set this to 1 to enanble sql logging, only active when debug = 2
		// Update default LimeSurvey config here
		'enableLdap'=>true, //enable LDAP 20160729
	)
);
/* End of file config.php */
/* Location: ./application/config/config.php */
config.php (2,511 bytes)   
ming123ABC

ming123ABC

2018-12-12 08:30

reporter   ~49938

There are different codes in 3.5

my internal code:

'functions' => array('include', 'dump', 'flatEllipsizeText', 'getLanguageData', 'array_flip', 'array_intersect_key', 'registerPublicCssFile', 'registerTemplateCssFile', 'registerGeneralScript', 'registerTemplateScript', 'registerScript', 'registerPackage', 'unregisterPackage', 'registerCssFile', 'registerScriptFile', 'unregisterScriptFile', 'unregisterScriptForAjax', 'listCoreScripts', 'listScriptFiles', 'getAllQuestionClasses', 'intval', 'count', 'empty', 'reset', 'renderCaptcha', 'getPost', 'getParam', 'getQuery', 'isset', 'str_replace', 'assetPublish', 'image', 'imageSrc', 'sprintf', 'gT', 'ngT', 'createUrl', 'json_decode'),


added in 3.5 :

'functions' => array('include', 'dump', 'flatEllipsizeText', 'getLanguageData', 'array_flip', 'array_intersect_key', 'registerPublicCssFile', 'registerTemplateCssFile', 'registerGeneralScript', 'registerTemplateScript', 'registerScript', 'registerPackage', 'unregisterPackage', 'registerCssFile', 'registerScriptFile', 'unregisterScriptFile', 'unregisterScriptForAjax', 'listCoreScripts', 'listScriptFiles', 'getAllQuestionClasses', 'intval', 'count', 'empty', 'reset', 'renderCaptcha', 'getPost', 'getParam', 'getQuery', 'isset', 'str_replace', 'assetPublish', 'image', 'imageSrc', 'sprintf', 'gT', 'ngT', 'createUrl', 'json_decode', 'json_encode'),

ming123ABC

ming123ABC

2018-12-12 08:40

reporter   ~49941

@@

I add [json_encode] to internal.php

It is still error

ming123ABC

ming123ABC

2018-12-12 08:44

reporter   ~49942

@@

I add

'json_encode' => 'CJSON::encode',

, 'json_encode'

It would work

I will try to test !

DenisChenu

DenisChenu

2018-12-12 09:46

developer   ~49944

UPDATE before make a bug report …

ming123ABC

ming123ABC

2018-12-12 09:53

reporter   ~49945

Thx you

Because i want to update system, i must tell boss why i have to update

After this,i will tell boss the reason

Issue History

Date Modified Username Field Change
2018-12-12 07:44 ming123ABC New Issue
2018-12-12 07:44 ming123ABC Note Added: 49931
2018-12-12 07:45 ming123ABC Note Added: 49932
2018-12-12 07:46 ming123ABC Note Added: 49933
2018-12-12 08:01 DenisChenu Note Added: 49934
2018-12-12 08:02 DenisChenu Note Edited: 49934
2018-12-12 08:06 ming123ABC Note Added: 49935
2018-12-12 08:25 ming123ABC File Added: config.php
2018-12-12 08:25 ming123ABC Note Added: 49936
2018-12-12 08:30 ming123ABC Note Added: 49938
2018-12-12 08:40 ming123ABC Note Added: 49941
2018-12-12 08:44 ming123ABC Note Added: 49942
2018-12-12 09:46 DenisChenu Assigned To => DenisChenu
2018-12-12 09:46 DenisChenu Status new => closed
2018-12-12 09:46 DenisChenu Resolution open => no change required
2018-12-12 09:46 DenisChenu Fixed in Version => 3.6.x
2018-12-12 09:46 DenisChenu Note Added: 49944
2018-12-12 09:53 ming123ABC Note Added: 49945
2019-11-01 17:25 c_schmitz Category Survey design => Survey editing