miniflux-legacy/vendor/zendframework/zendxml
Frederic Guillot f7b3bbd8e9 Update PicoFeed 2016-02-09 20:30:07 -05:00
..
library/ZendXml Upgrade to PicoFeed 0.1.16 2015-12-15 19:26:15 -05:00
tests Upgrade to PicoFeed 0.1.16 2015-12-15 19:26:15 -05:00
.gitignore Upgrade to PicoFeed 0.1.16 2015-12-15 19:26:15 -05:00
.travis.yml Update PicoFeed 2016-02-09 20:30:07 -05:00
CHANGELOG.md Update PicoFeed 2016-02-09 20:30:07 -05:00
LICENSE.md Upgrade to PicoFeed 0.1.16 2015-12-15 19:26:15 -05:00
README.md Upgrade to PicoFeed 0.1.16 2015-12-15 19:26:15 -05:00
composer.json Update PicoFeed 2016-02-09 20:30:07 -05:00

README.md

ZendXml

An utility component for XML usage and best practices in PHP

Installation

You can install using:

curl -s https://getcomposer.org/installer | php
php composer.phar install

Notice that this library doesn't have any external dependencies, the usage of composer is for autoloading and standard purpose.

ZendXml\Security

This is a security component to prevent XML eXternal Entity (XXE) and XML Entity Expansion (XEE) attacks on XML documents.

The XXE attack is prevented disabling the load of external entities in the libxml library used by PHP, using the function libxml_disable_entity_loader.

The XEE attack is prevented looking inside the XML document for ENTITY usage. If the XML document uses ENTITY the library throw an Exception.

We have two static methods to scan and load XML document from a string (scan) and from a file (scanFile). You can decide to get a SimpleXMLElement or DOMDocument as result, using the following use cases:

use ZendXml\Security as XmlSecurity;

$xml = <<<XML
<?xml version="1.0"?>
<results>
    <result>test</result>
</results>
XML;

// SimpleXML use case
$simplexml = XmlSecurity::scan($xml);
printf ("SimpleXMLElement: %s\n", ($simplexml instanceof \SimpleXMLElement) ? 'yes' : 'no');

// DOMDocument use case
$dom = new \DOMDocument('1.0');
$dom = XmlSecurity::scan($xml, $dom);
printf ("DOMDocument: %s\n", ($dom instanceof \DOMDocument) ? 'yes' : 'no');