mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
MDL-76953 mod: deprecate libxml library method wrappers.
The `libxml_disable_entity_loader` method is deprecated since PHP8.0, which is our minimum required version so we no longer need to support calls to it using the current wrappers.
This commit is contained in:
parent
1b1a15a308
commit
436a279dec
@ -117,11 +117,9 @@ function imscp_parse_structure($imscp, $context) {
|
||||
*/
|
||||
function imscp_parse_manifestfile($manifestfilecontents, $imscp, $context) {
|
||||
$doc = new DOMDocument();
|
||||
$oldentities = imscp_libxml_disable_entity_loader(true);
|
||||
if (!$doc->loadXML($manifestfilecontents, LIBXML_NONET)) {
|
||||
return null;
|
||||
}
|
||||
imscp_libxml_disable_entity_loader($oldentities);
|
||||
|
||||
// We put this fake URL as base in order to detect path changes caused by xml:base attributes.
|
||||
$doc->documentURI = 'http://grrr/';
|
||||
@ -221,11 +219,9 @@ function imscp_recursive_href($manifestfilename, $imscp, $context) {
|
||||
}
|
||||
|
||||
$doc = new DOMDocument();
|
||||
$oldentities = imscp_libxml_disable_entity_loader(true);
|
||||
if (!$doc->loadXML($manifestfile->get_content(), LIBXML_NONET)) {
|
||||
return null;
|
||||
}
|
||||
imscp_libxml_disable_entity_loader($oldentities);
|
||||
|
||||
$xmlresources = $doc->getElementsByTagName('resource');
|
||||
foreach ($xmlresources as $res) {
|
||||
@ -283,11 +279,11 @@ function imscp_recursive_item($xmlitem, $level, $resources) {
|
||||
*
|
||||
* @param bool $value
|
||||
* @return bool
|
||||
*
|
||||
* @deprecated since Moodle 4.3
|
||||
*/
|
||||
function imscp_libxml_disable_entity_loader(bool $value): bool {
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
return (bool)libxml_disable_entity_loader($value);
|
||||
}
|
||||
debugging(__FUNCTION__ . '() is deprecated, please do not use it any more', DEBUG_DEVELOPER);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,9 @@
|
||||
This files describes API changes in the imscp code.
|
||||
|
||||
=== 4.3 ===
|
||||
|
||||
* The `imscp_libxml_disable_entity_loader` method is deprecated, as it is no longer required from PHP 8.0
|
||||
|
||||
=== 3.0 ===
|
||||
|
||||
* External function mod_imscp_external::get_imscps_by_courses returned parameter "name" has been changed to PARAM_RAW,
|
||||
|
@ -4477,7 +4477,6 @@ function lti_load_cartridge($url, $map, $propertiesmap = array()) {
|
||||
|
||||
// TODO MDL-46023 Replace this code with a call to the new library.
|
||||
$origerrors = libxml_use_internal_errors(true);
|
||||
$origentity = lti_libxml_disable_entity_loader(true);
|
||||
libxml_clear_errors();
|
||||
|
||||
$document = new DOMDocument();
|
||||
@ -4489,7 +4488,6 @@ function lti_load_cartridge($url, $map, $propertiesmap = array()) {
|
||||
|
||||
libxml_clear_errors();
|
||||
libxml_use_internal_errors($origerrors);
|
||||
lti_libxml_disable_entity_loader($origentity);
|
||||
|
||||
if (count($errors) > 0) {
|
||||
$message = 'Failed to load cartridge.';
|
||||
@ -4584,10 +4582,10 @@ function lti_new_access_token($typeid, $scopes) {
|
||||
*
|
||||
* @param bool $value
|
||||
* @return bool
|
||||
*
|
||||
* @deprecated since Moodle 4.3
|
||||
*/
|
||||
function lti_libxml_disable_entity_loader(bool $value): bool {
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
return (bool)libxml_disable_entity_loader($value);
|
||||
}
|
||||
debugging(__FUNCTION__ . '() is deprecated, please do not use it any more', DEBUG_DEVELOPER);
|
||||
return true;
|
||||
}
|
||||
|
@ -70,13 +70,10 @@ if ($consumerkey === false) {
|
||||
}
|
||||
|
||||
// TODO MDL-46023 Replace this code with a call to the new library.
|
||||
$origentity = lti_libxml_disable_entity_loader(true);
|
||||
$xml = simplexml_load_string($rawbody);
|
||||
if (!$xml) {
|
||||
lti_libxml_disable_entity_loader($origentity);
|
||||
throw new Exception('Invalid XML content');
|
||||
}
|
||||
lti_libxml_disable_entity_loader($origentity);
|
||||
|
||||
$body = $xml->imsx_POXBody;
|
||||
foreach ($body->children() as $child) {
|
||||
|
@ -1,5 +1,9 @@
|
||||
This files describes API changes in the lti code.
|
||||
|
||||
=== 4.3 ===
|
||||
|
||||
* The `lti_libxml_disable_entity_loader` method is deprecated, as it is no longer required from PHP 8.0
|
||||
|
||||
=== 4.2 ===
|
||||
|
||||
* get_jwt_claim_mappings() function has been added to service_base class. It allows a service subplugin to be
|
||||
|
Loading…
x
Reference in New Issue
Block a user