View Issue Details

This bug affects 1 person(s).
 2
IDProjectCategoryView StatusLast Update
07773Bug reportsRemoteControlpublic2013-04-23 09:07
ReporterExile13 Assigned Toc_schmitz  
PrioritynormalSeveritypartial_block 
Status closedResolutionfixed 
Product Version2.00+ 
Fixed in Version2.00+ 
Summary07773: Remote API Fails on import survey.lss
Description

Remote API returns an INTERNAL 500 error when running the import_survey call:

the error:

Warning: fopen(http://???/limesurvey/index.php/admin/remotecontrol) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.0 500 Internal Server Error in /var/www/???/jsonRPCClient.php on line 133

Fatal error: Uncaught exception 'Exception' with message 'Unable to connect to http://???/limesurvey/index.php/admin/remotecontrol' in /var/www/???/jsonRPCClient.php:141 Stack trace: #0 /var/www/???/rd_functions.php(175): jsonRPCClient->__call('import_survey', Array) #1 /var/www/???/rd_functions.php(175): jsonRPCClient->import_survey('t9zh424ur5d6kmd...', 'PD94bWwgdmVyc2l...', 'lss', NULL, '968189') #2 /var/www/???/rd_functions.php(18): importSurvey('968189', 'limesurvey_surv...') #3 {main} thrown in /var/www/???/jsonRPCClient.php on line 141

Steps To Reproduce

Steps:
1: get file content > base64
2: get session key
3: import survey
4: release session key

the code:

function importSurvey($SurveyID, $strFilename) {
global $DATABASE_SETTINGS;

    define( 'LS_USER', '****' );
    define( 'LS_PASSWORD', '****' );

//1: get file content
$file = ???->qn_filepath . $strFilename;

echo "<br>File exists:"; var_dump(file_exists($file));
if(!file_exists($file))
{
return "File not found @ ". $file;
}

    $hFile = fopen($file,&quot;r&quot;);

    $data = fread($hFile, filesize($file));
    //var_dump($data);
    $data = base64_encode($data);
    //var_dump($data);
    fclose($hFile);

    if($data == null)
        return &quot;Error reading file content: &quot;. $file;

    // instantiate a new client 
    $rpcClient = new jsonRPCClient(?->rpcClient .&quot;/limesurvey/index.php/admin/remotecontrol&quot;, $debug=true);

/2: get session key
$SessionKey = $rpcClient->get_session_key( LS_USER, LS_PASSWORD );

echo "<br>SessionKey: "; var_dump($SessionKey);
if($SessionKey == null)
return "Error getting ls session key: ". $SessionKey;

//3: import survey
$result = $rpcClient->import_survey($SessionKey, $data, "lss", null, $SurveyID);
print_rr($result);
if(is_array($result))
{//fail
$rpcClient->release_session_key( $SessionKey );
return $result->status;
}else{
$SurveyID = $result;

        $result = $rpcClient->activate_survey($SessionKey, $SurveyID);
        print_rr($result);
    }

//4: release session key
$rpcClient->release_session_key( $SessionKey );

    return $SurveyID;
}

//util funtions:
function print_rr($value)
{
echo "<PRE>";
print_r($value);
echo "</PRE>";
}

Additional Information

donate: NO! this bug tracking process has been a horrible nightmare

TagsNo tags attached.
Attached Files
Bug heat2
Complete LimeSurvey version number (& build)120931
I will donate to the project if issue is resolvedNo
Browsern/a
Database type & versionMySQL 5.1.62 & 5.1.49-3
Server OS (if known)Linux lamp 2.6.32-5-686
Webserver software & version (if known)Apache/2.2.16 (Debian)
PHP VersionPHP 5.3.3-7+squeeze3 & PHP v5.4.13

Users monitoring this issue

There are no users monitoring this issue.

Activities

Exile13

Exile13

2013-04-22 17:51

reporter   ~25051

Error in old build of ls: 120931
fixed in 130406

Issue History

Date Modified Username Field Change
2013-04-18 12:06 Exile13 New Issue
2013-04-18 12:06 Exile13 File Added: limesurvey_survey_968189.lss
2013-04-22 17:51 Exile13 Note Added: 25051
2013-04-23 09:07 c_schmitz Status new => closed
2013-04-23 09:07 c_schmitz Assigned To => c_schmitz
2013-04-23 09:07 c_schmitz Resolution open => fixed
2013-04-23 09:07 c_schmitz Fixed in Version => 2.00+