Moodle
  1. Moodle
  2. MDL-27341

Flickr_Public repostiory returns invalid JSON string error

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.2, 2.1
    • Fix Version/s: 2.0.4
    • Component/s: Repositories
    • Environment:
      Windows Server 2008 R2SP1; PHP 5.3.5
    • Rank:
      17036

      Description

      When files are found after search, invalid JSON string error is returned in the filepicker. Error does not occur if no files are found.

      ERROR: Invalid JSON string
      Notice: Undefined property: stdClass::$flickr_public_16_tag in C:\inetpub\MoodleGit\moodle\repository\flickr_public\lib.php on line 287

      Notice: Undefined property: stdClass::$flickr_public_16_text in C:\inetpub\MoodleGit\moodle\repository\flickr_public\lib.php on line 292
      {"total":"0","perpage":24,"manage":"http:\/\/www.flickr.com\/photos\/622

        Issue Links

          Activity

          Hide
          Mark Emery added a comment -

          To fix, edit moodle\repository\flickr_public\Lib.php,

          Line 283:
          if (!empty($SESSION->{$this->sess_tag}) // use tag to search
          or !empty($SESSION->{$this->sess_text}) // use keyword to search
          or !empty($this->nsid)/use pre-defined accound/) {

          insert after line 285:

          if (empty($SESSION->{$this->sess_tag})) { $SESSION->{$this->sess_tag} = ''; }
          if (empty($SESSION->{$this->sess_text})) { $SESSION->{$this->sess_text} = ''; }
          if (empty($SESSION->{$this->nsid})) { $SESSION->{$this->nsid} = ''; }

          The IF statement has three OR conditions which can cause references to undefined variables in the next statement. These lines ensure each variable is defined before being referenced.

          The filepicker correctly returns the files found with this change.

          Show
          Mark Emery added a comment - To fix, edit moodle\repository\flickr_public\Lib.php, Line 283: if (!empty($SESSION->{$this->sess_tag}) // use tag to search or !empty($SESSION->{$this->sess_text}) // use keyword to search or !empty($this->nsid)/ use pre-defined accound /) { insert after line 285: if (empty($SESSION->{$this->sess_tag})) { $SESSION->{$this->sess_tag} = ''; } if (empty($SESSION->{$this->sess_text})) { $SESSION->{$this->sess_text} = ''; } if (empty($SESSION->{$this->nsid})) { $SESSION->{$this->nsid} = ''; } The IF statement has three OR conditions which can cause references to undefined variables in the next statement. These lines ensure each variable is defined before being referenced. The filepicker correctly returns the files found with this change.
          Hide
          Dongsheng Cai added a comment -

          Thanks Mark,

          Will fix this for next development cycle.

          Regards,
          Dongsheng

          Show
          Dongsheng Cai added a comment - Thanks Mark, Will fix this for next development cycle. Regards, Dongsheng
          Hide
          Dongsheng Cai added a comment -

          Fixed in my github branch.

          Show
          Dongsheng Cai added a comment - Fixed in my github branch.
          Hide
          Andrew Davis added a comment -

          I havent actually been able to run this yet as Im having trouble logging into flickr. Im not sure Ive ever successfully logged into anything run by Yahoo.

          Anyhow, the code itself looks great. Much easier to read than the previous version.

          Show
          Andrew Davis added a comment - I havent actually been able to run this yet as Im having trouble logging into flickr. Im not sure Ive ever successfully logged into anything run by Yahoo. Anyhow, the code itself looks great. Much easier to read than the previous version.
          Hide
          Mark Emery added a comment - - edited

          Once we got it working, the repository listed only public files in or own account. We expected the search function to search all public images in Flickr. As far as we can tell, the search function never returns results. Even images with tags in our own account are not returned by a search for the tag values.
          I expected that just about any search would always return some images from Flickr public library.

          Show
          Mark Emery added a comment - - edited Once we got it working, the repository listed only public files in or own account. We expected the search function to search all public images in Flickr. As far as we can tell, the search function never returns results. Even images with tags in our own account are not returned by a search for the tag values. I expected that just about any search would always return some images from Flickr public library.
          Hide
          Dongsheng Cai added a comment -

          Mark, can you file another bug for searching and assign to me, I will look into it ASAP.

          Show
          Dongsheng Cai added a comment - Mark, can you file another bug for searching and assign to me, I will look into it ASAP.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Integrated, thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - Integrated, thanks!
          Hide
          Tomaz Lasic added a comment -

          Inserted Flickr public image OK. No error messages if no results found.

          Show
          Tomaz Lasic added a comment - Inserted Flickr public image OK. No error messages if no results found.
          Hide
          Tomaz Lasic added a comment -

          See last comment. Inserted Flickr_Public images OK. No error if no search results.

          Show
          Tomaz Lasic added a comment - See last comment. Inserted Flickr_Public images OK. No error if no search results.
          Hide
          Michael de Raadt added a comment -

          Also tested this successfully.

          Show
          Michael de Raadt added a comment - Also tested this successfully.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          All git & cvs servers have been updated with these cool changes, so closing, many thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - All git & cvs servers have been updated with these cool changes, so closing, many thanks!

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: