Menu

indilist.php (unknown) family name generates php errors

Help
2020-10-10
2021-07-28
  • David Smart

    David Smart - 2020-10-10

    I get a bunch of these when I click on (unknown) in the Individual list.

    ERROR 8: Trying to access array offset on value of type null
    0 Error occurred on line 1652 of file class_person.php in function _addName
    1 called from line 474 of file class_gedcomrecord.php in function _getAllNames
    2 called from line 1837 of file class_person.php in function getAllNames
    3 called from line 614 of file class_gedcomrecord.php in function getSortName
    4 called from line 565 of file class_gedcomrecord.php in function Compare
    5 called from in function usort
    6 called from line 539 of file functions_db.php in function get_indilist_indis
    7 called from line 278 of file indilist.php
    

    Below this batch of errors I do see the list as expected.

    As an experiment, I modified class_person.php : 1649 where I added 3 lines to trap the null.

    protected function _addName($type, $full, $gedrec) {
        global $UNDERLINE_NAME_QUOTES, $NAME_REVERSE, $unknownNN, $unknownPN, $pgv_lang;
    
        // Look for GIVN/SURN at level n+1
        if ($gedrec == null)   // Added null guard; search for unknown family name
            $sublevel = 0;        // Added - value 0 | 1 behave the same
        else                    // Added
            $sublevel=1+(int)$gedrec[0];
    

    I no longer see the batch of errors, but there may be a more elegant fix.

     

    Last edit: David Smart 2020-10-10
  • Gerry Kroll

    Gerry Kroll - 2020-10-10

    I can't reproduce this error. The problem may be caused by the way you have entered these unknown names in your database.

    Please e-mail me a ZIP copy of your GEDCOM: gkroll (at) keldine (dot) ca .

    Give me (in that e-mail) the Indi ID of several of those problematic records.

     
  • Arnold Schiller

    Arnold Schiller - 2021-07-28

    if ($gedrec == null) // Added null guard; search for unknown family name
    $sublevel = 0; // Added - value 0 | 1 behave the same
    else // Added
    works for me - have the same Error with php 7.4

     
  • Gerry Kroll

    Gerry Kroll - 2021-07-28

    Thank you.

    The problem was fixed in the SVN version sometime in January 2022. Please upgrade your copy of PhpGedView using the latest-and-greatest from the SVN repository.

    Click on the "SVN" link at the top of this page, and follow the "trunk" path.
    https://sourceforge.net/p/phpgedview/svn/HEAD/tree/trunk/phpGedView

    There have beem many "how to" posts, both here and in the Help forum.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.