diff options
| author | Greg Roach <fisharebest@gmail.com> | 2015-08-10 18:40:12 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2015-08-10 18:40:27 +0100 |
| commit | f7247c7311c670c0088f25ceed368c3c0a9a4dda (patch) | |
| tree | c194028ba6f47f2aa84618540a6eca4d9829488a /app/Individual.php | |
| parent | 7e7de911396836be9d8313e11369f3abdccd6cf2 (diff) | |
| download | webtrees-f7247c7311c670c0088f25ceed368c3c0a9a4dda.tar.gz webtrees-f7247c7311c670c0088f25ceed368c3c0a9a4dda.tar.bz2 webtrees-f7247c7311c670c0088f25ceed368c3c0a9a4dda.zip | |
Fix #672 - array offset error
Diffstat (limited to 'app/Individual.php')
| -rw-r--r-- | app/Individual.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/app/Individual.php b/app/Individual.php index 458dd651d7..ecf5f753fb 100644 --- a/app/Individual.php +++ b/app/Individual.php @@ -46,19 +46,20 @@ class Individual extends GedcomRecord { $args = array( 'tree_id' => $tree->getTreeId(), ); + $placeholders = array(); foreach (array_unique($xrefs) as $n => $xref) { if (!isset(self::$gedcom_record_cache[$tree->getTreeId()][$xref])) { - $sql .= ($n ? ',:x' : ':x') . $n; + $placeholders[] = ':x' . $n; $args['x' . $n] = $xref; } } - if (count($args) > 1) { + if (!empty($placeholders)) { $rows = Database::prepare( "SELECT i_id AS xref, i_gedcom AS gedcom" . " FROM `##individuals`" . - " WHERE i_file = :tree_id AND i_id IN (" . $sql . ")" + " WHERE i_file = :tree_id AND i_id IN (" . implode(',', $placeholders) . ")" )->execute( $args )->fetchAll(); |
