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

Commit

Permalink
Merge branch 'master' of github.com:zendframework/zf2
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 129 changed files with 1,414 additions and 687 deletions.
10 changes: 4 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}
},
"require": {
"php": ">=5.3.3",
"php": ">=5.3.23",
"zendframework/zend-stdlib": "self.version"
},
"require-dev": {
Expand All @@ -28,14 +28,12 @@
"zendframework/zend-crypt": "Zend\\Crypt component",
"zendframework/zend-i18n": "Zend\\I18n component",
"zendframework/zend-servicemanager": "Zend\\ServiceManager component",
"zendframework/zend-uri": "Zend\\Uri component for UriNormalize filter",
"zendframework/zend-validator": "Zend\\Validator component",
"zendframework/zend-stdlib": "Zend\\Stdlib component"
"zendframework/zend-uri": "Zend\\Uri component for UriNormalize filter"
},
"extra": {
"branch-alias": {
"dev-master": "2.2-dev",
"dev-develop": "2.3-dev"
"dev-master": "2.3-dev",
"dev-develop": "2.4-dev"
}
},
"autoload-dev": {
Expand Down
5 changes: 2 additions & 3 deletions src/AbstractFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down Expand Up @@ -32,7 +32,7 @@ public static function hasPcreUnicodeSupport()

/**
* @param array|Traversable $options
* @return AbstractFilter
* @return self
* @throws Exception\InvalidArgumentException
*/
public function setOptions($options)
Expand Down Expand Up @@ -86,7 +86,6 @@ public function __invoke($value)
}

