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

PHP Notice: Trying to get property of non-object

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      fix covered with unittest. Alternatively:

      1. create a course with url resource in it
      2. call the webservice's method "core_course_get_contents" on this course
      3. make sure there are no errors in php log
      Show
      fix covered with unittest. Alternatively: create a course with url resource in it call the webservice's method "core_course_get_contents" on this course make sure there are no errors in php log
    • Affected Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE
    • Pull Master Branch:
      wip-MDL-39233-master

      Description

      In our PHP Logfile there´s a PHP Notice:

      PHP Notice: Trying to get property of non-object in /var/www/html/moodle_prod/mod/url/lib.php on line 320
      PHP Notice: Trying to get property of non-object in /var/www/html/moodle_prod/mod/url/lib.php on line 325

      I researched that the $url get db content in line 310. In line 318 there´s a variable $url = array() defined. However the code need access to the data in $url from the db in line 320 and line 325. I think that it should be possible to fix this bug by rename one of the two $url variables.

      Thanks,
      Benjamin Droemer
      Ulm University

      To reproduce it, you need to call the webservice's method "core_course_get_contents", and the error will happen if the course contains a resource of type "url".

        Attachments

          Activity

            People

            Assignee:
            marina Marina Glancy
            Reporter:
            beni_x91 Benjamin Droemer
            Peer reviewer:
            Mark Nelson
            Integrator:
            Damyon Wiese
            Tester:
            Adrian Greeve
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
            Votes:
            1 Vote for this issue
            Watchers:
            9 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              8/Sep/14