diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-07-10 01:51:02 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-07-10 01:51:02 +0000 |
commit | 57ab633bc52c08aacc0463d496ff09f034e0f8d1 (patch) | |
tree | eeda14d7b599c94e1a46e6397828c29c75b654df /includes/stream_wrappers.inc | |
parent | 856b6e1f408a0c5d8f8865f6b80a629e2f99948c (diff) | |
download | brdo-57ab633bc52c08aacc0463d496ff09f034e0f8d1.tar.gz brdo-57ab633bc52c08aacc0463d496ff09f034e0f8d1.tar.bz2 |
- Patch #844676 by chx, asimmonds: stream wrappers stream_seek() return is invalid.
Diffstat (limited to 'includes/stream_wrappers.inc')
-rw-r--r-- | includes/stream_wrappers.inc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/includes/stream_wrappers.inc b/includes/stream_wrappers.inc index 13cd421d4..553628912 100644 --- a/includes/stream_wrappers.inc +++ b/includes/stream_wrappers.inc @@ -477,7 +477,9 @@ abstract class DrupalLocalStreamWrapper implements DrupalStreamWrapperInterface * @see http://php.net/manual/en/streamwrapper.stream-seek.php */ public function stream_seek($offset, $whence) { - return fseek($this->handle, $offset, $whence); + // fseek returns 0 on success and -1 on a failure. + // stream_seek 1 on success and 0 on a failure. + return !fseek($this->handle, $offset, $whence); } /** @@ -711,7 +713,11 @@ abstract class DrupalLocalStreamWrapper implements DrupalStreamWrapperInterface * @see http://php.net/manual/en/streamwrapper.dir-rewinddir.php */ public function dir_rewinddir() { - return rewinddir($this->handle); + rewinddir($this->handle); + // We do not really have a way to signal a failure as rewinddir() does not + // have a return value and there is no way to read a directory handler + // without advancing to the next file. + return TRUE; } /** @@ -723,7 +729,10 @@ abstract class DrupalLocalStreamWrapper implements DrupalStreamWrapperInterface * @see http://php.net/manual/en/streamwrapper.dir-closedir.php */ public function dir_closedir() { - return closedir($this->handle); + closedir($this->handle); + // We do not really have a way to signal a failure as closedir() does not + // have a return value. + return TRUE; } } |