#2590 V4.2.1. Error editing Source

v4.2.1
closed-fixed
Gerry Kroll
None
5
2009-08-01
2009-04-26
Stuart.G
No

There is no link to edit source. If I click on the Edit Source icon I get the following error messages.

ERROR 8: Undefined offset: 1
0 Error occurred on line 2313 of file functions_edit.php in function create_edit_form
1 called from line 927 of file edit_interface.php

Notice: Undefined offset: 1 in /hdb/www/stuart/FamilyTree/includes/functions/functions_edit.php on line 2313

ERROR 8: Undefined offset: 1
0 Error occurred on line 2319 of file functions_edit.php in function create_edit_form
1 called from line 927 of file edit_interface.php

Notice: Undefined offset: 1 in /hdb/www/stuart/FamilyTree/includes/functions/functions_edit.php on line 2319

Thanks for any help.
--
Stuart

Discussion

  • Andrew Gregory
    Andrew Gregory
    2009-04-26

    The error messages are due to a blank line in $gedrec. Adding:

    $gedrec = trim($gedrec);

    after the call to privatize_gedcom() at about line #284 in edit_interface.php seems to fix things, but I don't know if that's the correct solution? Maybe it's a bug in privatize_gedcom()?

     
  • Greg Roach
    Greg Roach
    2009-04-26

    <<There is no link to edit source. If I click on the Edit Source icon I get the following error messages.>>

    Can you elaborate. Which edit icon, on which page?

    <<The error messages are due to a blank line in $gedreche error messages are due to a blank line in $gedrec>>

    We're trying to remove 1000s of unnecessary trim()s from the code by ensuring that they are all called once, when data is added to the system for the first time. This way all the internal functions will be able to assume the data is well-formated.

    We're probably missing a call to format_record_import() somewhere......

     
  • Andrew Gregory
    Andrew Gregory
    2009-04-26

    Re: No link to edit source: Go to Lists -> Sources. Pick one to view. Under "Options for source", the menu for Edit Source does not include an item for "Edit Source" itself. This is unexpected/inconsistent compared to the various other "Edit" menus, such as the Edit menus for each fact item.

    Re: The source blank line: I've tested removing my trim call and also commenting out privatize_gedcom() - the errors also go away, which tells me that privatize_gedcom is introducing the problem.

     
  • Gerry Kroll
    Gerry Kroll
    2009-04-28

    The "No link" error is fixed in SVN.

     
  • Greg Roach
    Greg Roach
    2009-07-15

    I'm still unable to reproduce this.

    I'm not even clear which "edit source" link you refer to. (The one in the sub-menu on the source page perhaps).

    I'd like to find out where the blank line is being added, rather than just trim it off. I want to get away from adding trim(), isset(), etc. everywhere "just in case", and get to the real source of the problem.

     
  • Andrew Gregory
    Andrew Gregory
    2009-07-16

    * Edit Source

    I really don't know how to decribe the "Edit Source" more clearly? I'll try again.

    We're using the Xenea theme. Near the top of the page is a horizontal row of icons. One of those is "Lists". It has a drop-down menu. One of the items is "Sources". Click that. A lists of sources will appear. Click any link in the SOUR column to go to that source. At the top of that page there is a small box titled "Options for source" with two items: "Edit Source" and "Other". The "Edit Source" item has a drop-down menu that does not itself have "Edit Source" as an option. The issue is that this is inconsistent with other similar user interface items used elsewhere in PGV. That's all.

    * Extra Blank Privatizing

    privatize_gedcom returns $newrec in two places. An if statement "if (!$disp)" controls that. I added the following code to debug each path:

    print "<!-- 1gedrec = $gedrec -->\n";
    print "<!-- 1newrec = $newrec -->\n";
    return $newrec;

    One was numbered "1", the other "2" so I could tell which path was used. As it turned out for my test, the false path was taken (i.e. "if (!$disp)" was false). Since I was logged in as admin, the output was basically identical, except for the last line. The output for gedrec (the original record) ended with:

    1 CHAN
    2 DATE 03 JAN 2009
    3 TIME 21:47:12
    2 _PGVU Stuart -->

    While the output for newrec (the privatized record) ended with:

    1 CHAN
    2 DATE 03 JAN 2009
    3 TIME 21:47:12
    2 _PGVU Stuart
    -->

    The extra newline added to the end is resulting in the error messages. The newline appears to be a result of get_all_subrecords, which ensures that every subrecord ends with a newline. That function has lots of $repeats[] = trim($subrec)."\n"; calls, so it's fairly obvious where the newline is coming from.

    I guess it's not so much the newline being a problem, but that the code downstream from privatize_gedcom should be able to handle that newline being there.

    The create_edit_form function uses explode to split records apart and assumes that at least two fields will be present. The blank line at the end results in a single field - hence the error. Perhaps that's what needs improving?

     
  • Gerry Kroll
    Gerry Kroll
    2009-08-01

    • assigned_to: nobody --> canajun2eh
    • status: open --> closed-fixed
     
  • Gerry Kroll
    Gerry Kroll
    2009-08-01

    Version 4.2.2 has been released