import v2.0.0.0_RC3 | 2012-07-01
https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
@ -17,7 +17,7 @@
|
||||
* @subpackage FileParser
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: File.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: File.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_FileParserDataSource */
|
||||
@ -75,18 +75,22 @@ class Zend_Pdf_FileParserDataSource_File extends Zend_Pdf_FileParserDataSource
|
||||
public function __construct($filePath)
|
||||
{
|
||||
if (! (is_file($filePath) || is_link($filePath))) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Invalid file path: $filePath",
|
||||
Zend_Pdf_Exception::BAD_FILE_PATH);
|
||||
}
|
||||
if (! is_readable($filePath)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("File is not readable: $filePath",
|
||||
Zend_Pdf_Exception::NOT_READABLE);
|
||||
}
|
||||
if (($this->_size = @filesize($filePath)) === false) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Error while obtaining file size: $filePath",
|
||||
Zend_Pdf_Exception::CANT_GET_FILE_SIZE);
|
||||
}
|
||||
if (($this->_fileResource = @fopen($filePath, 'rb')) === false) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Cannot open file for reading: $filePath",
|
||||
Zend_Pdf_Exception::CANT_OPEN_FILE);
|
||||
}
|
||||
@ -122,10 +126,12 @@ class Zend_Pdf_FileParserDataSource_File extends Zend_Pdf_FileParserDataSource
|
||||
{
|
||||
$bytes = @fread($this->_fileResource, $byteCount);
|
||||
if ($bytes === false) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Unexpected error while reading file',
|
||||
Zend_Pdf_Exception::ERROR_DURING_READ);
|
||||
}
|
||||
if (strlen($bytes) != $byteCount) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Insufficient data to read $byteCount bytes",
|
||||
Zend_Pdf_Exception::INSUFFICIENT_DATA);
|
||||
}
|
||||
@ -178,10 +184,12 @@ class Zend_Pdf_FileParserDataSource_File extends Zend_Pdf_FileParserDataSource
|
||||
parent::moveToOffset($offset);
|
||||
$result = @fseek($this->_fileResource, $offset, SEEK_SET);
|
||||
if ($result !== 0) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Error while setting new file position',
|
||||
Zend_Pdf_Exception::CANT_SET_FILE_POSITION);
|
||||
}
|
||||
if (feof($this->_fileResource)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Moved beyond the end of the file',
|
||||
Zend_Pdf_Exception::MOVE_BEYOND_END_OF_FILE);
|
||||
}
|
||||
|
@ -17,13 +17,12 @@
|
||||
* @subpackage FileParser
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: String.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: String.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_FileParserDataSource */
|
||||
require_once 'Zend/Pdf/FileParserDataSource.php';
|
||||
|
||||
|
||||
/**
|
||||
* Concrete subclass of {@link Zend_Pdf_FileParserDataSource} that provides an
|
||||
* interface to binary strings.
|
||||
@ -61,6 +60,7 @@ class Zend_Pdf_FileParserDataSource_String extends Zend_Pdf_FileParserDataSource
|
||||
public function __construct($string)
|
||||
{
|
||||
if (empty($string)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('String is empty',
|
||||
Zend_Pdf_Exception::PARAMETER_VALUE_OUT_OF_RANGE);
|
||||
}
|
||||
@ -92,6 +92,7 @@ class Zend_Pdf_FileParserDataSource_String extends Zend_Pdf_FileParserDataSource
|
||||
public function readBytes($byteCount)
|
||||
{
|
||||
if (($this->_offset + $byteCount) > $this->_size) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Insufficient data to read $byteCount bytes",
|
||||
Zend_Pdf_Exception::INSUFFICIENT_DATA);
|
||||
}
|
||||
@ -124,5 +125,4 @@ class Zend_Pdf_FileParserDataSource_String extends Zend_Pdf_FileParserDataSource
|
||||
{
|
||||
return "String ($this->_size bytes)";
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user