I've encountered an issue in the _documentToXmlFragment() method of the Apache_Solr_Service class.
To cut a long story short, I'm building up documents from database rows, some of which contain NULL values. I've noticed that NULL values interfere with the following (Iterator-based) code in the above method:
foreach ($document as $key => $value)
What basically happens is that a NULL $value seems to cause the foreach loop to terminate prematurely. Any fields 'beyond' that with the NULL value do not get added to the index.
The very simple workaround for this was to replace the above code fragment with the following:
$keys = $document->getFieldNames();
foreach ($keys as $key)
$value = $document->$key;
As you can see, it's essentially the same, and fully backwards-compatible. It just avoids the issue I've been experiencing with the iterator.
I'd really like to see this change make it to the code if possible (I can submit a patch if necessary).
For reference, I'm using PHP 5.3 on OSX.