summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornao-pon <hypweb@gmail.com>2013-08-25 14:38:52 +0900
committernao-pon <hypweb@gmail.com>2013-08-25 14:38:52 +0900
commitd50036036d40805ef96607d0e67363b0ed72b88f (patch)
treee8c1b27b8728c21df30d0f53172a3fa299fb0d52
parent3fbd48beb68d75cc3ab3e8246f85018f9cf673e2 (diff)
downloadphp-openid-d50036036d40805ef96607d0e67363b0ed72b88f.zip
php-openid-d50036036d40805ef96607d0e67363b0ed72b88f.tar.gz
php-openid-d50036036d40805ef96607d0e67363b0ed72b88f.tar.bz2
correction for PHP < 5.2.11
libxml_disable_entity_loader (PHP 5 >= 5.2.11)
-rw-r--r--Auth/Yadis/XML.php17
1 files changed, 11 insertions, 6 deletions
diff --git a/Auth/Yadis/XML.php b/Auth/Yadis/XML.php
index bb13775..39a9942 100644
--- a/Auth/Yadis/XML.php
+++ b/Auth/Yadis/XML.php
@@ -234,12 +234,17 @@ class Auth_Yadis_dom extends Auth_Yadis_XMLParser {
return false;
}
- // disable external entities and libxml errors
- $loader = libxml_disable_entity_loader(true);
- $errors = libxml_use_internal_errors(true);
- $parse_result = @$this->doc->loadXML($xml_string);
- libxml_disable_entity_loader($loader);
- libxml_use_internal_errors($errors);
+ // libxml_disable_entity_loader (PHP 5 >= 5.2.11)
+ if (function_exists('libxml_disable_entity_loader') && function_exists('libxml_use_internal_errors')) {
+ // disable external entities and libxml errors
+ $loader = libxml_disable_entity_loader(true);
+ $errors = libxml_use_internal_errors(true);
+ $parse_result = @$this->doc->loadXML($xml_string);
+ libxml_disable_entity_loader($loader);
+ libxml_use_internal_errors($errors);
+ } else {
+ $parse_result = @$this->doc->loadXML($xml_string);
+ }
if (!$parse_result) {
return false;