diff options
| author | Greg Roach <fisharebest@gmail.com> | 2013-09-06 22:01:01 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2013-09-06 22:01:01 +0100 |
| commit | c650be6c0012a49e4b271c9e1273314444680e0e (patch) | |
| tree | 9c5fe5d0363183390128d019ae853b918b15f8f5 /library | |
| parent | 2f5d4665a001a84aeb6b5ef2976ef12567f22739 (diff) | |
| download | webtrees-c650be6c0012a49e4b271c9e1273314444680e0e.tar.gz webtrees-c650be6c0012a49e4b271c9e1273314444680e0e.tar.bz2 webtrees-c650be6c0012a49e4b271c9e1273314444680e0e.zip | |
MSDOS line endings break raw GEDCOM editing
Diffstat (limited to 'library')
| -rw-r--r-- | library/WT/GedcomRecord.php | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/library/WT/GedcomRecord.php b/library/WT/GedcomRecord.php index e19fa9ab52..8b8ff79d8c 100644 --- a/library/WT/GedcomRecord.php +++ b/library/WT/GedcomRecord.php @@ -865,10 +865,10 @@ class WT_GedcomRecord { // Replace a fact with a new gedcom data. public function updateFact($fact_id, $gedcom, $update_chan) { - if (strpos("\r", $gedcom)!==false) { - // MSDOS line endings will break things in horrible ways - throw new Exception('Evil line endings found in WT_GedcomRecord::updateFact(' . $gedcom . ')'); - } + // MSDOS line endings will break things in horrible ways + $gedcom = preg_replace('/[\r\n]+/', "\n", $gedcom); + $gedcom = trim($gedcom); + if ($this->pending==='') { throw new Exception('Cannot edit a deleted record'); } @@ -978,10 +978,9 @@ class WT_GedcomRecord { } public function updateRecord($gedcom, $update_chan) { - if (strpos("\r", $gedcom)!==false) { - // MSDOS line endings will break things in horrible ways - throw new Exception('Evil line endings found in WT_GedcomRecord::updateRecord(' . $gedcom . ')'); - } + // MSDOS line endings will break things in horrible ways + $gedcom = preg_replace('/[\r\n]+/', "\n", $gedcom); + $gedcom = trim($gedcom); // Update the CHAN record if ($update_chan) { |
