Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Catch LogicException for Rewind and fix CP errors #4154

Closed
wants to merge 1 commit into from

2 participants

@mvriel

The rewind method is, as the valid() method, affected by an issue
with the GlobIterator where it throws a LogicException if the dataset
is empty (https://bugs.php.net/bug.php?id=55701).

This exception should be caught and correctly returned as this will
interfere with foreach statements at the invoker.

In addition to the above have several copy-paste errors in the
DocBlocks been fixed.

@mvriel mvriel Catch LogicException for Rewind and fix CP errors
The rewind method is, as the valid() method, affected by an issue
with the GlobIterator where it throws a LogicException if the dataset
is empty (https://bugs.php.net/bug.php?id=55701).

This exception should be caught and correctly returned as this will
interfere with foreach statements at the invoker.

In addition to the above have several copy-paste errors in the 
DocBlocks been fixed.
bf89533
@mvriel

The failed travis build is not due to a failed unit test but some weirdness in the 5.3.3 build

@weierophinney

This actually applies against master as well, so I took the liberty of cherry-picking the commit to ensure it makes it into 2.1.5 as well.

Thanks, Mike!

@ghost Unknown referenced this pull request from a commit
@weierophinney weierophinney Merge branch 'hotfix/4154'
Close #4154
3b0e930
@ghost Unknown referenced this pull request from a commit
@weierophinney weierophinney Merge branch 'hotfix/4154' into develop
Forward port #4154
ba36313
@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-cache
@weierophinney weierophinney Merge branch 'hotfix/4154' d7d67f1
@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-cache
@weierophinney weierophinney Merge branch 'hotfix/4154' into develop d51cc61
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 30, 2013
  1. @mvriel

    Catch LogicException for Rewind and fix CP errors

    mvriel authored
    The rewind method is, as the valid() method, affected by an issue
    with the GlobIterator where it throws a LogicException if the dataset
    is empty (https://bugs.php.net/bug.php?id=55701).
    
    This exception should be caught and correctly returned as this will
    interfere with foreach statements at the invoker.
    
    In addition to the above have several copy-paste errors in the 
    DocBlocks been fixed.
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 5 deletions.
  1. +12 −5 library/Zend/Cache/Storage/Adapter/FilesystemIterator.php
View
17 library/Zend/Cache/Storage/Adapter/FilesystemIterator.php
@@ -16,9 +16,9 @@ class FilesystemIterator implements IteratorInterface
{
/**
- * The apc storage instance
+ * The Filesystem storage instance
*
- * @var Apc
+ * @var Filesystem
*/
protected $storage;
@@ -89,7 +89,7 @@ public function getMode()
* Set iterator mode
*
* @param int $mode
- * @return ApcIterator Fluent interface
+ * @return FilesystemIterator Fluent interface
*/
public function setMode($mode)
{
@@ -164,10 +164,17 @@ public function valid()
/**
* Rewind the Iterator to the first element.
*
- * @return void
+ * @return bool false if the operation failed.
*/
public function rewind()
{
- return $this->globIterator->rewind();
+ try {
+ return $this->globIterator->rewind();
+ } catch (\LogicException $e) {
+ // @link https://bugs.php.net/bug.php?id=55701
+ // GlobIterator throws LogicException with message
+ // 'The parent constructor was not called: the object is in an invalid state'
+ return false;
+ }
}
}
Something went wrong with that request. Please try again.