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

"generator" as class name is php5.5 incompatible

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Deferred
    • Affects Version/s: 2.3.9, 2.4.6, 2.5.2
    • Fix Version/s: None
    • Component/s: Administration, Unit tests
    • Labels:
      None
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE

      Description

      This was detected by the CI servers (one of them was updated to php 5.5 this week) when running the simpletest unit tests against 23_STABLE.

      There, we are using the the available cli_generator (admin/tool/generator/cli) that extends the old generator (admin/tool/generator/locallib.php).

      And "generator" is a reserved class in php 5.5 and up:

      http://us2.php.net/manual/en/class.generator.php

      Note that the code is also available in 24_STABLE and 25_STABLE (although we don't use it in the CI servers because since 24 we are 100% phpunit). master does not have that old generator anymore.

      That's the only use I've detected. Note that core does not use it at all, but perhaps people running unit tests or other utilities out there could face the problem if using php 5.5.

      grep -rP '(new|class|extends)\s+generator' *
      

      Surely a simple rename to "moodle_generator" or "old_generator" for those branches would be enough, commenting about that in upgrade.txt notes.

      For your consideration, ciao

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              stronk7 Eloy Lafuente (stronk7)
              Participants:
              Component watchers:
              Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: