Add support for stream resource as $filename constructor parameter
git-svn-id: http://php-reader.googlecode.com/svn/trunk@104 51a70ab9-7547-0410-9469-37e369ee0574
This commit is contained in:
@@ -47,6 +47,7 @@ require_once("Transform.php");
|
||||
*
|
||||
* @package php-reader
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2006-2008 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
@@ -68,7 +69,8 @@ class Reader
|
||||
*/
|
||||
public function __construct($filename, $mode = "rb")
|
||||
{
|
||||
if (is_resource($filename) && get_resource_type($filename) == "file")
|
||||
if (is_resource($filename) &&
|
||||
in_array(get_resource_type($filename), array("file", "stream")))
|
||||
$this->_fd = $filename;
|
||||
else if (($this->_fd = fopen($filename, $mode)) === false)
|
||||
throw new Reader_Exception("Unable to open file:" . $filename);
|
||||
|
||||
Reference in New Issue
Block a user