What are the potential pitfalls of using entities in XSLTProcessor in PHP?

Using entities in XSLTProcessor in PHP can potentially introduce security vulnerabilities such as XXE (XML External Entity) attacks, where an attacker can exploit the entity declaration to access sensitive information or execute arbitrary code. To prevent this, it is recommended to disable external entities when using XSLTProcessor by setting the "LIBXML_NONET" option.

$processor = new XSLTProcessor();
$processor->registerPHPFunctions();
$processor->setParameter('', 'param', 'value');

$doc = new DOMDocument();
$doc->loadXML($xml);

$processor->importStylesheet($xsl);

// Disable external entities
$processor->setSecurityPrefs(XMLReader::SUBST_ENTITIES, true);