I discovered that when the number of shared strings in the file is greater than the constant SHARED_STRING_CACHE_LIMIT, all string values are empty. I did manage to make things work by changing two things, both of them in the GetSharedString() method.
First off, the following condition:
if ((self::SHARED_STRING_CACHE_LIMIT === null || self::SHARED_STRING_CACHE_LIMIT > 0) && ($this -> SharedStringCache !== null))
is problematic since $this->SharedStringCache is initialized as an array, meaning the condition specified here is always true (array is always different from null). I corrected things by checking whether the array was empty instead:
if ((self::SHARED_STRING_CACHE_LIMIT === null || self::SHARED_STRING_CACHE_LIMIT > 0) && (!empty($this -> SharedStringCache)))
Next, there was a problem with this loop:
while ($this -> SharedStrings -> read());
{
if ($this -> SharedStrings -> name == 'sst')
{
$this -> SharedStringCount = $this -> SharedStrings -> getAttribute('uniqueCount');
break;
}
}
The problem was that upon entering the loop, $this -> SharedStrings was already positioned correctly. So by executing a read before checking the current node, this loop would go through the entire file before finding the closing 'sst' tag, thus making it impossible to return any value without resetting the file. In order to avoid this, I had to change the "while" to a "do-->while" like this:
do
{
if ($this -> SharedStrings -> name == 'sst')
{
$this -> SharedStringCount = $this -> SharedStrings -> getAttribute('uniqueCount');
break;
}
}
while ($this -> SharedStrings -> read());
Anyway, I hope this helps.
Osu