Skip to content

Use of eval() #313

Closed
Closed

Description

@petermoo

Why is the following line in locales/core.php an eval?
eval('$GLOBALS['translate']=array(' . ob_get_contents() . "\n'0');");

Activity

  1. caseysoftware commented on Jan 4, 2019

    @caseysoftware
    Member

    That's a great question. This is near the top of my agenda now that I wrapped up the v3.4 release earlier this week.

  2. added this to the web2project v4.0 milestone on Jan 3, 2024
  3. marked eval() parse error #337 as a duplicate of this issue on Feb 26, 2025
  4. removed this from the web2project 4.0.2 milestone on Jun 13, 2025
  5. caseysoftware commented on Apr 7, 2026

    @caseysoftware
    Member

    Reviewing this one, it's not critical. It's reading a file generated by the system.

    The longer term solution is to rework the translation approach which is well outside the scope of anything in progress.

  6. removed this from the web2project v4.1 milestone on Apr 7, 2026
  7. caseysoftware commented on Oct 16, 2026

    @caseysoftware
    Member

    Fixed on dev-5.0.0 in 24cfa2f0. Translation files are now read with a small parser (strings, => and commas only) instead of eval(). It produces the same arrays for all 259 locale files and rejects anything else, so a writable .inc file can no longer run code. Related: 8eec43fe stops the translation editor writing outside locales/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions