View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
18051Bug reportsRemoteControlpublic2022-05-09 12:39
Reporterchris1337 Assigned ToDenisChenu  
PrioritynoneSeveritypartial_block 
Status closedResolutionfixed 
Product Version3.28.x 
Summary18051: API: Deleting a question crashes in 3.x (already fixed in 5.x)
Description

When deleting a question via the Remote Control API using the delete_question method, the call yields an error page with the PHP message "Using $this when not in object context".

The reason seems that in application/helpers/remotecontrol_handle.php, in the function delete_question, the call to Question::updateQuestionOrder is done without object context:

Question::updateQuestionOrder($iGroupID);

(see https://github.com/LimeSurvey/LimeSurvey/blob/cc85dda79baf83e2a81bfcb60b61f173180c3d70/application/helpers/remotecontrol/remotecontrol_handle.php#L1360)

In the 5.0 branch, this line has been replaced with the more modern (?) method Question::updateSortOrder, which doesn't require an object context:

Question::updateSortOrder($iGroupID, $iSurveyID);

(see https://github.com/LimeSurvey/LimeSurvey/blob/f337a9866afd021ddb8b75079a61cb36eddb1782/application/helpers/remotecontrol/remotecontrol_handle.php#L1454)

Replacing the line accordingly in our local PHP files fixes the problem for us. We suggest backporting this change to the 3.x-LTS branch as well.

Steps To Reproduce

Steps to reproduce

  1. Create a new LimeSurvey installation from the 3.x-LTS branch
  2. Create any survey with a question in it.
  3. Try to erase the question using the RemoteControl API, using the delete_question method and the according qid.

Expected result

The question is erased, and the qid returned as JSON result to the request.

Actual result

The question gets erased, but the API crashes with the PHP error "Using $this when not in object context", displayed on an HTML error page.

TagsNo tags attached.
Bug heat4
Complete LimeSurvey version number (& build)3.28.7+220420
I will donate to the project if issue is resolvedNo
Browser
Database type & version 5.5.5, MariaDB:10.7.3
Server OS (if known)
Webserver software & version (if known)
PHP Version 7.4.29

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2022-04-28 18:14

developer   ~69289

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

DenisChenu

DenisChenu

2022-05-06 22:19

developer   ~69498

Fix committed to 3.x-LTS branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=33467

LimeBot

LimeBot

2022-05-09 12:39

administrator   ~69513

Fixed in Release 3.28.10+220510

Related Changesets

LimeSurvey: 3.x-LTS 14abf654

2022-05-07 00:17

DenisChenu

Committer: GitHub


Details Diff
Fixed issue 18051: RemoteControl API: Deleting a question crashes (#2377)

Dev: use same function then 5.x
Dev: thanks chris1337
Affected Issues
18051
mod - application/helpers/remotecontrol/remotecontrol_handle.php Diff File

Issue History

Date Modified Username Field Change
2022-04-26 12:59 chris1337 New Issue
2022-04-27 09:01 galads Assigned To => DenisChenu
2022-04-27 09:01 galads Status new => assigned
2022-04-28 18:14 DenisChenu Assigned To DenisChenu =>
2022-04-28 18:14 DenisChenu Status assigned => ready for code review
2022-04-28 18:14 DenisChenu Note Added: 69289
2022-04-28 18:14 DenisChenu Bug heat 0 => 2
2022-05-06 22:15 c_schmitz Assigned To => c_schmitz
2022-05-06 22:15 c_schmitz Status ready for code review => resolved
2022-05-06 22:15 c_schmitz Resolution open => fixed
2022-05-06 22:19 DenisChenu Changeset attached => LimeSurvey 3.x-LTS 14abf654
2022-05-06 22:19 DenisChenu Note Added: 69498
2022-05-06 22:19 DenisChenu Assigned To c_schmitz => DenisChenu
2022-05-09 12:39 LimeBot Note Added: 69513
2022-05-09 12:39 LimeBot Status resolved => closed
2022-05-09 12:39 LimeBot Bug heat 2 => 4