Unable to return chart data, invalid xml for file cache/xml/

Charts are not working at all

Fresh installation, Windows, PHP 5.5.12

XML Parsing Error: not well-formed
Location: file:///C:/wamp/www/s/cache/xml/bd6b317a-02d0-5dc6-7936-53e8630cb55d_e1ed0039-61f6-2b89-cf13-53e86531867f.xml
Line Number 16, Column 47: index.php?module=Opportunities&action=index&query=true&searchFormTab=advanced_search&start_range_date_closed=2014-08-11&end_range_date_closed=2015-02-11&sales_stage=FinalInterview
-------------------------------------------------------------------^

Any immediate ideas?

from UTF-8 into UTF-16LE is this the culprit?

Hi Here is a Fix

Symptom: Charts disply no graphs, only the chart dashlet header.

BACKGROUND: (Skip further down if you just want the answer)

Check of log (sugarcrm.log) shows and error like

[FATAL] Unable to return chart data, invalid xml for file cache/xml/cf5c5670-6587-c96c-ad17-5488356b7436_11239fac-ffe5-8e9b-1016-5492ec21299f.xml

WHAT HAPPENED

For PHP 5.5.1+ the PCRE Extension has been updated, incoporating a change to the Regex handler.

http://php.net/manual/en/pcre.installation.php

PCRE Changelog for this version:

http://www.pcre.org/changelog.txt

This means that the jsChart.php fails with this error in the Apache error.log

preg_replace(): Compilation failed: invalid range in character class at offset 36

HOTFIX

You can correct this problem by amending line 719 in ./include/SugarCharts/jsChart.php

replace

$pattern[] = ā€˜/<link>([a-zA-Z0-9#?&%.;[]/=+_-\s]+)</link>/eā€™;

with

$pattern[] = ā€˜/<link>([a-zA-Z0-9#?&%.;[]/=+\s-_]+)</link>/eā€™;

Thanks to pabloarias and his post here

https://community.sugarcrm.com/sugarcrm/topics/warning-preg-replace-compilation-failed-invalid-range-in-character-class-at-offset-36-in-sugarcharts-jschart-php-on-line-719

Or if you prefer you can simply swap the jsCharts.php file in for this one attached, remove the .txt extension so you have jsChart.php

FOR DEVELOPMENT

I will push this fix to my branch on Git Hub, and send in a Pull Request so that this fix can become upgrade safe.