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

SQL error when saving profile with empty custom field of type "Numbers"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 3.3.3-RC1
    • 3.3.1
    • None
    • PHP 7.4.3, MariaDB 10.3.22, Ubuntu 20.04.1

      Saving a profile with an empty custom profile field of type "Numbers" (int) shows this error:

      Incorrect integer value: '' for column `phpBB`.`phpbb_profile_fields_data`.`pf_fieldname` at row 1 [1366]

      This is because manager.php overwrites the NULL value set by type_int.php with an empty string. Suggest this code change to check for string type first:

                              /**
                               * Replace Emoji and other 4bit UTF-8 chars not allowed by MySQL
                               * with their Numeric Character Reference's Hexadecimal notation.
                               */
                              if (is_string($cp_data['pf_' . $row['field_ident']]))
                              {
                                      $cp_data['pf_' . $row['field_ident']] = utf8_encode_ucr($cp_data['pf_' . $row['field_ident']]);
                              }
      

            Marc Marc
            tbehrens tbehrens [X] (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: