Date problem corrupted record

Bug #673369 reported by Wes Groleau
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
webtrees
Fix Released
Low
fisharebest

Bug Description

Trying to test enhancement to date picker with SVN 9782.
Created new INDI and pasted in events with various date formats.
Trying to save the changed caused a stack dump in the edit_interface.
Used "Back" to recover the GEDCOM. Inspected it--all valid.
Took out all the events and tried to save--still a stack dump
Tried to delete the record--another stack dump
Refresh page--pending changes note appears (I have my changes set to automatic).
Went there, and see several Replace, then Delete.
Tried to accept all--stack dump
Reject all worked.

Made another INDI, and pasted in a few events at a time. Dates in the future are NOT a problem.

I've narrowed it down to nine events--I will do more testing to narrow it down more, but I wanted to enter this much so that I don't forget the details overnight.
The problem is definitely associated with dates, as the stack dump indicates. I think all my formats are legal. The dump is:

ERROR 8: Trying to get property of non-object
0 Error occurred on line 848 of file functions_import.php in function update_dates
1 called from line 668 of file functions_import.php in function import_record
2 called from line 1285 of file functions_import.php in function update_record
3 called from line 1192 of file functions_import.php in function accept_all_changes
4 called from line 401 of file functions_edit.php in function delete_gedrec
5 called from line 2594 of file functions_edit.php in function delete_person
6 called from line 1717 of file edit_interface.php

Notice: Trying to get property of non-object in /home/content/G/T/S/GTSCFL/html/UG/webtrees/includes/functions/functions_import.php on line 848

Fatal error: Call to a member function Format() on a non-object in /home/content/G/T/S/GTSCFL/html/UG/webtrees/includes/functions/functions_import.php on line 848

Revision history for this message
Wes Groleau (webmaster-unigen) wrote :

The following dates did NOT cause the problem, and they all looked OK in the display except as NOTEd.
Repeat, these have been ruled out--still looking for the bad one(s).
1 BIRT
2 DATE 9 AUG 2019
2 NOTE testing
1 CHR
2 DATE AUG 2019
2 NOTE testing
1 BARM
2 DATE 2019
2 NOTE testing
1 GRAD
2 DATE ABT 9 AUG 2019
2 NOTE testing
1 CENS
2 DATE INT AUG 2019
2 NOTE *** This one was displayed with a set of
3 CONT *** empty parens after the year.
1 EMIG
2 DATE BEF 2019
2 NOTE testing
1 IMMI
2 DATE @#DGREGORIAN@ 9 MAY 101 B.C.
2 NOTE testing
1 NATU
2 DATE @#DGREGORIAN@ 9 MAY 101
2 NOTE testing
1 FCOM
2 DATE @#DGREGORIAN@ 9 MAY 1001 B.C.
2 NOTE testing
1 BLES
2 DATE @#DGREGORIAN@ 9 AUG 1698/99
2 NOTE testing
1 ORDN
2 DATE 09 AUG 1698/99
2 NOTE testing
1 OCCU
2 DATE @#DGREGORIAN@ 9 AUG 2019
2 NOTE testing
1 PROP
2 DATE EST @#DGREGORIAN@ AUG 2019
2 NOTE testing
1 RELI
2 DATE AFT @#DGREGORIAN@ 2019
2 NOTE No record corruption so far

Revision history for this message
Wes Groleau (webmaster-unigen) wrote :

It is "UNKNOWN"
Granted, it would be pretty unusual for someone to enter that, but still, webtrees shouldn't crash. I could see someone using it for one the spec doesn't provide for.

The following event, added with nothing else to a just-created INDI, causes the problem:
1 BURI
2 DATE @#DUNKNOWN@ 9 AUG 2019
2 NOTE SVN 9782 chokes on this one
----------------------------------
For what it's worth, the rest of these are verifed SAFE:
1 RESI
2 DATE BET 9 AUG 2019 AND 01 APR 2038
2 NOTE testing
1 TITL
2 DATE FROM 9 AUG 2019 TO 9 AUG 2119
2 NOTE testing
1 NATI
2 DATE BET @#DGREGORIAN@ 9 AUG 2019 AND 01 APR 2038
2 NOTE testing
1 EDUC
2 DATE FROM @#DGREGORIAN@ 9 AUG 2019 TO 9 AUG 2119
2 NOTE testing
1 ADOP
2 DATE @#DJULIAN@ 9 AUG 100 B.C.
2 NOTE testing
1 RETI
2 DATE BEF @#DHEBREW@ KSL 2019
2 NOTE testing
1 DEAT
2 DATE @#DFRENCH R@ 9 BRUM 7
2 NOTE testing
1 PROB
2 DATE INT @#DROMAN@ 9 AUG 2019

Revision history for this message
Wes Groleau (webmaster-unigen) wrote :

P.S. If the INDI existed before the crash, "reject changes" instead of rolling back to that state, deletes the INDI and then creating a new INDI does not re-use the number.

Revision history for this message
fisharebest (fisharebest) wrote :

Fixed in SVN 9808

The invalid calendar escape was causing the constructor to drop out of a switch() statement.

As a result, the date object was created, but not initialised. This causes problems with any code that tries to use this date object.

Changed in webtrees:
assignee: nobody → fisharebest (fisharebest)
importance: Undecided → Low
status: New → Fix Committed
Revision history for this message
fisharebest (fisharebest) wrote :

@#DGREGORIAN@ 9 AUG 1698/99

PS: although the gedcom specification describes old-style/new-style years as "gregorian", they are only used on julian dates.

And, of course, the OS/NS notation is only valid for dates between 01 JAN and 24 MAR ...

Revision history for this message
Wes Groleau (webmaster-unigen) wrote :

"UNKNOWN" _is_ one of the options in the 5.5.1 spec.
I doubt anyone will ever use it, but I was trying to make sure my date-picker effort would not crash on anything the spec allows.

Revision history for this message
fisharebest (fisharebest) wrote :

Fix released in webtrees-1.0.6

Changed in webtrees:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.