com web/pres2: Invalid XML breaks the site, and has now for multiple weeks at talks.php.net. Maybe this will fix it. Can't make it worse, at least... we'll see. Feel free to make a proper fix. This attempts to deal with PHP Bug #72110: index.php

[email protected] (Philip Olson) Fri, 06 May 2016 20:41:54 +0000
Newsgroups php.pres
Message-ID <[email protected]>
Commit:    cd2807b0842ea2a23d13a1eb5bd43c2b0fd517da
Author:    Philip Olson <[email protected]>         Fri, 6 May 2016 13:41:54 -0700
Parents:   247ee0e86983d63b3c628b8df583d8bdc166e735
Branches:  master

Link:       http://git.php.net/?p=web/pres2.git;a=commitdiff;h=cd2807b0842ea2a23d13a1eb5bd43c2b0fd517da

Log:
Invalid XML breaks the site, and has now for multiple weeks at talks.php.net. Maybe this will fix it. Can't make it worse, at least... we'll see. Feel free to make a proper fix. This attempts to deal with PHP Bug #72110

Bugs:
https://bugs.php.net/72110

Changed paths:
  M  index.php


Diff:
diff --git a/index.php b/index.php
index 3636c24..5b8629b 100644
--- a/index.php
+++ b/index.php
@@ -34,8 +34,11 @@
 	foreach($ps as $pres_id=>$filename) {
 		$fh = fopen($filename, "rb");
 		$p = new XML_Presentation($fh);
-		$p->setErrorHandling(PEAR_ERROR_DIE,"%s\n");
-		$p->parse();
+		$p->setErrorHandling(PEAR_ERROR_TRIGGER, E_USER_WARNING);
+		$check = $p->parse();
+		if (PEAR::isError($check)) {
+			continue;
+		}
 		$pres = $p->getObjects();
 	
 		// Do we have a generated reveal.js version of this presentation?	
@@ -82,8 +85,11 @@
 
 	// default options for the file..
 	$p = new XML_Presentation(fopen("index.xml", "rb"));
-	$p->setErrorHandling(PEAR_ERROR_DIE,"%s\n");
-	$p->parse();
+	$p->setErrorHandling(PEAR_ERROR_TRIGGER, E_USER_WARNING);
+	$check = $p->parse();
+	if (PEAR::isError($check)) {
+		die("Could not parse index.xml, not sure what to do");
+	}
 	$pres = $p->getObjects();   
 	$pres = $pres[1];
 ?>