Menu

#4779 (ok 4.3.12) PMA_Util::parseEnumSetValues fails on enums with UTF-8 values

4.3.10
fixed
None
Normal
2015-03-14
2015-02-25
No

PMA_Util::parseEnumSetValues() seems to handle enum() type definitions with non-Latin1 values incorrectly, leading to a truncated drop-down field at the Insert record page (some valid ENUM values not shown).

How to reproduce:

CREATE TABLE test_enum (x enum('один','два','три','четыре'))

On table structure page the correct field definition is shown, and "Edit ENUM/SET values" popup shows all the values.

On Insert page for the test_enum table however drop-down for x field show truncated set of elements (the first three of them in this case).

As I traced this error the source of it is PMA_Util::parseEnumSetValues() method: it uses mb_strlen() call to determine the length of the "enum(...)" string which is multi-byte in this case, and then iterates over individual single-byte characters, effectively truncating the output.

var_dump($values_string) after htmlentities() call at the top of PMA_Util::parseEnumSetValues():

string(49) "enum('один','два','три','четыре')"

var_dump($values) before return from PMA_Util::parseEnumSetValues():

array(3) { [0]=> string(8) "один" [1]=> string(6) "два" [2]=> string(6) "три" }

("четыре" gets truncated from the output)

Discussion

  • Madhura Jayaratne

    • assigned_to: Madhura Jayaratne
     
  • Madhura Jayaratne

    • summary: PMA_Util::parseEnumSetValues fails on enums with UTF-8 values --> (ok 4.3.12) PMA_Util::parseEnumSetValues fails on enums with UTF-8 values
    • status: open --> resolved
     
  • Marc Delisle

    Marc Delisle - 2015-03-14
    • Status: resolved --> fixed
     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.