Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.1

Bug #17064 DATE mispopulated in Birth Date and Death Date elements
Submitted: 2010-02-04 06:55 UTC
From: ed4becky Assigned:
Status: Open Package: Genealogy_Gedcom (version 1.0.1)
PHP Version: 5.3.1 OS: Windows 7
Roadmaps: (Not assigned)    
Subscription  


 [2010-02-04 06:55 UTC] ed4becky (Ed Thompson)
Description: ------------ I am finding that with my gedcom file, a DATE that is not relevant to birth or death is assigned to both.

Comments

 [2010-02-09 05:34 UTC] doconnor (Daniel O'Connor)
-Status: Open +Status: Feedback
We are unable to reproduce the bug as reported. Please provide a simple script (10 lines or less) or a link to an external script that can be used to reproduce the bug. If you can provide the script, feel free to add it to this bug and change the status back to "Open". Thank you for your interest in PEAR. Ed, got a reproduce script? Something short with a few lines and some sample input; what you expected to happen, and what actually happened?
 [2010-02-10 00:23 UTC] ed4becky (Ed Thompson)
I will try to put together a sample tonight. Basically the code seems to assume BIRTH and DEATH records in the gedcom, and if they don't exist, the birth date and death date get populated with the whatever date gets matched on next. (or was matched on previously, not sure which).
 [2010-02-10 00:24 UTC] ed4becky (Ed Thompson)
-Summary: DATE unbrealte dto brith date +Summary: DATE mispopulated in Birth Date and Death Date elements
 [2010-02-10 05:21 UTC] ed4becky (Ed Thompson)
Here is a source file that creates the issue. There is no BIRTH record, but the birth element of the tree is getting populated with 25 OCT 2005 0 HEAD 1 SOUR RootsMagic 2 NAME RootsMagic 2 VERS 4.0 2 CORP RootsMagic, Inc. 3 ADDR PO Box 495 4 CONT Springville, UT 84663 4 CONT USA 3 PHON 1-800-ROOTSMAGIC 3 WWW www.RootsMagic.com 1 DEST RootsMagic 1 DATE 9 FEB 2010 1 FILE myged.ged 1 GEDC 2 VERS 5.5.1 2 FORM LINEAGE-LINKED 1 CHAR UTF-8 0 @I292@ INDI 1 NAME Josephine /MASI/ 2 GIVN Josephine 2 SURN MASI 1 SEX F 1 _UID AD593F0B83F6E1469A28BC1AC92EDD63BF9B 1 CHAN 2 DATE 23 OCT 2005 1 DEAT 2 DATE 6 AUG 1957 0 TRLR
 [2010-02-10 05:27 UTC] ed4becky (Ed Thompson)
And the script: <?php error_reporting(E_ALL); require_once 'Genealogy_Gedcom.php'; $ged =& new Genealogy_Gedcom('myged.ged'); print_r($ged->getIndividual('I292')); ?> With the output: Genealogy_Individual Object ( [Identifier] => I292 [Lastname] => MASI [Firstname] => Josephine [Nickname] => [Title] => [Birth] => Array ( [Date] => 23 OCT 2005 [Place] => [Source] => [Note] => ) [Death] => Array ( [Date] => 6 AUG 1957 [Place] => [Source] => [Note] => ) [FirstCommunion] => Array ( [Date] => 23 OCT 2005 [Place] => [Source] => [Note] => ) [Sex] => F [Occupation] => Array ( ) [Source] => [Object] => [FamilySpouse] => Array ( ) [FamilyChild] => [Nationality] => [Burial] => Array ( [Date] => 23 OCT 2005 [Place] => ) [Note] => )
 [2010-02-15 07:39 UTC] ed4becky (Ed Thompson)
-Status: Feedback +Status: Open
 [2010-02-16 07:09 UTC] ed4becky (Ed Thompson)
I took a look at the code (just trying to help, honest). It looks like in the Parser, when recordl is parsed, the code and the line for Birth is called: @preg_replace('/\d DATE (.*)/US', '$1', $this->_GedcomIndividualsTree[$i][$this->_subTag( $this->_GedcomIndividualsTree[$i], 'BIRT', 'DATE')]) _subTag calls _tag looking for BIRT. There is no BIRT, so _tag returns -1. There is no error checking though. The loop in _subTag: for ($j=$i+1; $j < count($tab); $j++) { adds 1 to the -1, making it zero, then searches from the beginning of that array for a DATE, matching on the first one it finds. If there HAD been a BIRT, but not a DATE for it, the _subTag would make the same mistake, matching on any DATE it found. It looks like the current design assumes the presence of certain fields in certain orders in the GED.
 [2011-03-21 04:20 UTC] pepiczek (Kaaaaaaaaa Paa)
Hello, Is anybody here? I have the same issue... Only BIRT date (2010) and this class puts the same date in DEATH array ... [Death] => Array ( [Date] => 2010 [Place] => [Source] => [Note] => ) I can not use such data - this person is still alive (1 year old...) but own script will draw false conclusion if it finds death date present and not empty :/ Please help anyone.
 [2011-09-17 20:35 UTC] agh (andrea ghirardini)
Indeed it seems to work by just adding a test on $level: $i = $this->_tag($tab, $mainTag); $level = $tab[$i]{0}; if ($level == "") return; //<--------- ADDED THIS LINE for ($j = $i + 1; $j < count($tab); $j++) { ...