Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-35262

YouTube repository tries to get the next results when no results are returned

    XMLWordPrintable

    Details

    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE

      Description

      When browsing the YouTube repository and searching for something that does not return anything like "$%^*", the picker will try to load the next results (as the scroll bar reaches the bottom). That results in a lot of useless queries and will eventually end up with a JSON error because YouTube kicked us.

      (see screenshot)

      To replicate

      1. Go to a forum and create a new post
      2. Add some media using TinyMCE picker, and browse the YouTube repository
      3. Search for $%^*

      Expected:

      • No results, nothing happens

      Actual:

      • There is an endless loop to get the next results

      JSON error after several queries:

      Invalid JSON string
       
      Warning: simplexml_load_string(): Entity: line 1: parser error : Start tag expected, 'search() /home/fred/www/repositories/im/moodle/repository/repository_ajax.php:152
          0.1782   42337800   3. repository_youtube->_get_collection() /home/fred/www/repositories/im/moodle/repository/youtube/lib.php:89
          0.4423   42360320   4. simplexml_load_string() /home/fred/www/repositories/im/moodle/repository/youtube/lib.php:109
       
       
      Warning: simplexml_load_string(): You cannot request beyond item 1000. in /home/fred/www/repositories/im/moodle/repository/youtube/lib.php on line 109
       
      Call Stack:
          0.0006     861192   1. {main}() /home/fred/www/repositories/im/moodle/repository/repository_ajax.php:0
          0.1782   42336480   2. repository_youtube->search() /home/fred/www/repositories/im/moodle/repository/repository_ajax.php:152
          0.1782   42337800   3. repository_youtube->_get_collection() /home/fred/www/repositories/im/moodle/repository/youtube/lib.php:89
          0.4423   42360320   4. simplexml_load_string() /home/fred/www/repositories/im/moodle/repository/youtube/lib.php:109
       
       
      Warning: simplexml_load_string(): ^ in /home/fred/www/repositories/im/moodle/repository/youtube/lib.php on line 109
       
      Call Stack:
          0.0006     861192   1. {main}() /home/fred/www/repositories/im/moodle/repository/repository_ajax.php:0
          0.1782   42336480   2. repository_youtube->search() /home/fred/www/repositories/im/moodle/repository/repository_ajax.php:152
          0.1782   42337800   3. repository_youtube->_get_collection() /home/fred/www/repositories/im/moodle/repository/youtube/lib.php:89
          0.4423   42360320   4. simplexml_load_string() /home/fred/www/repositories/im/moodle/repository/youtube/lib.php:109
       
       
      Notice: Trying to get property of non-object in /home/fred/www/repositories/im/moodle/repository/youtube/lib.php on line 110
       
      Call Stack:
          0.0006     861192   1. {main}() /home/fred/www/repositories/im/moodle/repository/repository_ajax.php:0
          0.1782   42336480   2. repository_youtube->search() /home/fred/www/repositories/im/moodle/repository/repository_ajax.php:152
          0.1782   42337800   3. repository_youtube->_get_collection() /home/fred/www/repositories/im/moodle/repository/youtube/lib.php:89
       
       
      Fatal error: Call to a member function children() on a non-object in /home/fred/www/repositories/im/moodle/repository/youtube/lib.php on line 110
       
      Call Stack:
          0.0006     861192   1. {main}() /home/fred/www/repositories/im/moodle/repository/repository_ajax.php:0
          0.1782   42336480   2. repository_youtube->search() /home/fred/www/repositories/im/moodle/repository/repository_ajax.php:152
          0.1782   42337800   3. repository_youtube->_get_collection() /home/fred/www/repositories/im/moodle/repository/youtube/lib.php:89
      
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              fred Frédéric Massart
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: