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

Block tag_youtube can prevent tag page to load

    Details

    • Testing Instructions:
      Hide
      1. Go to manage tags
      2. Add some tags
      3. Click on one of them, one with a "real" name like "muchachada"
      4. Add tag_youtube block
      5. You SHOULD see a The Youtube API key is not set. Contact your administrator. message
      6. Set your google api key in site admin -> plugins -> blocks -> youtube
      7. Go to the same tag page where you added the block
      8. You SHOULD NOT see any fatal error and "muchachada" videos should be listed
      9. Add another tag_youtube block to the same page, edit it and configure it to set a playlist
      10. You SHOULD NOT see any fatal error and videos should be listed
      11. Edit the last tag_youtube block instance you added and set the playlist to an unexisting playlist id like "asdasdasdasd"
      12. You SHOULD see Data could not be obtained from the server. Contact your administrator if the problem persist. in an alert-error notification + a debugging message (dev mode enabled)
      13. Change your google api key to a wrong value
      14. Go to the tag page, you SHOULD see Data could not be obtained from the server. Contact your administrator if the problem persist. in an alert-error notification + a debugging message (dev mode enabled)
      Show
      Go to manage tags Add some tags Click on one of them, one with a "real" name like "muchachada" Add tag_youtube block You SHOULD see a The Youtube API key is not set. Contact your administrator. message Set your google api key in site admin -> plugins -> blocks -> youtube Go to the same tag page where you added the block You SHOULD NOT see any fatal error and "muchachada" videos should be listed Add another tag_youtube block to the same page, edit it and configure it to set a playlist You SHOULD NOT see any fatal error and videos should be listed Edit the last tag_youtube block instance you added and set the playlist to an unexisting playlist id like "asdasdasdasd" You SHOULD see Data could not be obtained from the server. Contact your administrator if the problem persist. in an alert-error notification + a debugging message (dev mode enabled) Change your google api key to a wrong value Go to the tag page, you SHOULD see Data could not be obtained from the server. Contact your administrator if the problem persist. in an alert-error notification + a debugging message (dev mode enabled)
    • Affected Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE, MOODLE_30_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-49085_master
    • Sprint:
      Team '; drop tables Sprint 9

      Description

      To reproduce:

      • Go to Site administration > Appearences > Manage tags
      • Create a new tag and click on its name
      • Turn editing on and add "youtube" block

      I noticed this on Moodle.org when I tried to access the page https://moodle.org/tag/index.php?tag=moodle

      I asked Matt the details of the exception, here they are:

       
      [Wed Feb 04 11:53:50.785954 2015] [:error] [pid 27970] [client 150.101.174.144:52055] PHP Warning:  SimpleXMLElement::__construct(): Entity: line 1: parser error : Start tag expected, '<' not found in /var/www/vhosts/moodle.org/html/blocks/tag_youtube/block_tag_youtube.php on line 173, referer: https://moodle.org/login/index.php
       
      [Wed Feb 04 11:53:50.785982 2015] [:error] [pid 27970] [client 150.101.174.144:52055] PHP Warning:  SimpleXMLElement::__construct(): name lookup timed out in /var/www/vhosts/moodle.org/html/blocks/tag_youtube/block_tag_youtube.php on line 173, referer: https://moodle.org/login/index.php
       
      [Wed Feb 04 11:53:50.785990 2015] [:error] [pid 27970] [client 150.101.174.144:52055] PHP Warning:  SimpleXMLElement::__construct(): ^ in /var/www/vhosts/moodle.org/html/blocks/tag_youtube/block_tag_youtube.php on line 173, referer: https://moodle.org/login/index.php
       
      [Wed Feb 04 11:53:50.786583 2015] [:error] [pid 27970] [client 150.101.174.144:52055] Default exception handler: Exception - String could not be parsed as XML Debug: 
      Error code: generalexceptionmessage
      * line 173 of /blocks/tag_youtube/block_tag_youtube.php: Exception thrown
      * line 173 of /blocks/tag_youtube/block_tag_youtube.php: call to SimpleXMLElement->__construct()
      * line 130 of /blocks/tag_youtube/block_tag_youtube.php: call to block_tag_youtube->fetch_request()
      * line 75 of /blocks/tag_youtube/block_tag_youtube.php: call to block_tag_youtube->get_videos_by_tag()
      * line 288 of /blocks/moodleblock.class.php: call to block_tag_youtube->get_content()
      * line 230 of /blocks/moodleblock.class.php: call to block_base->formatted_contents()
      * line 962 of /lib/blocklib.php: call to block_base->get_content_for_output()
      * line 1014 of /lib/blocklib.php: call to block_manager->create_block_contents()
      * line 392 of /lib/outputrenderers.php: call to block_manager->ensure_content_created()
      * line 27 of /theme/moodleorgcleaned/layout/moodleorg/columns2.php: call to core_renderer->standard_head_html()
      * line 915 of /lib/outputrenderers.php: call to include()
      * line 845 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
      * line 80 of /tag/index.php: call to core_renderer->header()
      , referer: https://moodle.org/login/index.php
      

      Essentially the response from YouTube is not valid XML, causing an exception while loading it. We should handle the case where the response was not valid, due to a timeout or whatever, and ignore it.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    14/Sep/15