View Issue Details

This bug affects 1 person(s).
 22
IDProjectCategoryView StatusLast Update
11161Bug reportsImport/Exportpublic2016-06-13 12:27
Reportergalmeida Assigned Toc_schmitz  
PrioritynoneSeverityminor 
Status closedResolutionno change required 
Product Version2.50.x 
Fixed in Version2.50.x 
Summary11161: Error HTTP/400 when clicking "Import a question" button
Description

When clicking the "Import a question" button on LimeSurvey V2.50+ Build 160506 the request fails with error HTTP 400 Invalid request.

Steps To Reproduce

Select a survey. Press "List questions". Press "Import a question". Request fails with invalid request error .

Additional Information

Apache log:
GET /index.php/admin/questions/sa/importview/surveyid/333646 HTTP/1.1" 400 1200

Request header:

Host: lime01-dev.xxx.dev
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Language: en,en-US;q=0.8,pt-PT;q=0.5,pt;q=0.3
Accept-Encoding: gzip, deflate
DNT: 1
Referer: http://lime01-dev.xxx.dev/index.php/admin/survey/sa/listquestions/surveyid/333646
Cookie: __utma=2300716.2075578767.1429526731.1429526731.1439203376.2; PHPSESSID=r1g3umeeip7f14nqf1fpu1l6v7; YII_CSRF_TOKEN=a5132f34655e48bf0692ebd4f16bf7f020746deb
Connection: keep-alive

TagsNo tags attached.
Attached Files
php_warning.zip (5,593 bytes)
CHttpException.zip (5,148 bytes)
CHttpException-3.zip (5,151 bytes)
CHttpException-4.zip (5,120 bytes)
Bug heat22
Complete LimeSurvey version number (& build)160506
I will donate to the project if issue is resolvedNo
BrowserFirefox 46.0
Database type & versionpostgresql91-9.1.2-1PGDG.rhel6.x86_64
Server OS (if known)CentOS release 6.4 2.6.32-358.el6.x86_64
Webserver software & version (if known)httpd-2.2.15-29.el6.centos.x86_64
PHP VersionPHP 5.3.3 Zend Engine v2.3.0

Relationships

has duplicate 11156 closedc_schmitz PHP Warning in template editor 
related to 11142 closedc_schmitz template editir dies if expected template does not exist (should revert to default) 

Users monitoring this issue

galmeida

Activities

ollehar

ollehar

2016-05-12 10:19

administrator   ~38399

Is this the only page you get 400?

galmeida

galmeida

2016-05-12 10:29

reporter   ~38404

Last edited: 2016-05-12 10:31

Yes, the server replies with HTTP/400.
Is there any test I can perform to help debug this issue?

c_schmitz

c_schmitz

2016-05-12 10:36

administrator   ~38406

Please activate debug mode in /application/config/config.php and see if you get a more elaborate error.

galmeida

galmeida

2016-05-12 10:51

reporter   ~38441

I'm getting a full-page PHP warning after enabling debug mode (attached).

ollehar

ollehar

2016-05-12 10:53

administrator   ~38443

Last edited: 2016-05-12 11:07

Please upgrade the latest LimeSurvey build released today and let us know if that fixed your issue.

c_schmitz

c_schmitz

2016-05-12 11:07

administrator   ~38448

:-)

galmeida

galmeida

2016-05-12 11:32

reporter   ~38453

I've upgraded to 2.50+ build 160512, set ug+rw permissions for apache on tmp, upload and application/config, but I'm still getting a 400 error.
Would a wire level protocol capture help?

c_schmitz

c_schmitz

2016-05-12 11:37

administrator   ~38458

Did you set a custom template as standard template in global settings?
If yes, can you set it to 'default' and try again?

galmeida

galmeida

2016-05-12 11:47

reporter   ~38461

I do have a custom template, but it is not set as default.
The default template is 'default' (Flat and Modern).
The survey I'm testing on is also using the 'default' theme.

c_schmitz

c_schmitz

2016-05-12 11:49

administrator   ~38462

Last edited: 2016-05-12 11:53

I can see from the debug output that the clear_logo template is trying to be used.
Clear_logo is not a factory template, anymore and not supported.
Can you check again, please?

galmeida

galmeida

2016-05-12 12:25

reporter   ~38463

The only files I copied over from the old install were config.php and a template.
I grepped for 'clear_logo' and did not find it.
This indicates that the 'clear_logo' reference comes from the database, that was in fact upgraded from an earlier version.
I dumped the database and sure enough, there are several references to 'clear_logo' on the followin tables: 'lime_permssions', 'lime_surveys' and 'lime_templates'.
I'll try to replace those references with 'default' and will report back.

galmeida

galmeida

2016-05-12 12:50

reporter   ~38464

Having fixed the 'clear_logo' issue, I enbled the debug mode ang got a stacktrace (attached) to go with the 400 error.
Hopefully you will be able to figure out what is wrong.

c_schmitz

c_schmitz

2016-05-12 12:50

administrator   ~38465

Ok, thank you - that helped to locate the error - we will provide a patch soon.

galmeida

galmeida

2016-05-12 12:51

reporter   ~38466

Thank you for your prompt response! :-)

c_schmitz

c_schmitz

2016-05-12 12:58

administrator   ~38468

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

c_schmitz

c_schmitz

2016-05-12 12:59

administrator   ~38469

Can you check the patch and please report if the issue is fixed for you?

galmeida

galmeida

2016-05-12 13:36

reporter   ~38478

I applied the patch, but the issue remains.
I was going to upload the stacktrace, but it is virtually the same as before.

c_schmitz

c_schmitz

2016-05-12 13:59

administrator   ~38479

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

galmeida

galmeida

2016-05-12 16:55

reporter   ~38501

I'm still getting the attached stacktrace after applying both patches.

ollehar

ollehar

2016-05-12 16:57

administrator   ~38502

Try to upgrade your PHP version to at least 5.4.

c_schmitz

c_schmitz

2016-05-12 17:14

administrator   ~38504

The issue in the stacktrace is a new one.
Probably you did an error when patching?
You should wait for the next release version and do a full update then to make sure that all file are genuine.

c_schmitz

c_schmitz

2016-05-17 12:41

administrator   ~38610

Version 2.50+ Build 160516 released

galmeida

galmeida

2016-05-18 12:17

reporter   ~38663

Hello,

I installed latest build 160517 with a clean database but I can still trigger this issue.
Do you consider that upgrading to php 5.4 is the only workaround?
Thank you in advance.

c_schmitz

c_schmitz

2016-05-25 21:47

administrator   ~38909

If you look into your file /application/config/config.php,
what is set in the line 'Urlformat' ?
Did you do any custom settings in config.php ?

LouisGac

LouisGac

2016-06-07 16:47

developer   ~39294

Last edited: 2016-06-07 16:48

So, after reading in detail the error logs in the last zip file, it became clear.

Here the requested URL reported by CHttpException:

CWebApplication->runController("admin/questions/sa/importview")

It should be something like:

CWebApplication->runController("admin/questions/sa/importview/surveyid/{A_SURVEY_ID}")

IE: there is no surveyid in the URL.

So, you can reproduce the bug by accessing directly to the url :
admin/questions/sa/importview

But the button "import a question" itself contains a link pointing to admin/questions/sa/importview/surveyid/{A_SURVEY_ID}. So even if the surveyid would have been wrong for any reason, the CHttpException should have shown :
CWebApplication->runController("admin/questions/sa/importview/surveyid/{something}")

So at least the latest CHttpException ziped file can't have been generated clicking on the button. I bet it has been generated just reloading a page with a wrong URL (I can be wrong).

Here the code to generate the button itself :
https://github.com/LimeSurvey/LimeSurvey/blob/master/application/views/admin/survey/surveybar_view.php#l63-l66

There's no way this code is going to generate a url such as the one indicated in the last zip file.

So, just update to last version, and everything should work like a charm.

c_schmitz

c_schmitz

2016-06-13 12:27

administrator   ~39492

Version 2.50 Build 160613 released

Related Changesets

LimeSurvey: master c0d84a4f

2016-05-12 10:58:16

c_schmitz

Details Diff
Fixed issue 11161: Error when clicking "Import a question" button Affected Issues
11161
mod - application/models/Template.php Diff File

LimeSurvey: master fa3d1092

2016-05-12 11:59:11

c_schmitz

Details Diff
Fixed issue 11161: Error when clicking "Import a question" button Affected Issues
11161
mod - application/controllers/admin/templates.php Diff File
mod - application/models/AdminTheme.php Diff File
mod - application/models/TemplateConfiguration.php Diff File
mod - application/views/admin/super/header.php Diff File

Issue History

Date Modified Username Field Change
2016-05-11 19:49 galmeida New Issue
2016-05-12 10:19 ollehar Note Added: 38399
2016-05-12 10:29 galmeida Note Added: 38404
2016-05-12 10:31 galmeida Note Edited: 38404
2016-05-12 10:36 c_schmitz Note Added: 38406
2016-05-12 10:36 c_schmitz Assigned To => c_schmitz
2016-05-12 10:36 c_schmitz Status new => feedback
2016-05-12 10:50 galmeida File Added: php_warning.zip
2016-05-12 10:51 galmeida Note Added: 38441
2016-05-12 10:51 galmeida Status feedback => assigned
2016-05-12 10:53 ollehar Note Added: 38443
2016-05-12 11:07 c_schmitz Note Edited: 38443
2016-05-12 11:07 c_schmitz Note Added: 38448
2016-05-12 11:32 galmeida Note Added: 38453
2016-05-12 11:37 c_schmitz Note Added: 38458
2016-05-12 11:47 galmeida Note Added: 38461
2016-05-12 11:49 c_schmitz Note Added: 38462
2016-05-12 11:53 c_schmitz Note Edited: 38462
2016-05-12 12:25 galmeida Note Added: 38463
2016-05-12 12:36 galmeida Issue Monitored: galmeida
2016-05-12 12:36 galmeida File Added: CHttpException.zip
2016-05-12 12:50 galmeida Note Added: 38464
2016-05-12 12:50 c_schmitz Note Added: 38465
2016-05-12 12:51 galmeida Note Added: 38466
2016-05-12 12:58 c_schmitz Changeset attached => LimeSurvey master c0d84a4f
2016-05-12 12:58 c_schmitz Note Added: 38468
2016-05-12 12:58 c_schmitz Resolution open => fixed
2016-05-12 12:59 c_schmitz Note Added: 38469
2016-05-12 12:59 c_schmitz Status assigned => resolved
2016-05-12 12:59 c_schmitz Fixed in Version => 2.5
2016-05-12 13:00 c_schmitz Relationship added related to 11142
2016-05-12 13:36 galmeida Note Added: 38478
2016-05-12 13:59 c_schmitz Changeset attached => LimeSurvey master fa3d1092
2016-05-12 13:59 c_schmitz Note Added: 38479
2016-05-12 14:01 c_schmitz Relationship added related to 11156
2016-05-12 16:54 galmeida File Added: CHttpException-3.zip
2016-05-12 16:55 galmeida Note Added: 38501
2016-05-12 16:57 ollehar Note Added: 38502
2016-05-12 17:14 c_schmitz Note Added: 38504
2016-05-13 11:49 c_schmitz Relationship replaced has duplicate 11156
2016-05-17 12:41 c_schmitz Note Added: 38610
2016-05-17 12:41 c_schmitz Status resolved => closed
2016-05-18 12:17 galmeida Note Added: 38663
2016-05-18 12:17 galmeida Status closed => feedback
2016-05-18 12:17 galmeida Resolution fixed => reopened
2016-05-18 12:17 galmeida File Added: CHttpException-4.zip
2016-05-25 21:47 c_schmitz Note Added: 38909
2016-06-07 16:47 LouisGac Note Added: 39294
2016-06-07 16:47 LouisGac Status feedback => resolved
2016-06-07 16:47 LouisGac Resolution reopened => no change required
2016-06-07 16:48 LouisGac Note Edited: 39294
2016-06-13 12:27 c_schmitz Note Added: 39492
2016-06-13 12:27 c_schmitz Status resolved => closed
2021-08-02 17:37 guest Bug heat 18 => 22