Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-15465

s9e/text-formatter/src/Configurator.php goes out of memory

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 3.2.1
    • None
    • None
    • None

    Description

      I upgraded phpBB 3.1 to 3.2 and I got an out-of-memory error:

       

      $ php -dmemory_limit=4G ./bin/phpbbcli.php db:migrate --safe-mode
      PHP Fatal error:  Allowed memory size of 4294967296 bytes exhausted (tried to allocate 20480 bytes) in vendor/s9e/text-formatter/src/Configurator.php on line 752
      

       

       

      I dump the input given to RegexpBuilder::fromList() and it was my stop words:

       

      array (
        0 => 'merda',
        1 => 'fodasse',
        2 => 'pk?',
        3 => 'pk',
        4 => 'fodido',
        5 => 'fudido',
        6 => 'cu',
        7 => 'cona',
        8 => 'CARALHO',
        9 => 'CONA',
        10 => 'CU',
        11 => 'caralho',
        12 => 'mod',
        13 => 'bófia',
        14 => 'nina',
        15 => 'nino',
        16 => 'foda-se',
        17 => 'tb',
        18 => 'PUTA',
        19 => 'puta',
        20 => 'MERDA',
        21 => 'CABRÃO',
        22 => 'cabrão',
        23 => 'cabrões',
        24 => 'CABRÕES',
        25 => 'peida',
        26 => 'PEIDA',
      )
      

       

       

      Apparently the code is not efficient and it runs out of memory. I worked around the problem by creating the regex by hand:

       

      (?>merda|fodasse|pk[?]?|f[ou]dido|cu|cona|caralho|nin[ao]|puta|peida|cabr[ãÃ]o|cabr[õÕ]es|tb|foda-se|mod|bófia)
      

       

      The upgrade then succeeded.

       

      (the code also doesn't support non-ASCII characters for case-insensitive, but that's another bug)

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              nlopes nlopes [X] (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: