Skip to content

Commit

Permalink
Fixed issue #8039: Problems with subquestion code '0'
Browse files Browse the repository at this point in the history
DEV: Both described issues were separate incidences of
DEV: the same thing: php empty()/($var) treat the '0'
DEV: as not set or empty.
DEV: isset() on the other hand also returns "" as true.
DEV: I am afraid this problem may be present more often in
DEV: the code. Maybe implement a custom function
DEV: is_set() which also returns FALSE for "" but TRUE for '0'
  • Loading branch information
mfaber committed Aug 2, 2013
1 parent 0954b64 commit d5801ca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion application/helpers/viewHelper.php
Expand Up @@ -122,7 +122,7 @@ public static function getFieldCode($field, $option=array())
if(isset($field['title']) && $field['title'])
{
$questioncode=$field['title'];
if(isset($field['aid']) && $field['aid'])
if(isset($field['aid']) && $field['aid']!="")
{
if(is_array($option['separator'])){ // Count ?
$questioncode.=$option['separator'][0].$field['aid'].$option['separator'][1];
Expand Down
2 changes: 1 addition & 1 deletion application/libraries/PluginManager/LimesurveyApi.php
Expand Up @@ -158,7 +158,7 @@ public function getResponse($surveyId, $responseId)
{
$code = $fieldmap[$key]['title'];
// Add subquestion code if needed
if (array_key_exists('aid', $fieldmap[$key]) && !empty($fieldmap[$key]['aid'])) {
if (array_key_exists('aid', $fieldmap[$key]) && isset($fieldmap[$key]['aid']) && $fieldmap[$key]['aid']!='') {
$code .= '_' . $fieldmap[$key]['aid'];
}
// Only add if the code does not exist yet and is not empty
Expand Down

0 comments on commit d5801ca

Please sign in to comment.