web/lib/Zend/Gdata/Gapps/ServiceException.php
changeset 1230 68c69c656a2c
parent 807 877f952ae2bd
equal deleted inserted replaced
1229:5a6b6e770365 1230:68c69c656a2c
    14  * to license@zend.com so we can send you a copy immediately.
    14  * to license@zend.com so we can send you a copy immediately.
    15  *
    15  *
    16  * @category   Zend
    16  * @category   Zend
    17  * @package    Zend_Gdata
    17  * @package    Zend_Gdata
    18  * @subpackage Gapps
    18  * @subpackage Gapps
    19  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    19  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
    20  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    20  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    21  * @version    $Id: ServiceException.php 24593 2012-01-05 20:35:02Z matthew $
    21  * @version    $Id$
    22  */
    22  */
    23 
    23 
    24 
    24 
    25 /**
    25 /**
    26  * Zend_Exception
    26  * Zend_Exception
    29 
    29 
    30 /**
    30 /**
    31  * Zend_Gdata_Gapps_Error
    31  * Zend_Gdata_Gapps_Error
    32  */
    32  */
    33 require_once 'Zend/Gdata/Gapps/Error.php';
    33 require_once 'Zend/Gdata/Gapps/Error.php';
       
    34 
       
    35 /** @see Zend_Xml_Security */
       
    36 require_once 'Zend/Xml/Security.php';
    34 
    37 
    35 /**
    38 /**
    36  * Gdata Gapps Exception class. This is thrown when an
    39  * Gdata Gapps Exception class. This is thrown when an
    37  * AppsForYourDomainErrors message is received from the Google Apps
    40  * AppsForYourDomainErrors message is received from the Google Apps
    38  * servers.
    41  * servers.
    41  * of error codes available, see getErrorCode.
    44  * of error codes available, see getErrorCode.
    42  *
    45  *
    43  * @category   Zend
    46  * @category   Zend
    44  * @package    Zend_Gdata
    47  * @package    Zend_Gdata
    45  * @subpackage Gapps
    48  * @subpackage Gapps
    46  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    49  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
    47  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    50  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    48  */
    51  */
    49 class Zend_Gdata_Gapps_ServiceException extends Zend_Exception
    52 class Zend_Gdata_Gapps_ServiceException extends Zend_Exception
    50 {
    53 {
    51 
    54 
   158             // track_errors is temporarily enabled so that if an error
   161             // track_errors is temporarily enabled so that if an error
   159             // occurs while parsing the XML we can append it to an
   162             // occurs while parsing the XML we can append it to an
   160             // exception by referencing $php_errormsg
   163             // exception by referencing $php_errormsg
   161             @ini_set('track_errors', 1);
   164             @ini_set('track_errors', 1);
   162             $doc = new DOMDocument();
   165             $doc = new DOMDocument();
   163             $success = @$doc->loadXML($string);
   166             $doc = @Zend_Xml_Security::scan($string, $doc);
   164             @ini_restore('track_errors');
   167             @ini_restore('track_errors');
   165 
   168 
   166             if (!$success) {
   169             if (!$doc) {
   167                 require_once 'Zend/Gdata/App/Exception.php';
   170                 require_once 'Zend/Gdata/App/Exception.php';
   168                 // $php_errormsg is automatically generated by PHP if
   171                 // $php_errormsg is automatically generated by PHP if
   169                 // an error occurs while calling loadXML(), above.
   172                 // an error occurs while calling loadXML(), above.
   170                 throw new Zend_Gdata_App_Exception("DOMDocument cannot parse XML: $php_errormsg");
   173                 throw new Zend_Gdata_App_Exception("DOMDocument cannot parse XML: $php_errormsg");
   171             }
   174             }