/**
*
* @param mixed $options
* @return bool
*/
Expand Down
4 changes: 2 additions & 2 deletions src/AbstractUnicode.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -15,7 +15,7 @@ abstract class AbstractUnicode extends AbstractFilter
* Set the input encoding for the given string
*
* @param string|null $encoding
* @return StringToLower
* @return self
* @throws Exception\InvalidArgumentException
* @throws Exception\ExtensionNotLoadedException
*/
Expand Down
15 changes: 11 additions & 4 deletions src/BaseName.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -14,13 +14,20 @@ class BaseName extends AbstractFilter
/**
* Defined by Zend\Filter\FilterInterface
*
* Returns basename($value)
* Returns basename($value).
*
* If the value provided is non-scalar, the value will remain unfiltered
*
* @param string $value
* @return string
* @return string|mixed
*/
public function filter($value)
{
return basename((string) $value);
if (!is_scalar($value)) {
return $value;
}
$value = (string) $value;

return basename($value);
}
}
8 changes: 4 additions & 4 deletions src/Boolean.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down Expand Up @@ -90,7 +90,7 @@ public function __construct($typeOrOptions = null, $casting = true, $translation
*
* @param int|array $type
* @throws Exception\InvalidArgumentException
* @return bool
* @return self
*/
public function setType($type = null)
{
Expand Down Expand Up @@ -137,7 +137,7 @@ public function getType()
* @param bool $flag When true this filter works like cast
* When false it recognises only true and false
* and all other values are returned as is
* @return bool
* @return self
*/
public function setCasting($flag = true)
{
Expand All @@ -158,7 +158,7 @@ public function getCasting()
/**
* @param array|Traversable $translations
* @throws Exception\InvalidArgumentException
* @return bool
* @return self
*/
public function setTranslations($translations)
{
Expand Down
8 changes: 4 additions & 4 deletions src/Callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down Expand Up @@ -67,8 +67,8 @@ public function getCallback()
/**
* Sets parameters for the callback
*
* @param mixed $params
* @return Callback
* @param array $params
* @return self
*/
public function setCallbackParams($params)
{
Expand All @@ -79,7 +79,7 @@ public function setCallbackParams($params)
/**
* Get parameters for the callback
*
* @return mixed
* @return array
*/
public function getCallbackParams()
{
Expand Down
12 changes: 8 additions & 4 deletions src/Compress.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down Expand Up @@ -51,7 +51,7 @@ public function __construct($options = null)
*
* @param array $options
* @throws Exception\InvalidArgumentException if options is not an array or Traversable
* @return Compress
* @return self
*/
public function setOptions($options)
{
Expand Down Expand Up @@ -122,7 +122,7 @@ public function getAdapterName()
* Sets compression adapter
*
* @param string|Compress\CompressionAlgorithmInterface $adapter Adapter to use
* @return Compress
* @return self
* @throws Exception\InvalidArgumentException
*/
public function setAdapter($adapter)
Expand Down Expand Up @@ -153,7 +153,7 @@ public function getAdapterOptions()
* Set adapter options
*
* @param array $options
* @return Compress
* @return self
*/
public function setAdapterOptions(array $options)
{
Expand Down Expand Up @@ -201,6 +201,10 @@ public function __call($method, $options)
*/
public function filter($value)
{
if (!is_string($value)) {
return $value;
}

return $this->getAdapter()->compress($value);
}
}
4 changes: 2 additions & 2 deletions src/Compress/AbstractCompressionAlgorithm.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down Expand Up @@ -61,7 +61,7 @@ public function getOptions($option = null)
* Sets all or one option
*
* @param array $options
* @return AbstractCompressionAlgorithm
* @return self
*/
public function setOptions(array $options)
{
Expand Down
10 changes: 6 additions & 4 deletions src/Compress/Bz2.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down Expand Up @@ -59,7 +59,7 @@ public function getBlocksize()
*
* @param int $blocksize
* @throws Exception\InvalidArgumentException
* @return Bz2
* @return self
*/
public function setBlocksize($blocksize)
{
Expand All @@ -85,7 +85,7 @@ public function getArchive()
* Sets the archive to use for de-/compression
*
* @param string $archive Archive to use
* @return Bz2
* @return self
*/
public function setArchive($archive)
{
Expand Down Expand Up @@ -133,7 +133,9 @@ public function compress($content)
public function decompress($content)
{
$archive = $this->getArchive();
if (file_exists($content)) {

//check if there are null byte characters before doing a file_exists check
if (!strstr($content, "\0") && file_exists($content)) {
$archive = $content;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Compress/CompressionAlgorithmInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
14 changes: 8 additions & 6 deletions src/Compress/Gz.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down Expand Up @@ -61,7 +61,7 @@ public function getLevel()
*
* @param int $level
* @throws Exception\InvalidArgumentException
* @return Gz
* @return self
*/
public function setLevel($level)
{
Expand All @@ -87,7 +87,7 @@ public function getMode()
* Sets a new compression mode
*
* @param string $mode Supported are 'compress', 'deflate' and 'file'
* @return Gz
* @return self
* @throws Exception\InvalidArgumentException for invalid $mode value
*/
public function setMode($mode)
Expand All @@ -114,7 +114,7 @@ public function getArchive()
* Sets the archive to use for de-/compression
*
* @param string $archive Archive to use
* @return Gz
* @return self
*/
public function setArchive($archive)
{
Expand Down Expand Up @@ -165,7 +165,9 @@ public function decompress($content)
{
$archive = $this->getArchive();
$mode = $this->getMode();
if (file_exists($content)) {

//check if there are null byte characters before doing a file_exists check
if (!strstr($content, "\0") && file_exists($content)) {
$archive = $content;
}

Expand All @@ -190,7 +192,7 @@ public function decompress($content)
$compressed = gzuncompress($content);
}

if (!$compressed) {
if ($compressed === false) {
throw new Exception\RuntimeException('Error during decompression');
}

Expand Down
2 changes: 1 addition & 1 deletion src/Compress/Lzf.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
10 changes: 5 additions & 5 deletions src/Compress/Rar.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down Expand Up @@ -62,7 +62,7 @@ public function getCallback()
* Sets the callback to use
*
* @param string $callback
* @return Rar
* @return self
* @throws Exception\InvalidArgumentException if invalid callback provided
*/
public function setCallback($callback)
Expand All @@ -89,7 +89,7 @@ public function getArchive()
* Sets the archive to use for de-/compression
*
* @param string $archive Archive to use
* @return Rar
* @return self
*/
public function setArchive($archive)
{
Expand All @@ -113,7 +113,7 @@ public function getPassword()
* Sets the password to use
*
* @param string $password
* @return Rar
* @return self
*/
public function setPassword($password)
{
Expand All @@ -135,7 +135,7 @@ public function getTarget()
* Sets the targetpath to use
*
* @param string $target
* @return Rar
* @return self
* @throws Exception\InvalidArgumentException if specified target directory does not exist
*/
public function setTarget($target)
Expand Down
2 changes: 1 addition & 1 deletion src/Compress/Snappy.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand Down
Loading

0 comments on commit 7eee6bd

Please sign in to comment.