Skip to content

Commit

Permalink
Closes #14388 - Search and Insert broken
Browse files Browse the repository at this point in the history
FK of type int breaks buildForeignDropdown
Closes: #14388

Signed-off-by: William Desportes <williamdes@wdes.fr>
  • Loading branch information
williamdes committed Jun 11, 2018
1 parent 86fcc46 commit 81a552c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libraries/classes/Relation.php
Expand Up @@ -1250,11 +1250,14 @@ public function buildForeignDropdown(array $foreign, $data, $mode)

foreach ($foreign as $key => $value) {
$vtitle = '';
$key = (string) $key;
$value = (string) $value;
$data = (string) $data;

if (mb_check_encoding($key, 'utf-8')
&& !preg_match('/[\x00-\x08\x0B\x0C\x0E-\x1F\x80-\x9F]/u', $key)
) {
$selected = ((string) $key == (string) $data);
$selected = ($key == $data);
// show as text if it's valid utf-8
$key = htmlspecialchars($key);
} else {
Expand Down

0 comments on commit 81a552c

Please sign in to comment.