I'm using explode to split a comma-separated list of items within an XML node and then use the results as taxonomy terms. I'm finding that if the list contains integers these are not appearing in the output. Details as follows.

When using explode on a list like this:

<some-element>123,1.23,abc,456 ,789,def890</some-element>

I get back (in the field to which the node is mapped):

1.23, abc, 456, def890 as the exploded values.

123 and 789 are not processed

Looks as though values which could be interpreted as integers are not being output.

In the example the trailing space after 456 ensures that it is output whereas 123 and 789 go awol. I've worked around the issue by ensuring that all comma-separated items are also followed by a trailing space.

Comments

twistor’s picture

Assigned: Unassigned » twistor
Status: Active » Postponed (maintainer needs more info)

I am unable to reproduce this. Could it be a PHP bug? What are these getting mapped too?

urbanbassman’s picture

Status: Postponed (maintainer needs more info) » Active

Hi @twistor

PHP is 5.2.9 running as an Apache module. ISP is www.blacknight.com

Let me know if there's anything from phpinfo() that would be useful.

I've reproduced the issue on a fresh install of Drupal at http://drupal.codepages.net/

See http://drupal.codepages.net/node/18 for a detailed description of the issue with screenshots of the settings I'm using.

Issue isn't confined to integers -- I got that wrong. Various number formats seem to be affected.

The original example should read:

<some-element>123,1.23,abc,456 ,789,def890</some-element>

I get back (in the field to which the node is mapped):

abc, 456, def890 as the exploded values (doesn't include 1.23 as per my original post).

twistor’s picture

This just dawned on me, Feeds thinks that the number is the term id, and is trying to look it up, rather than mapping it. Could that be the problem?

tonkatuph’s picture

@Twister, I am having the same problem and I agree with your follow up. How would I go about correcting that?

twistor’s picture

In reality, Feeds is being too clever, and there should be two mappings, one for term name, and one for term id. In the short term, it would be trivial to create a new target that looks only for the term name.

twistor’s picture

Status: Active » Closed (works as designed)

Closing this, as it's out of my hands.