Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' into acceptHandling
Browse files Browse the repository at this point in the history
Conflicts:
	library/Zend/Http/Header/AbstractAccept.php
	library/Zend/Http/Header/AcceptEncoding.php
	library/Zend/Http/Header/AcceptLanguage.php
	tests/Zend/Http/Header/AcceptCharsetTest.php
	tests/Zend/Http/Header/AcceptEncodingTest.php
	tests/Zend/Http/Header/AcceptLanguageTest.php
	tests/Zend/Http/Header/AcceptTest.php
  • Loading branch information
Freeaqingme committed Jul 14, 2012
6 parents 8579786 + 1582c31 + 016f50c + 9852497 + 073b126 + bd99c5c commit 56451bd
Show file tree
Hide file tree
Showing 39 changed files with 117 additions and 79 deletions.
2 changes: 1 addition & 1 deletion src/Exception/BadMethodCallException.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @category Zend
* @package Zend_Cache
*/
class BadMethodCallException extends \BadMethodCallException implements
class BadMethodCallException extends \BadMethodCallException implements
ExceptionInterface
{
}
2 changes: 1 addition & 1 deletion src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @category Zend
* @package Zend_Cache
*/
class InvalidArgumentException extends \InvalidArgumentException implements
class InvalidArgumentException extends \InvalidArgumentException implements
ExceptionInterface
{
}
2 changes: 1 addition & 1 deletion src/Exception/UnexpectedValueException.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @category Zend
* @package Zend_Cache
*/
class UnexpectedValueException extends \UnexpectedValueException implements
class UnexpectedValueException extends \UnexpectedValueException implements
ExceptionInterface
{
}
2 changes: 1 addition & 1 deletion src/Exception/UnsupportedMethodCallException.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @category Zend
* @package Zend_Cache
*/
class UnsupportedMethodCallException extends \BadMethodCallException implements
class UnsupportedMethodCallException extends \BadMethodCallException implements
ExceptionInterface
{
}
14 changes: 11 additions & 3 deletions src/Pattern/CaptureCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace Zend\Cache\Pattern;

use Zend\Cache\Exception;
use Zend\Stdlib\ErrorHandler;

