Moodle
  1. Moodle
  2. MDL-3637

'debug' enabled reveals Page class mapping error

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.5.1
    • Fix Version/s: None
    • Component/s: Quiz
    • Labels:
      None
    • Environment:
      All
    • Affected Branches:
      MOODLE_15_STABLE
    • Rank:
      10930

      Description

      I am running Moodle 1.5 + (2005060201), in versions I acquired as tarballs on 19 June 2005 and 22 June 2005.

      In either, when I enable debug mode in the Site variables, then visit a quiz in a course, I get this error notice:

      Page class mapping for id mod-quiz-view exists but class page_quiz is not defined

      Clicking continue gets me back to the home page.

        Activity

        Hide
        Martin Dougiamas added a comment -

        From Jon Papaioannou (pj at moodle.org) Saturday, 25 June 2005, 10:44 AM:

        Taking ownership of this since it has to do with the page classes.

        From Gustav Delius (gwd2 at york.ac.uk) Tuesday, 28 June 2005, 08:40 PM:

        This was also reported in the post http://moodle.org/mod/forum/discuss.php?d=26398

        From Gustav Delius (gwd2 at york.ac.uk) Thursday, 7 July 2005, 11:09 PM:

        Unless we can get more information about this bug we probably should close this.

        From Jon Papaioannou (pj at moodle.org) Thursday, 7 July 2005, 11:49 PM:

        Gustav, I know... it doesn't make much sense. The only theory I have (and a far-fetched one at that) is that require_once('pagelib.php') [meaning /mod/quiz/pagelib.php] fails because PHP (under I don't know what OS) is confused after having already included /lib/pagelib.php.

        I don't know what else it can be, because that is a require() call and it would not continue if e.g. it looked for the correct file but the file was missing. However, it doesn't explain why the problem has been reported to appear on upgraded but NOT on new installations.

        There have been no database changes related to this either.

        From James Dugal (jpd at louisiana.edu) Friday, 8 July 2005, 12:15 AM:

        For what it is worth, one o/s was Solaris 8, with PHP 4.3.11, the

        other o/s was Linux Slackware with PHP 4.3.7. But, both use MMcache 2.4.6. I just now grabbed the latest 1.5+ tarball, and

        I can load it tonight under Linux. I can try disabling MMcache if that would help eliminate a concern. Anything else you'd recommend to help isolate the cause (assuming it still exists

        --James

        From Jon Papaioannou (pj at moodle.org) Friday, 8 July 2005, 10:32 AM:

        The word Solaris rings many bells related to includes (and I assume requires share the same backend), we had troubles in the past that forced us to specify absolute rather than relative paths when including files. The above theory might hold after all... Here's how to test:

        /mod/quiz/view.php line 8 reads:

        require_once('pagelib.php');

        change this to:

        require_once($CFG->dirroot.'/mod/quiz/pagelib.php');

        and see if the problem goes away.

        No idea about the Slackware install, I don't have any previous data on that. Try Solaris first.

        From James Dugal (jpd at louisiana.edu) Friday, 8 July 2005, 12:43 PM:

        PJ - tried your path change to pagelib.php ... no effect, on either

        system (Solaris and Linux). I then used mmcache.php to disable Turck mmcache under Linux. THIS WAS SUCCESSFUL! I did not need to change the path. I then tried disabling mmcache under Solaris, but this appeared to hang to apache process! Oops. Not sure why that

        would happen...there were three suggested ways of specifying the mmcache.so ... maybe that is a factor? So where does this leave us?

        --James

        From Gustav Delius (gwd2 at york.ac.uk) Thursday, 14 July 2005, 09:50 PM:

        I am downgrading this problem because it does not appear to affect many people.

        Jon, the change to absolute paths is generally a good idea and should be implemented everywhere.

        From Jon Papaioannou (pj at moodle.org) Saturday, 16 July 2005, 05:51 AM:

        Not sure what to think about it. It may be specific to your OS/PHP/MMCache combo... unless I can get shell access to that box I can't really do anything.

        I think we should close this as Works For Me.

        From James Dugal (jpd at louisiana.edu) Tuesday, 19 July 2005, 01:45 PM:

        PJ - I was looking again at mod/quiz/pagelib.php, and it occurred to me that the call to page_map_class() was made before the class page_quiz ... line was encountered, and perhaps the class would indeed be unknown. So, what would be the harm in moving the call to page_map_class() to AFTER the class was defined, ie, to just before the last line (?>)? I made this change here and I no longer get the error I reported, and everything else seems to work. If this is indeed a viable change, it should probably be made in mod/chat/pagelib.php too...

        • James

        From Jon Papaioannou (pj at moodle.org) Wednesday, 20 July 2005, 12:59 AM:

        That's a great finding! Puts us on the right track.

        However, I 'd prefer to not solve the problem this way because then the local pagelib files would be more prone to error. Let's fix it by changing lib/pagelib.php a bit. We 'll remove the class_exists check when classes are registered; it's done anyway when class objects are about to be constructed.

        lib/pagelib.php line 107 is:

        if (!class_exists($mappings[$type])) {

        change this to:

        if (empty($classname) && !class_exists($mappings[$type])) {

        and see if the problem is solved (without a modified mod/quiz/pagelib.php)

        From Jon Papaioannou (pj at moodle.org) Wednesday, 20 July 2005, 07:09 AM:

        I just had one of those duh! moments, and I have to ask:

        With a stock Moodle installation, and when debug is NOT enabled, is everything working normally for you? This being a bug report, I assumed it wasn't!!!!

        From James Dugal (jpd at louisiana.edu) Wednesday, 20 July 2005, 09:40 AM:

        PJ - I like your solution better: it's more elegant!

        I think you can close this report as 'fixed' with that small change! Oh, I had no serious problems with my Moodle installation, but I was exploring the metering that debug=yes engages and found this side-effect as I also tried to view a quiz. Merci encore!

        --James

        From Jon Papaioannou (pj at moodle.org) Thursday, 21 July 2005, 01:30 AM:

        Done! Thanks for all the help in this!

        From Luis Gerardo Mendoza (germen at gmail.com) Thursday, 5 January 2006, 02:06 AM:

        I had the same trouble, but perhaps my reason was of another nature. Anyhow... I want to leave my solution for the record.

        In a TEXT type resource, there was this page that linked to a QUIZ resource, but in the URL captured, the url had double slash after the hostname. i.e.

        http://moodle.mydomain.com//mod/quiz/view.php?id=229

        The solution was simply remove the double slash in the href that linked to that resource and Voila!:

        http://moodle.mydomain.com/mod/quiz/view.php?id=229

        Hope it's useulf.

        Show
        Martin Dougiamas added a comment - From Jon Papaioannou (pj at moodle.org) Saturday, 25 June 2005, 10:44 AM: Taking ownership of this since it has to do with the page classes. From Gustav Delius (gwd2 at york.ac.uk) Tuesday, 28 June 2005, 08:40 PM: This was also reported in the post http://moodle.org/mod/forum/discuss.php?d=26398 From Gustav Delius (gwd2 at york.ac.uk) Thursday, 7 July 2005, 11:09 PM: Unless we can get more information about this bug we probably should close this. From Jon Papaioannou (pj at moodle.org) Thursday, 7 July 2005, 11:49 PM: Gustav, I know... it doesn't make much sense. The only theory I have (and a far-fetched one at that) is that require_once('pagelib.php') [meaning /mod/quiz/pagelib.php] fails because PHP (under I don't know what OS) is confused after having already included /lib/pagelib.php. I don't know what else it can be, because that is a require() call and it would not continue if e.g. it looked for the correct file but the file was missing. However, it doesn't explain why the problem has been reported to appear on upgraded but NOT on new installations. There have been no database changes related to this either. From James Dugal (jpd at louisiana.edu) Friday, 8 July 2005, 12:15 AM: For what it is worth, one o/s was Solaris 8, with PHP 4.3.11, the other o/s was Linux Slackware with PHP 4.3.7. But, both use MMcache 2.4.6. I just now grabbed the latest 1.5+ tarball, and I can load it tonight under Linux. I can try disabling MMcache if that would help eliminate a concern. Anything else you'd recommend to help isolate the cause (assuming it still exists --James From Jon Papaioannou (pj at moodle.org) Friday, 8 July 2005, 10:32 AM: The word Solaris rings many bells related to includes (and I assume requires share the same backend), we had troubles in the past that forced us to specify absolute rather than relative paths when including files. The above theory might hold after all... Here's how to test: /mod/quiz/view.php line 8 reads: require_once('pagelib.php'); change this to: require_once($CFG->dirroot.'/mod/quiz/pagelib.php'); and see if the problem goes away. No idea about the Slackware install, I don't have any previous data on that. Try Solaris first. From James Dugal (jpd at louisiana.edu) Friday, 8 July 2005, 12:43 PM: PJ - tried your path change to pagelib.php ... no effect, on either system (Solaris and Linux). I then used mmcache.php to disable Turck mmcache under Linux. THIS WAS SUCCESSFUL! I did not need to change the path. I then tried disabling mmcache under Solaris, but this appeared to hang to apache process! Oops. Not sure why that would happen...there were three suggested ways of specifying the mmcache.so ... maybe that is a factor? So where does this leave us? --James From Gustav Delius (gwd2 at york.ac.uk) Thursday, 14 July 2005, 09:50 PM: I am downgrading this problem because it does not appear to affect many people. Jon, the change to absolute paths is generally a good idea and should be implemented everywhere. From Jon Papaioannou (pj at moodle.org) Saturday, 16 July 2005, 05:51 AM: Not sure what to think about it. It may be specific to your OS/PHP/MMCache combo... unless I can get shell access to that box I can't really do anything. I think we should close this as Works For Me. From James Dugal (jpd at louisiana.edu) Tuesday, 19 July 2005, 01:45 PM: PJ - I was looking again at mod/quiz/pagelib.php, and it occurred to me that the call to page_map_class() was made before the class page_quiz ... line was encountered, and perhaps the class would indeed be unknown. So, what would be the harm in moving the call to page_map_class() to AFTER the class was defined, ie, to just before the last line (?>)? I made this change here and I no longer get the error I reported, and everything else seems to work. If this is indeed a viable change, it should probably be made in mod/chat/pagelib.php too... James From Jon Papaioannou (pj at moodle.org) Wednesday, 20 July 2005, 12:59 AM: That's a great finding! Puts us on the right track. However, I 'd prefer to not solve the problem this way because then the local pagelib files would be more prone to error. Let's fix it by changing lib/pagelib.php a bit. We 'll remove the class_exists check when classes are registered; it's done anyway when class objects are about to be constructed. lib/pagelib.php line 107 is: if (!class_exists($mappings [$type] )) { change this to: if (empty($classname) && !class_exists($mappings [$type] )) { and see if the problem is solved (without a modified mod/quiz/pagelib.php) From Jon Papaioannou (pj at moodle.org) Wednesday, 20 July 2005, 07:09 AM: I just had one of those duh! moments, and I have to ask: With a stock Moodle installation, and when debug is NOT enabled, is everything working normally for you? This being a bug report, I assumed it wasn't!!!! From James Dugal (jpd at louisiana.edu) Wednesday, 20 July 2005, 09:40 AM: PJ - I like your solution better: it's more elegant! I think you can close this report as 'fixed' with that small change! Oh, I had no serious problems with my Moodle installation, but I was exploring the metering that debug=yes engages and found this side-effect as I also tried to view a quiz. Merci encore! --James From Jon Papaioannou (pj at moodle.org) Thursday, 21 July 2005, 01:30 AM: Done! Thanks for all the help in this! From Luis Gerardo Mendoza (germen at gmail.com) Thursday, 5 January 2006, 02:06 AM: I had the same trouble, but perhaps my reason was of another nature. Anyhow... I want to leave my solution for the record. In a TEXT type resource, there was this page that linked to a QUIZ resource, but in the URL captured, the url had double slash after the hostname. i.e. http://moodle.mydomain.com//mod/quiz/view.php?id=229 The solution was simply remove the double slash in the href that linked to that resource and Voila!: http://moodle.mydomain.com/mod/quiz/view.php?id=229 Hope it's useulf.
        Hide
        Michael Blake added a comment -

        Temporary transition to reassign bug to "pj".

        Show
        Michael Blake added a comment - Temporary transition to reassign bug to "pj".
        Hide
        Michael Blake added a comment -

        Re-closing bugs after re-assigning to "pj".

        Show
        Michael Blake added a comment - Re-closing bugs after re-assigning to "pj".

          People

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

            Dates

            • Created:
              Updated:
              Resolved: