Skip to content

Commit a10911a

Browse files
committed
Merge branch '2.5'
* 2.5: typo fixed in AbstractProcessTest (getoutput() => getOutput()) Avoid question mark and asterisk in folder names to prevent windows filesystem issues. [Translation] [Config] Clear libxml errors after parsing XML file check for the Validator if forms are enabled Clear json_last_error Fix JsonSerializable namespace Catch exceptions to restore the error handler [HttpFoundation] Silent only JSON errors
2 parents 6358e80 + a0c84ef commit a10911a

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

Tests/Util/XmlUtilsTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ public function testLoadFile()
5858
}
5959

6060
$this->assertInstanceOf('DOMDocument', XmlUtils::loadFile($fixtures.'valid.xml', array($mock, 'validate')));
61+
$this->assertSame(array(), libxml_get_errors());
62+
}
63+
64+
public function testLoadFileWithInternalErrorsEnabled()
65+
{
66+
libxml_use_internal_errors(true);
67+
68+
$this->assertSame(array(), libxml_get_errors());
69+
$this->assertInstanceOf('DOMDocument', XmlUtils::loadFile(__DIR__.'/../Fixtures/Util/invalid_schema.xml'));
70+
$this->assertSame(array(), libxml_get_errors());
6171
}
6272

6373
/**

Util/XmlUtils.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,11 @@ public static function loadFile($file, $schemaOrCallable = null)
9595
}
9696
throw new \InvalidArgumentException(implode("\n", $messages), 0, $e);
9797
}
98-
99-
libxml_use_internal_errors($internalErrors);
10098
}
10199

100+
libxml_clear_errors();
101+
libxml_use_internal_errors($internalErrors);
102+
102103
return $dom;
103104
}
104105

0 commit comments

Comments
 (0)