From 92eec8e87a5bb7403eb3128cfb87c26a5d1bbb37 Mon Sep 17 00:00:00 2001 From: Hakan Sandell <hakan.sandell@home.se> Date: Sat, 2 Oct 2010 17:06:59 +0200 Subject: [PATCH] Fixed bug FS2030 JpegMeta dies on parsing XMP --- inc/JpegMeta.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/inc/JpegMeta.php b/inc/JpegMeta.php index 98453131e..fa05f6859 100644 --- a/inc/JpegMeta.php +++ b/inc/JpegMeta.php @@ -1488,6 +1488,8 @@ class JpegMeta { * @author Hakan Sandell <hakan.sandell@mydata.se> */ function _parseXmpNode($values, &$i, &$meta) { + if ($values[$i]['type'] == 'close') return; + if ($values[$i]['type'] == 'complete') { // Simple Type property $meta = $values[$i]['value']; @@ -1501,14 +1503,16 @@ class JpegMeta { while ($values[++$i]['tag'] == 'rdf:li') { $this->_parseXmpNode($values, $i, $meta[]); } - $i++; // skip closing tag + $i++; // skip closing Bag/Seq tag } elseif ($values[$i]['tag'] == 'rdf:Alt') { // Language Alternative property, only the first (default) value is used - $i++; - $this->_parseXmpNode($values, $i, $meta); - while ($values[++$i]['tag'] != 'rdf:Alt'); - $i++; // skip closing tag + if ($values[$i]['type'] == 'open') { + $i++; + $this->_parseXmpNode($values, $i, $meta); + while ($values[++$i]['tag'] != 'rdf:Alt'); + $i++; // skip closing Alt tag + } } else { // Structure property -- GitLab