Skip to content

Commit 9272165

Browse files
Change Fatal Error to Exception
`OneLogin_Saml2_Utils::loadXML` returns `false` if input is not correct XML. Which leads to a Fatal Error : > Call to a member function getAttribute() on null in **/vendor/onelogin/php-saml/lib/Saml2/LogoutRequest.php:163 With this fix, an Exception is thrown.
1 parent 7068f53 commit 9272165

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

lib/Saml2/LogoutRequest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ public function getRequest($deflate = null)
150150
* @param string|DOMDocument $request Logout Request Message
151151
*
152152
* @return string ID
153+
*
154+
* @throws OneLogin_Saml2_Error
153155
*/
154156
public static function getID($request)
155157
{
@@ -158,6 +160,13 @@ public static function getID($request)
158160
} else {
159161
$dom = new DOMDocument();
160162
$dom = OneLogin_Saml2_Utils::loadXML($dom, $request);
163+
164+
if (false === $dom) {
165+
throw new OneLogin_Saml2_Error(
166+
"XML is invalid",
167+
OneLogin_Saml2_Error::SAML_LOGOUTREQUEST_INVALID
168+
);
169+
}
161170
}
162171

163172
$id = $dom->documentElement->getAttribute('ID');

0 commit comments

Comments
 (0)