PHP Classes

Multiple tags bug

Recommend this page to a friend!

      XML2Array_xmlreader  >  All threads  >  Multiple tags bug  >  (Un) Subscribe thread alerts  
Subject:Multiple tags bug
Summary:If there are several tags with the same name, oner after another
Messages:1
Author:Eugene
Date:2008-10-03 15:56:30
 

  1. Multiple tags bug   Reply   Report abuse  
Picture of Eugene Eugene - 2008-10-03 15:56:30
If there are several tags with the same name, oner after another, the script will not correctly create values for tag, starting from #2 of this sequence.

Quick fix:

Change this part:

case 3:
$current[$this -> tag]['value'] = $this -> reader -> value;

To:

case 3:
// Multiple tags bug fix
if (is_array($current[$this -> tag][0])){
$current[$this -> tag][count($current[$this -> tag]) - 1]['value'] = $this -> reader -> value;
}else
$current[$this -> tag]['value'] = $this -> reader -> value;