Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-17188

Condition to check if a utf8 string is malformed is wrong

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.3.11
    • 4.0.0-a1, 3.3.11
    • None
    • None

      In the class type_cast_helper there is a condition to check if a utf8 string is malformed

                          if (!preg_match('/^./u', $result))
                          {
                              $result = '';
                          } 

      But is causing false positives with some inputs.

       

      Possible solutions:

      https://stackoverflow.com/questions/6723562/how-can-i-detect-a-malformed-utf-8-string-in-php

       

            rubencm rubencm
            rubencm rubencm
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: