bug #3480
opentask #6992: Refactor and modernize REST web service API
tagged text with square bracket confuses json
0%
Description
symptom reported by a.mueller:
Hi Andreas,
beim Aufruf der Synonymie in Crepis habe ich gerade folgende Warnung bekommen:
Warning: strlen() expects parameter 1 to be string, array given in theme_cdm_taggedtext2html() (line 144 of /var/www/drupal-7.16/sites/_dataportal-production/modules/cdm_dataportal/theme/cdm_dataportal.common.theme).
Viele Grüße,
Andreas M.
this happens with the taxon name Hieracioides ["Hieraciodes"] Kuntze
the where the name contains double quoted in square brackets.
The names tagged text contains the following string ["Hieraciodes"]
see http://dev.e-taxonomy.eu/cdmserver/cichorieae/name/f41a5447-09c8-4aa6-b894-9e942d83edc3/taggedName.json
JSON is correct in this case:
{ "appendedPhrase": false, "authors": false, "class": "TaggedText", "fullName": false, "hybridSign": false, "name": true, "nomStatus": false, "rank": false, "reference": false, "separator": false, "text": "[\"Hieraciodes\"]", "type": "name", "year": false },
but in the synonymy of Crepis http://dev.e-taxonomy.eu/cdmserver/cichorieae/portal/taxon/d0ae2121-1c32-4737-8c49-f871d429fd90/synonymy.json as well as in the following request http://dev.e-taxonomy.eu/cdmserver/cichorieae/portal/name/f41a5447-09c8-4aa6-b894-9e942d83edc3.json it appears like ...
JSON is incorrect in this case:
{ "appendedPhrase": false, "authors": false, "class": "TaggedText", "fullName": false, "hybridSign": false, "name": true, "nomStatus": false, "rank": false, "reference": false, "separator": false, "text": [ "Hieraciodes" ], "type": "name", "year": false },
the enclosing quotes are ignored or missed, the square brackets are thus interpreted as a JSON array which lead to the observed error in the dataportal.
This seems to be a bug in the serialization to JSON
Related issues