web/lib/Zend/Config/Xml.php
changeset 1230 68c69c656a2c
parent 807 877f952ae2bd
equal deleted inserted replaced
1229:5a6b6e770365 1230:68c69c656a2c
    12  * obtain it through the world-wide-web, please send an email
    12  * obtain it through the world-wide-web, please send an email
    13  * to license@zend.com so we can send you a copy immediately.
    13  * to license@zend.com so we can send you a copy immediately.
    14  *
    14  *
    15  * @category  Zend
    15  * @category  Zend
    16  * @package   Zend_Config
    16  * @package   Zend_Config
    17  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    17  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
    18  * @license   http://framework.zend.com/license/new-bsd     New BSD License
    18  * @license   http://framework.zend.com/license/new-bsd     New BSD License
    19  * @version   $Id: Xml.php 24593 2012-01-05 20:35:02Z matthew $
    19  * @version   $Id$
    20  */
    20  */
    21 
    21 
    22 /**
    22 /**
    23  * @see Zend_Config
    23  * @see Zend_Config
    24  */
    24  */
    25 require_once 'Zend/Config.php';
    25 require_once 'Zend/Config.php';
       
    26 
       
    27 /** @see Zend_Xml_Security */
       
    28 require_once 'Zend/Xml/Security.php';
       
    29 
       
    30 /** @see Zend_Xml_Exception */
       
    31 require_once 'Zend/Xml/Exception.php';
    26 
    32 
    27 /**
    33 /**
    28  * XML Adapter for Zend_Config
    34  * XML Adapter for Zend_Config
    29  *
    35  *
    30  * @category  Zend
    36  * @category  Zend
    31  * @package   Zend_Config
    37  * @package   Zend_Config
    32  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    38  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
    33  * @license   http://framework.zend.com/license/new-bsd     New BSD License
    39  * @license   http://framework.zend.com/license/new-bsd     New BSD License
    34  */
    40  */
    35 class Zend_Config_Xml extends Zend_Config
    41 class Zend_Config_Xml extends Zend_Config
    36 {
    42 {
    37     /**
    43     /**
    94             }
   100             }
    95         }
   101         }
    96 
   102 
    97         set_error_handler(array($this, '_loadFileErrorHandler')); // Warnings and errors are suppressed
   103         set_error_handler(array($this, '_loadFileErrorHandler')); // Warnings and errors are suppressed
    98         if (strstr($xml, '<?xml')) {
   104         if (strstr($xml, '<?xml')) {
    99             $config = simplexml_load_string($xml);
   105             $config = Zend_Xml_Security::scan($xml);
   100         } else {
   106         } else {
   101             $config = simplexml_load_file($xml);
   107             try {
       
   108                 if (!$config = Zend_Xml_Security::scanFile($xml)) {
       
   109                     require_once 'Zend/Config/Exception.php';
       
   110                     throw new Zend_Config_Exception(
       
   111                         "Error failed to load $xml file"
       
   112                     );
       
   113                 }
       
   114             } catch (Zend_Xml_Exception $e) {
       
   115                 require_once 'Zend/Config/Exception.php';
       
   116                 throw new Zend_Config_Exception(
       
   117                     $e->getMessage()
       
   118                 );
       
   119             }
   102         }
   120         }
   103 
   121 
   104         restore_error_handler();
   122         restore_error_handler();
   105         // Check if there was a error while loading file
   123         // Check if there was a error while loading file
   106         if ($this->_loadFileErrorStr !== null) {
   124         if ($this->_loadFileErrorStr !== null) {