/**
* @category Zend
Expand Down Expand Up @@ -80,7 +81,10 @@ public function get($pageId = null, array $options = array())
. DIRECTORY_SEPARATOR . $this->pageId2Filename($pageId);

if (file_exists($file)) {
if (($content = @file_get_contents($file)) === false) {
ErrorHandler::start(E_WARNING);
$content = file_get_contents($file);
ErrorHandler::stop();
if ($content === false) {
$lastErr = error_get_last();
throw new Exception\RuntimeException("Failed to read cached pageId '{$pageId}': {$lastErr['message']}");
}
Expand Down Expand Up @@ -268,10 +272,14 @@ protected function putFileContent($file, $data)
$flags = $flags | LOCK_EX;
}

$put = @file_put_contents($file, $data, $flags);
ErrorHandler::start(E_WARNING);
$put = file_put_contents($file, $data, $flags);
ErrorHandler::stop();
if ( $put < strlen((binary)$data) ) {
$lastErr = error_get_last();
@unlink($file); // remove old or incomplete written file
ErrorHandler::start(E_WARNING);
unlink($file); // remove old or incomplete written file
ErrorHandler::stop();
throw new Exception\RuntimeException($lastErr['message']);
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/PatternPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Plugin manager implementation for cache pattern adapters
*
* Enforces that adatpers retrieved are instances of
* Pattern\PatternInterface. Additionally, it registers a number of default
* Pattern\PatternInterface. Additionally, it registers a number of default
* patterns available.
*
* @category Zend
Expand All @@ -26,7 +26,7 @@ class PatternPluginManager extends AbstractPluginManager
{
/**
* Default set of adapters
*
*
* @var array
*/
protected $invokableClasses = array(
Expand All @@ -40,7 +40,7 @@ class PatternPluginManager extends AbstractPluginManager

/**
* Don't share by default
*
*
* @var array
*/
protected $shareByDefault = false;
Expand All @@ -49,8 +49,8 @@ class PatternPluginManager extends AbstractPluginManager
* Validate the plugin
*
* Checks that the pattern adapter loaded is an instance of Pattern\PatternInterface.
*
* @param mixed $plugin
*
* @param mixed $plugin
* @return void
* @throws Exception\RuntimeException if invalid
*/
Expand Down
6 changes: 5 additions & 1 deletion src/Storage/Adapter/AdapterOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Zend\Cache\Storage\StorageInterface;
use Zend\EventManager\EventsCapableInterface;
use Zend\Stdlib\AbstractOptions;
use Zend\Stdlib\ErrorHandler;

/**
* Unless otherwise marked, all options in this class affect all adapters.
Expand Down Expand Up @@ -112,7 +113,10 @@ public function setKeyPattern($keyPattern)
if ($this->keyPattern !== $keyPattern) {
// validate pattern
if ($keyPattern !== '') {
if (@preg_match($keyPattern, '') === false) {
ErrorHandler::start(E_WARNING);
$result = preg_match($keyPattern, '');
ErrorHandler::stop();
if ($result === false) {
$err = error_get_last();
throw new Exception\InvalidArgumentException("Invalid pattern '{$keyPattern}': {$err['message']}");
}
Expand Down
32 changes: 16 additions & 16 deletions src/Storage/Adapter/ApcIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ public function setMode($mode)

/* Iterator */

/**
* Get current key, value or metadata.
*
* @return mixed
/**
* Get current key, value or metadata.
*
* @return mixed
*/
public function current()
{
Expand All @@ -120,10 +120,10 @@ public function current()
return $key;
}

/**
* Get current key
*
* @return string
/**
* Get current key
*
* @return string
*/
public function key()
{
Expand All @@ -143,20 +143,20 @@ public function next()
$this->baseIterator->next();
}

/**
* Checks if current position is valid
*
* @return boolean
/**
* Checks if current position is valid
*
* @return boolean
*/
public function valid()
{
return $this->baseIterator->valid();
}

/**
* Rewind the Iterator to the first element.
*
* @return void
/**
* Rewind the Iterator to the first element.
*
* @return void
*/
public function rewind()
{
Expand Down
4 changes: 3 additions & 1 deletion src/Storage/Adapter/Dba.php
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,9 @@ protected function _open()
protected function _close()
{
if ($this->handle) {
@dba_close($this->handle);
ErrorHandler::start(E_WARNING);
dba_close($this->handle);
ErrorHandler::stop();
$this->handle = null;
}
}
Expand Down
32 changes: 16 additions & 16 deletions src/Storage/Adapter/FilesystemIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ public function setMode($mode)

/* Iterator */

/**
* Get current key, value or metadata.
*
* @return mixed
/**
* Get current key, value or metadata.
*
* @return mixed
*/
public function current()
{
Expand All @@ -128,10 +128,10 @@ public function current()
return $key;
}

/**
* Get current key
*
* @return string
/**
* Get current key
*
* @return string
*/
public function key()
{
Expand All @@ -151,10 +151,10 @@ public function next()
$this->globIterator->next();
}

/**
* Checks if current position is valid
*
* @return boolean
/**
* Checks if current position is valid
*
* @return boolean
*/
public function valid()
{
Expand All @@ -168,10 +168,10 @@ public function valid()
}
}

/**
* Rewind the Iterator to the first element.
*
* @return void
/**
* Rewind the Iterator to the first element.
*
* @return void
*/
public function rewind()
{
Expand Down
32 changes: 16 additions & 16 deletions src/Storage/Adapter/KeyListIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ public function setMode($mode)
return $this;
}

/**
* Get current key, value or metadata.
*
* @return mixed
/**
* Get current key, value or metadata.
*
* @return mixed
*/
public function current()
{
Expand All @@ -125,20 +125,20 @@ public function current()
return $key;
}

/**
* Get current key
*
* @return string
/**
* Get current key
*
* @return string
*/
public function key()
{
return $this->keys[$this->position];
}

/**
* Checks if current position is valid
*
* @return boolean
/**
* Checks if current position is valid
*
* @return boolean
*/
public function valid()
{
Expand All @@ -155,10 +155,10 @@ public function next()
$this->position++;
}

/**
* Rewind the Iterator to the first element.
*
* @return void
/**
* Rewind the Iterator to the first element.
*
* @return void
*/
public function rewind()
{
Expand Down
6 changes: 3 additions & 3 deletions src/Storage/Adapter/ZendServerDisk.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
* @package Zend_Cache
* @subpackage Storage
*/
class ZendServerDisk extends AbstractZendServer implements
AvailableSpaceCapableInterface,
class ZendServerDisk extends AbstractZendServer implements
AvailableSpaceCapableInterface,
ClearByNamespaceInterface,
FlushableInterface,
FlushableInterface,
TotalSpaceCapableInterface
{

Expand Down
2 changes: 1 addition & 1 deletion src/Storage/Adapter/ZendServerShm.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* @package Zend_Cache
* @subpackage Storage
*/
class ZendServerShm extends AbstractZendServer implements
class ZendServerShm extends AbstractZendServer implements
ClearByNamespaceInterface,
FlushableInterface,
TotalSpaceCapableInterface
Expand Down
10 changes: 5 additions & 5 deletions src/Storage/AdapterPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Plugin manager implementation for cache storage adapters
*
* Enforces that adapters retrieved are instances of
* StorageInterface. Additionally, it registers a number of default
* StorageInterface. Additionally, it registers a number of default
* adapters available.
*
* @category Zend
Expand All @@ -28,7 +28,7 @@ class AdapterPluginManager extends AbstractPluginManager
{
/**
* Default set of adapters
*
*
* @var array
*/
protected $invokableClasses = array(
Expand All @@ -48,7 +48,7 @@ class AdapterPluginManager extends AbstractPluginManager

/**
* Do not share by default
*
*
* @var array
*/
protected $shareByDefault = false;
Expand All @@ -57,8 +57,8 @@ class AdapterPluginManager extends AbstractPluginManager
* Validate the plugin
*
* Checks that the adapter loaded is an instance of StorageInterface.
*
* @param mixed $plugin
*
* @param mixed $plugin
* @return void
* @throws Exception\RuntimeException if invalid
*/
Expand Down
Loading

0 comments on commit 56451bd

Please sign in to comment.