Project

General

Profile

« Previous | Next » 

Revision af145b11

Added by Jim Pingle over 6 years ago

Avoid creating or parsing a second empty rrddata tag. Fixes #8994

(cherry picked from commit 9386784480f27d6b04ebf013f691522130a7f013)

View differences:

src/usr/local/www/diag_backup.php
205 205
				if ($_POST['backuparea'] !== "rrddata" && !$_POST['donotbackuprrd']) {
206 206
					$rrd_data_xml = rrd_data_xml();
207 207
					$closing_tag = "</" . $g['xml_rootobj'] . ">";
208

  
209
					/* If the config on disk had rrddata tags already, remove that section first.
210
					 * See https://redmine.pfsense.org/issues/8994 */
211
					$data = preg_replace("/<rrddata>.*<\\/rrddata>/", "", $data);
212
					$data = preg_replace("/<rrddata\\/>/", "", $data);
213

  
208 214
					$data = str_replace($closing_tag, $rrd_data_xml . $closing_tag, $data);
209 215
				}
210 216

  
......
261 267
						$data = str_replace("m0n0wall", "pfsense", $data);
262 268
						$m0n0wall_upgrade = true;
263 269
					}
270

  
271
					/* If the config on disk had empty rrddata tags, remove them to
272
					 * avoid an XML parsing error.
273
					 * See https://redmine.pfsense.org/issues/8994 */
274
					$data = preg_replace("/<rrddata><\\/rrddata>/", "", $data);
275
					$data = preg_replace("/<rrddata\\/>/", "", $data);
276

  
264 277
					if ($_POST['restorearea']) {
265 278
						/* restore a specific area of the configuration */
266 279
						if (!stristr($data, "<" . $_POST['restorearea'] . ">")) {

Also available in: Unified diff