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

Quotes mismatch leads to print "$cid" instead of the value of $cid

    Details

    • Database:
      Any
    • Affected Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE

      Description

      While trying to fix MDL-14336 I came across nasty code within mod/data/lib.php that uses a mismatch of single and double quotes like this:

      echo '<option value="$cid">'.$currentfield->name.'</option>';

      which led not to solve $cid into its value, but printing out "$cid" to the HTML source instead. I have cleaned up the whole quotes related code within if (!empty($currentfields) && !empty($newfields)) { } and also added linebreaks after option tags to prevent making kilometers long lines of HTML code. Now the resulting table also displays properly, previously it got cut down somehow.

        Gliffy Diagrams

        1. MDL-14342.patch
          3 kB
          Robert Allerstorfer

          Issue Links

            Activity

            Hide
            roal Robert Allerstorfer added a comment -

            Here is the patch against MOODLE_19_STABLE. Should be committed asap, since the current code CAN'T work.

            Show
            roal Robert Allerstorfer added a comment - Here is the patch against MOODLE_19_STABLE. Should be committed asap, since the current code CAN'T work.
            Hide
            skodak Petr Skoda added a comment -

            found one more in new preset class, thanks for the report and patch

            Show
            skodak Petr Skoda added a comment - found one more in new preset class, thanks for the report and patch
            Hide
            roal Robert Allerstorfer added a comment -

            Thank you for committing, Petr! With this bug having fixed, I was now also able to fix bug MDL-14336

            Show
            roal Robert Allerstorfer added a comment - Thank you for committing, Petr! With this bug having fixed, I was now also able to fix bug MDL-14336
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Verified, closing. Thanks!

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Verified, closing. Thanks!
            Hide
            roal Robert Allerstorfer added a comment -

            Petr,

            I noticed that your change of mod/data/lib.php in HEAD (http://cvs.moodle.org/moodle/mod/data/lib.php?r1=1.151&r2=1.152) was not limited to the reported problem. In addition, you reverted Dongsheng's commit http://cvs.moodle.org/moodle/mod/data/lib.php?r1=1.146&r2=1.147 as part of MDL-14129. Could you please explain?

            Thanks.

            Show
            roal Robert Allerstorfer added a comment - Petr, I noticed that your change of mod/data/lib.php in HEAD ( http://cvs.moodle.org/moodle/mod/data/lib.php?r1=1.151&r2=1.152 ) was not limited to the reported problem. In addition, you reverted Dongsheng's commit http://cvs.moodle.org/moodle/mod/data/lib.php?r1=1.146&r2=1.147 as part of MDL-14129 . Could you please explain? Thanks.
            Hide
            dongsheng Dongsheng Cai added a comment -

            Fixed, no worries

            Show
            dongsheng Dongsheng Cai added a comment - Fixed, no worries

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  15/May/08