Bug #32427
closedNo datatype in "Remove unused fields" section
0%
Description
In Install Tool, Database Analyser, Compare, section Remove unused fields I see the following SQL scripts:
(EXT) ALTER TABLE be_groups CHANGE tx_dam_mountpoints zzz_deleted_tx_dam_mountpoints (255) default '';
(EXT) ALTER TABLE be_users CHANGE tx_t3blog_avatar zzz_deleted_tx_t3blog_avatar (60) default '\'\'::character varying';
As you can see there is no datatype for fields. If I try to run something from this section I receive the error:
Oops, an error occured!
ERROR: Query could not be parsed: "SQL engine parse ERROR: Field type unknown in parseFieldDef()!: near "(255) default '' "". Query: "ALTER TABLE be_groups CHANGE tx_dam_mountpoints zzz_deleted_tx_dam_mountpoints (255) default '';"
I have traced the calls down till admin_get_fields function. I found that it returns incorrect field type in "Type" key, but "type" key (from lover case letter) contains correct value.
This function calls MetaType function for each field in a table passing value from "type" array member and table name.
MetaType function, in case ADODB is used, performs SQL query "SELECT * FROM <table> LIMIT 1" and calls MetaType function from returned object. BUT ONLY if table name exists in cache_fieldType class variable. Existence is checked by in_array($table, $this->cache_fieldType).
BUT!!! $this->cache_fieldType is not an array, it's a dictionary! So, in_array will always return false. array_key_exists must be used instead!
Please, find patch attached.
Files