From c01bde44028cd21e0bca5092d87c81889da8c54c Mon Sep 17 00:00:00 2001 From: fisharebest Date: Sun, 7 Jul 2013 10:34:05 +0000 Subject: Use the actual XREF from the record, not the one used to find the record (e.g. i123 versus I123) --- library/WT/GedcomRecord.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/library/WT/GedcomRecord.php b/library/WT/GedcomRecord.php index f3ca4c2774..4dca149b37 100644 --- a/library/WT/GedcomRecord.php +++ b/library/WT/GedcomRecord.php @@ -134,19 +134,17 @@ class WT_GedcomRecord { $pending = null; } - // No such record exists - create a dummy one + // No such record exists if ($gedcom === null && $pending === null) { - // Is this a good idea? - //$xref = self::DUMMY_XREF; - //$gedcom = "0 @$xref@ " . static::RECORD_TYPE . "\n1 RESN none"; - //$gedcom_id = 0; return null; } // Create the object - if (preg_match('/^0 @' . WT_REGEX_XREF . '@ (' . WT_REGEX_TAG . ')/', $gedcom.$pending, $match)) { - $type = $match[1]; + if (preg_match('/^0 @(' . WT_REGEX_XREF . ')@ (' . WT_REGEX_TAG . ')/', $gedcom.$pending, $match)) { + $xref = $match[1]; // Collation - we may have requested I123 and found i123 + $type = $match[2]; } elseif (preg_match('/^0 (HEAD|TRLR)/', $gedcom.$pending, $match)) { + $xref = $match[1]; $type = $match[1]; } else { throw new Exception('Unrecognised GEDCOM record: ' . $gedcom); -- cgit v1.3