liberu-genealogy / php-gedcom

Gedcom reading and writing for PHP 8.3
https://www.liberu.co.uk
MIT License
75 stars 40 forks source link

Bug: Warning: Undefined array key 2 in Fam.php #62

Open stuntdawg opened 4 hours ago

stuntdawg commented 4 hours ago

Details

No response

sweep-ai[bot] commented 4 hours ago

❌ The ticket to PR workflow is no longer supported. We have moved to a new chat interface in private beta. Please contact us at team@sweep.dev to try it out.

:book: For more information on how to use Sweep, please read our documentation.

Tracking ID: e2165c0ebb
stuntdawg commented 4 hours ago

All I did was load the .ged file and immediately get this:

Warning: Undefined array key 2 in /../vendor/liberu-genealogy/php-gedcom/src/Parser/Fam.php on line: 93

the specific lines are:

            case 'NCHI':
                $fam->setNchi(trim((string) $record[2]));
                break;

and I could resolve the issue with this:

            case 'NCHI':
                if(isset($record[2])) $fam->setNchi(trim((string) $record[2]));
                break;