joomla/joomla-cms — pull request #3865 by itbra (2014-07-09 13:31:13+00:00)
Title: Fix addTaxonomy and getTaxonomy

A FinderIndexerResult may contain taxonomies. These are collected within named arrays unter the taxonomies-property like
```ruby
[taxonomy:protected] => Array
(
[collection1] => Array
(
[2] => JObject Object
(
[title] => 2
[state] => 1
[access] => 1
)
[collection2] => Array
(
[THE_NAME] => JObject Object
(
[title] => THE_NAME
[state] => 1
[access] => 1
)
)
[YET ANOTHER COLLECTION] => Array // underscores are replaces by blanks
(
[ANOTHER_NAME] => JObject Object // underscores preserved
(
[title] => ANOTHER_NAME
[state] => 1
[access] => 1
)
)
)
```
As can be seen every taxonomy type (collection1, collection2, YET ANOTHER COLLECTION) is an array containing 1+ JObjects. Also we can see that the names of the JObjects might contain underscores.
Now the problem is, that these underscores are replaced by blanks for the array names (see: YET ANOTHER COLLECTION). This is a big problem when using translation keys for array names as in my case. Since the underscores are replaces the keys are broken, the indexer creates taxonomies other than wished and the search doesn't find them.

The solution for this issue is to not replace underscores. Why should they be replaced at all when they're allowed for all other names and titles!?

The PR extends the regular expression to preserve underscores in taxonomy names.