Skip to content

Commit

Permalink
Partial patch for issue phpmyadmin#13894
Browse files Browse the repository at this point in the history
Transformation of the output of a binary select to hex. 
Fixes 50% of the issue phpmyadmin#13894

Signed-off-by: William Desportes <williamdes@wdes.fr>
  • Loading branch information
williamdes committed Dec 28, 2017
1 parent d3e7c66 commit 8084cbb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions libraries/classes/InsertEdit.php
Expand Up @@ -592,10 +592,17 @@ public static function getValueColumn(array $column, $backup_field, $column_name
);

} elseif (is_array($foreignData['disp_row'])) {
$fieldType = 'foreign';
if($column["is_binary"]){
foreach($foreignData['disp_row'] as &$dispRow){
$dispRow[$column["Field"]] = bin2hex($dispRow[$column["Field"]]);
}
$fieldType = 'hex';
}
$html_output .= self::dispRowForeignData(
$backup_field, $column_name_appendix,
$onChangeClause, $tabindex, $tabindex_for_value,
$idindex, $data, $foreignData, $readOnly
$idindex, $data, $foreignData, $readOnly, $fieldType
);

} elseif ($GLOBALS['cfg']['LongtextDoubleTextarea']
Expand Down Expand Up @@ -730,13 +737,13 @@ public static function getForeignLink(array $column, $backup_field, $column_name
*/
public static function dispRowForeignData($backup_field, $column_name_appendix,
$onChangeClause, $tabindex, $tabindex_for_value, $idindex, $data,
array $foreignData, $readOnly
array $foreignData, $readOnly, $fieldType
) {
$html_output = '';
$html_output .= $backup_field . "\n";
$html_output .= '<input type="hidden"'
. ' name="fields_type' . $column_name_appendix . '"'
. ' value="foreign" />';
. ' value="'.$fieldType.'" />';

$html_output .= '<select name="fields' . $column_name_appendix . '"'
. ' ' . $onChangeClause
Expand Down
2 changes: 1 addition & 1 deletion test/classes/InsertEditTest.php
Expand Up @@ -766,7 +766,7 @@ public function testDispRowForeignData()
$GLOBALS['cfg']['ForeignKeyMaxLimit'] = 1;
$GLOBALS['cfg']['NaturalOrder'] = false;
$result = InsertEdit::dispRowForeignData(
'a', 'b', 'd', 2, 0, 1, "<s>", $foreignData, false
'a', 'b', 'd', 2, 0, 1, "<s>", $foreignData, false, 'foreign'
);

$this->assertContains(
Expand Down

0 comments on commit 8084cbb

Please sign in to comment.