diff options
author | robocoder <anthon.pang@gmail.com> | 2010-07-31 07:47:23 +0400 |
---|---|---|
committer | robocoder <anthon.pang@gmail.com> | 2010-07-31 07:47:23 +0400 |
commit | e192d0b2ffaac97e75c7348102aea663ac250528 (patch) | |
tree | 288d3457f830b5acb7d6d06856b4992df7525a1b /libs/Zend | |
parent | f75704a6e634d40f9bfb69b9339274366fb34ca1 (diff) |
fixes #1539 - on second thought, I'll copy Uri.php and Http/Client.php, and comment out the offending code
git-svn-id: http://dev.piwik.org/svn/trunk@2833 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'libs/Zend')
71 files changed, 493 insertions, 290 deletions
diff --git a/libs/Zend/Auth/Adapter/DbTable.php b/libs/Zend/Auth/Adapter/DbTable.php index efad58f29b..c0c06b82c6 100644 --- a/libs/Zend/Auth/Adapter/DbTable.php +++ b/libs/Zend/Auth/Adapter/DbTable.php @@ -17,7 +17,7 @@ * @subpackage Adapter * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: DbTable.php 22458 2010-06-18 22:47:46Z ralph $ + * @version $Id: DbTable.php 22614 2010-07-17 13:46:07Z dragonbe $ */ @@ -114,6 +114,15 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface * @var array */ protected $_resultRow = null; + + /** + * $_ambiguityIdentity - Flag to indicate same Identity can be used with + * different credentials. Default is FALSE and need to be set to true to + * allow ambiguity usage. + * + * @var boolean + */ + protected $_ambiguityIdentity = false; /** * __construct() - Sets configuration options @@ -256,6 +265,34 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface $this->_credential = $credential; return $this; } + + /** + * setAmbiguityIdentity() - sets a flag for usage of identical identities + * with unique credentials. It accepts integers (0, 1) or boolean (true, + * false) parameters. Default is false. + * + * @param int|bool $flag + * @return Zend_Auth_Adapter_DbTable + */ + public function setAmbiguityIdentity($flag) + { + if (is_integer($flag)) { + $this->_ambiguityIdentity = (1 === $flag ? true : false); + } elseif (is_bool($flag)) { + $this->_ambiguityIdentity = $flag; + } + return $this; + } + /** + * getAmbiguityIdentity() - returns TRUE for usage of multiple identical + * identies with different credentials, FALSE if not used. + * + * @return bool + */ + public function getAmbiguityIdentity() + { + return $this->_ambiguityIdentity; + } /** * getDbSelect() - Return the preauthentication Db Select object for userland select query modification @@ -330,11 +367,22 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface $this->_authenticateSetup(); $dbSelect = $this->_authenticateCreateSelect(); $resultIdentities = $this->_authenticateQuerySelect($dbSelect); - + if ( ($authResult = $this->_authenticateValidateResultSet($resultIdentities)) instanceof Zend_Auth_Result) { return $authResult; } + if (true === $this->getAmbiguityIdentity()) { + $validIdentities = array (); + $zendAuthCredentialMatchColumn = $this->_zendDb->foldCase('zend_auth_credential_match'); + foreach ($resultIdentities as $identity) { + if (1 === (int) $identity[$zendAuthCredentialMatchColumn]) { + $validIdentities[] = $identity; + } + } + $resultIdentities = $validIdentities; + } + $authResult = $this->_authenticateValidateResult(array_shift($resultIdentities)); return $authResult; } @@ -460,7 +508,7 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface $this->_authenticateResultInfo['code'] = Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND; $this->_authenticateResultInfo['messages'][] = 'A record with the supplied identity could not be found.'; return $this->_authenticateCreateAuthResult(); - } elseif (count($resultIdentities) > 1) { + } elseif (count($resultIdentities) > 1 && false === $this->getAmbiguityIdentity()) { $this->_authenticateResultInfo['code'] = Zend_Auth_Result::FAILURE_IDENTITY_AMBIGUOUS; $this->_authenticateResultInfo['messages'][] = 'More than one record matches the supplied identity.'; return $this->_authenticateCreateAuthResult(); diff --git a/libs/Zend/Cache/Backend/Static.php b/libs/Zend/Cache/Backend/Static.php index 19d83d5fd4..6872902a18 100644 --- a/libs/Zend/Cache/Backend/Static.php +++ b/libs/Zend/Cache/Backend/Static.php @@ -36,8 +36,8 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zend_Cache_Backend_Static - extends Zend_Cache_Backend +class Zend_Cache_Backend_Static + extends Zend_Cache_Backend implements Zend_Cache_Backend_Interface { const INNER_CACHE_NAME = 'zend_cache_backend_static_tagcache'; @@ -153,7 +153,7 @@ class Zend_Cache_Backend_Static * Test if a cache is available or not (for the given id) * * @param string $id cache id - * @return bool + * @return bool */ public function test($id) { @@ -172,7 +172,7 @@ class Zend_Cache_Backend_Static return false; } $pathName = $this->_options['public_dir'] . dirname($id); - + // Switch extension if needed if (isset($this->_tagged[$id])) { $extension = $this->_tagged[$id]['extension']; @@ -255,12 +255,19 @@ class Zend_Cache_Backend_Static $this->getInnerCache()->save($this->_tagged, self::INNER_CACHE_NAME); return (bool) $result; } - + /** * Recursively create the directories needed to write the static file */ protected function _createDirectoriesFor($path) { + if ( !is_dir($path) + && !@mkdir($path, $this->_options['cache_directory_umask'], true)) { + $lastErr = error_get_last(); + Zend_Cache::throwException("Can't create directory: {$lastErr['message']}"); + } + + /* $parts = explode('/', $path); $directory = ''; foreach ($parts as $part) { @@ -269,8 +276,9 @@ class Zend_Cache_Backend_Static mkdir($directory, $this->_octdec($this->_options['cache_directory_umask'])); } } + */ } - + /** * Detect serialization of data (cannot predict since this is the only way * to obey the interface yet pass in another parameter). @@ -481,8 +489,8 @@ class Zend_Cache_Backend_Static /** * Verify path exists and is non-empty - * - * @param string $path + * + * @param string $path * @return bool */ protected function _verifyPath($path) @@ -494,7 +502,7 @@ class Zend_Cache_Backend_Static /** * Determine the page to save from the request - * + * * @return string */ protected function _detectId() @@ -525,14 +533,14 @@ class Zend_Cache_Backend_Static // Validation assumes no query string, fragments or scheme included - only the path if (!preg_match( - '/^(?:\/(?:(?:%[[:xdigit:]]{2}|[A-Za-z0-9-_.!~*\'()\[\]:@&=+$,;])*)?)+$/', + '/^(?:\/(?:(?:%[[:xdigit:]]{2}|[A-Za-z0-9-_.!~*\'()\[\]:@&=+$,;])*)?)+$/', $string ) ) { Zend_Cache::throwException("Invalid id or tag '$string' : must be a valid URL path"); } } - + /** * Detect an octal string and return its octal value for file permission ops * otherwise return the non-string (assumed octal or decimal int already) @@ -547,7 +555,7 @@ class Zend_Cache_Backend_Static } return $val; } - + /** * Decode a request URI from the provided ID */ diff --git a/libs/Zend/Cache/Backend/Test.php b/libs/Zend/Cache/Backend/Test.php index f143ab4609..2061ab84bb 100644 --- a/libs/Zend/Cache/Backend/Test.php +++ b/libs/Zend/Cache/Backend/Test.php @@ -17,7 +17,7 @@ * @subpackage Zend_Cache_Backend * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Test.php 21292 2010-03-02 10:25:22Z mabe $ + * @version $Id: Test.php 22504 2010-06-30 17:05:07Z mabe $ */ @@ -103,10 +103,13 @@ class Zend_Cache_Backend_Test extends Zend_Cache_Backend implements Zend_Cache_B public function load($id, $doNotTestCacheValidity = false) { $this->_addLog('get', array($id, $doNotTestCacheValidity)); + if ( $id == 'false' || $id == 'd8523b3ee441006261eeffa5c3d3a0a7' || $id == 'e83249ea22178277d5befc2c5e2e9ace' - || $id == '40f649b94977c0a6e76902e2a0b43587') + || $id == '40f649b94977c0a6e76902e2a0b43587' + || $id == '88161989b73a4cbfd0b701c446115a99' + || $id == '205fc79cba24f0f0018eb92c7c8b3ba4') { return false; } @@ -116,10 +119,9 @@ class Zend_Cache_Backend_Test extends Zend_Cache_Backend implements Zend_Cache_B if ($id=='serialized2') { return serialize(array('headers' => array(), 'data' => 'foo')); } - if (($id=='71769f39054f75894288e397df04e445') or ($id=='615d222619fb20b527168340cebd0578')) { - return serialize(array('foo', 'bar')); - } - if (($id=='8a02d218a5165c467e7a5747cc6bd4b6') or ($id=='648aca1366211d17cbf48e65dc570bee')) { + if ( $id == '71769f39054f75894288e397df04e445' || $id == '615d222619fb20b527168340cebd0578' + || $id == '8a02d218a5165c467e7a5747cc6bd4b6' || $id == '648aca1366211d17cbf48e65dc570bee' + || $id == '4a923ef02d7f997ca14d56dfeae25ea7') { return serialize(array('foo', 'bar')); } return 'foo'; diff --git a/libs/Zend/Cache/Backend/TwoLevels.php b/libs/Zend/Cache/Backend/TwoLevels.php index a537b739ca..92330cb268 100644 --- a/libs/Zend/Cache/Backend/TwoLevels.php +++ b/libs/Zend/Cache/Backend/TwoLevels.php @@ -17,7 +17,7 @@ * @subpackage Zend_Cache_Backend * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: TwoLevels.php 21954 2010-04-19 19:19:24Z mabe $ + * @version $Id: TwoLevels.php 22506 2010-06-30 17:23:21Z mabe $ */ @@ -93,14 +93,14 @@ class Zend_Cache_Backend_TwoLevels extends Zend_Cache_Backend implements Zend_Ca /** * Slow Backend * - * @var Zend_Cache_Backend + * @var Zend_Cache_Backend_ExtendedInterface */ protected $_slowBackend; /** * Fast Backend * - * @var Zend_Cache_Backend + * @var Zend_Cache_Backend_ExtendedInterface */ protected $_fastBackend; diff --git a/libs/Zend/Cache/Core.php b/libs/Zend/Cache/Core.php index 680d4d8028..6906907d66 100644 --- a/libs/Zend/Cache/Core.php +++ b/libs/Zend/Cache/Core.php @@ -16,7 +16,7 @@ * @package Zend_Cache * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Core.php 21293 2010-03-02 10:26:32Z mabe $ + * @version $Id: Core.php 22652 2010-07-21 04:30:24Z ramon $ */ @@ -36,7 +36,7 @@ class Zend_Cache_Core /** * Backend Object * - * @var object $_backend + * @var Zend_Cache_Backend_Interface $_backend */ protected $_backend = null; @@ -167,7 +167,7 @@ class Zend_Cache_Core /** * Set the backend * - * @param object $backendObject + * @param Zend_Cache_Backend $backendObject * @throws Zend_Cache_Exception * @return void */ @@ -191,7 +191,7 @@ class Zend_Cache_Core /** * Returns the backend * - * @return object backend object + * @return Zend_Cache_Backend backend object */ public function getBackend() { @@ -475,7 +475,7 @@ class Zend_Cache_Core Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF); } if (!($this->_backendCapabilities['tags'])) { - Zend_Cache::throwException(self::BACKEND_NOT_SUPPORT_TAG); + Zend_Cache::throwException(self::BACKEND_NOT_SUPPORTS_TAG); } $ids = $this->_backend->getIdsMatchingTags($tags); @@ -508,7 +508,7 @@ class Zend_Cache_Core Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF); } if (!($this->_backendCapabilities['tags'])) { - Zend_Cache::throwException(self::BACKEND_NOT_SUPPORT_TAG); + Zend_Cache::throwException(self::BACKEND_NOT_SUPPORTS_TAG); } $ids = $this->_backend->getIdsNotMatchingTags($tags); @@ -541,7 +541,7 @@ class Zend_Cache_Core Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF); } if (!($this->_backendCapabilities['tags'])) { - Zend_Cache::throwException(self::BACKEND_NOT_SUPPORT_TAG); + Zend_Cache::throwException(self::BACKEND_NOT_SUPPORTS_TAG); } $ids = $this->_backend->getIdsMatchingAnyTags($tags); @@ -598,7 +598,7 @@ class Zend_Cache_Core Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF); } if (!($this->_backendCapabilities['tags'])) { - Zend_Cache::throwException(self::BACKEND_NOT_SUPPORT_TAG); + Zend_Cache::throwException(self::BACKEND_NOT_SUPPORTS_TAG); } return $this->_backend->getTags(); } @@ -714,6 +714,7 @@ class Zend_Cache_Core // Create a default logger to the standard output stream // require_once 'Zend/Log/Writer/Stream.php'; + // require_once 'Zend/Log.php'; $logger = new Zend_Log(new Zend_Log_Writer_Stream('php://output')); $this->_options['logger'] = $logger; } diff --git a/libs/Zend/Cache/Frontend/Class.php b/libs/Zend/Cache/Frontend/Class.php index 3dbdcf666b..cfeffc4e23 100644 --- a/libs/Zend/Cache/Frontend/Class.php +++ b/libs/Zend/Cache/Frontend/Class.php @@ -17,7 +17,7 @@ * @subpackage Zend_Cache_Frontend * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Class.php 20379 2010-01-18 14:40:57Z mabe $ + * @version $Id: Class.php 22654 2010-07-22 18:44:13Z mabe $ */ /** @@ -230,15 +230,25 @@ class Zend_Cache_Frontend_Class extends Zend_Cache_Core } /** + * ZF-9970 + * + * @deprecated + */ + private function _makeId($name, $args) + { + return $this->makeId($name, $args); + } + + /** * Make a cache id from the method name and parameters * - * @param string $name Method name - * @param array $parameters Method parameters + * @param string $name Method name + * @param array $args Method parameters * @return string Cache id */ - private function _makeId($name, $parameters) + public function makeId($name, array $args = array()) { - return md5($this->_cachedEntityLabel . '__' . $name . '__' . serialize($parameters)); + return md5($this->_cachedEntityLabel . '__' . $name . '__' . serialize($args)); } } diff --git a/libs/Zend/Cache/Frontend/Function.php b/libs/Zend/Cache/Frontend/Function.php index 7d7f827fee..a5a884c2ce 100644 --- a/libs/Zend/Cache/Frontend/Function.php +++ b/libs/Zend/Cache/Frontend/Function.php @@ -17,7 +17,7 @@ * @subpackage Zend_Cache_Frontend * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Function.php 20379 2010-01-18 14:40:57Z mabe $ + * @version $Id: Function.php 22654 2010-07-22 18:44:13Z mabe $ */ @@ -72,25 +72,29 @@ class Zend_Cache_Frontend_Function extends Zend_Cache_Core /** * Main method : call the specified function or get the result from cache * - * @param string $name Function name - * @param array $parameters Function parameters - * @param array $tags Cache tags - * @param int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime) - * @param int $priority integer between 0 (very low priority) and 10 (maximum priority) used by some particular backends + * @param callback $callback A valid callback + * @param array $parameters Function parameters + * @param array $tags Cache tags + * @param int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime) + * @param int $priority integer between 0 (very low priority) and 10 (maximum priority) used by some particular backends * @return mixed Result */ - public function call($name, $parameters = array(), $tags = array(), $specificLifetime = false, $priority = 8) + public function call($callback, array $parameters = array(), $tags = array(), $specificLifetime = false, $priority = 8) { + if (!is_callable($callback, true, $name)) { + Zend_Cache::throwException('Invalid callback'); + } + $cacheBool1 = $this->_specificOptions['cache_by_default']; $cacheBool2 = in_array($name, $this->_specificOptions['cached_functions']); $cacheBool3 = in_array($name, $this->_specificOptions['non_cached_functions']); $cache = (($cacheBool1 || $cacheBool2) && (!$cacheBool3)); if (!$cache) { - // We do not have not cache - return call_user_func_array($name, $parameters); + // Caching of this callback is disabled + return call_user_func_array($callback, $parameters); } - $id = $this->_makeId($name, $parameters); + $id = $this->_makeId($callback, $parameters); if ( ($rs = $this->load($id)) && isset($rs[0], $rs[1])) { // A cache is available $output = $rs[0]; @@ -99,7 +103,7 @@ class Zend_Cache_Frontend_Function extends Zend_Cache_Core // A cache is not available (or not valid for this frontend) ob_start(); ob_implicit_flush(false); - $return = call_user_func_array($name, $parameters); + $return = call_user_func_array($callback, $parameters); $output = ob_get_contents(); ob_end_clean(); $data = array($output, $return); @@ -111,22 +115,66 @@ class Zend_Cache_Frontend_Function extends Zend_Cache_Core } /** + * ZF-9970 + * + * @deprecated + */ + private function _makeId($callback, array $args) + { + return $this->makeId($callback, $args); + } + + /** * Make a cache id from the function name and parameters * - * @param string $name Function name - * @param array $parameters Function parameters + * @param callback $callback A valid callback + * @param array $args Function parameters * @throws Zend_Cache_Exception * @return string Cache id */ - private function _makeId($name, $parameters) + public function makeId($callback, array $args = array()) { - if (!is_string($name)) { - Zend_Cache::throwException('Incorrect function name'); + if (!is_callable($callback, true, $name)) { + Zend_Cache::throwException('Invalid callback'); + } + + // functions, methods and classnames are case-insensitive + $name = strtolower($name); + + // generate a unique id for object callbacks + if (is_object($callback)) { // Closures & __invoke + $object = $callback; + } elseif (isset($callback[0])) { // array($object, 'method') + $object = $callback[0]; } - if (!is_array($parameters)) { - Zend_Cache::throwException('parameters argument must be an array'); + if (isset($object)) { + try { + $tmp = @serialize($callback); + } catch (Exception $e) { + Zend_Cache::throwException($e->getMessage()); + } + if (!$tmp) { + $lastErr = error_get_last(); + Zend_Cache::throwException("Can't serialize callback object to generate id: {$lastErr['message']}"); + } + $name.= '__' . $tmp; } - return md5($name . serialize($parameters)); + + // generate a unique id for arguments + $argsStr = ''; + if ($args) { + try { + $argsStr = @serialize(array_values($args)); + } catch (Exception $e) { + Zend_Cache::throwException($e->getMessage()); + } + if (!$argsStr) { + $lastErr = error_get_last(); + throw Zend_Cache::throwException("Can't serialize arguments to generate id: {$lastErr['message']}"); + } + } + + return md5($name . $argsStr); } } diff --git a/libs/Zend/Cache/Manager.php b/libs/Zend/Cache/Manager.php index d7f157038c..504cced8b8 100644 --- a/libs/Zend/Cache/Manager.php +++ b/libs/Zend/Cache/Manager.php @@ -57,17 +57,6 @@ class Zend_Cache_Manager * @var array */ protected $_optionTemplates = array( - // Null Cache (Enforce Null/Empty Values) - 'skeleton' => array( - 'frontend' => array( - 'name' => null, - 'options' => array(), - ), - 'backend' => array( - 'name' => null, - 'options' => array(), - ), - ), // Simple Common Default 'default' => array( 'frontend' => array( @@ -79,10 +68,12 @@ class Zend_Cache_Manager 'backend' => array( 'name' => 'File', 'options' => array( - 'cache_dir' => '../cache', + // use system temp dir by default of file backend + // 'cache_dir' => '../cache', ), ), ), + // Static Page HTML Cache 'page' => array( 'frontend' => array( @@ -98,6 +89,7 @@ class Zend_Cache_Manager ), ), ), + // Tag Cache 'pagetag' => array( 'frontend' => array( @@ -110,8 +102,10 @@ class Zend_Cache_Manager 'backend' => array( 'name' => 'File', 'options' => array( - 'cache_dir' => '../cache', - 'cache_file_umask' => 0644 + // use system temp dir by default of file backend + // 'cache_dir' => '../cache', + // use default umask of file backend + // 'cache_file_umask' => 0644 ), ), ), @@ -167,6 +161,7 @@ class Zend_Cache_Manager $this->_optionTemplates[$name]['backend']['options']['tag_cache'] = $this->getCache(self::PAGETAGCACHE); } + $this->_caches[$name] = Zend_Cache::factory( $this->_optionTemplates[$name]['frontend']['name'], $this->_optionTemplates[$name]['backend']['name'], @@ -176,11 +171,28 @@ class Zend_Cache_Manager isset($this->_optionTemplates[$name]['backend']['customBackendNaming']) ? $this->_optionTemplates[$name]['backend']['customBackendNaming'] : false, isset($this->_optionTemplates[$name]['frontendBackendAutoload']) ? $this->_optionTemplates[$name]['frontendBackendAutoload'] : false ); + return $this->_caches[$name]; } } /** + * Fetch all available caches + * + * @return array An array of all available caches with it's names as key + */ + public function getCaches() + { + $caches = $this->_caches; + foreach ($this->_optionTemplates as $name => $tmp) { + if (!isset($caches[$name])) { + $caches[$name] = $this->getCache($name); + } + } + return $caches; + } + + /** * Set a named configuration template from which a cache object can later * be lazy loaded * diff --git a/libs/Zend/Db.php b/libs/Zend/Db.php index 9bbf1e793f..d235a5461d 100644 --- a/libs/Zend/Db.php +++ b/libs/Zend/Db.php @@ -253,10 +253,10 @@ class Zend_Db * Load the adapter class. This throws an exception * if the specified class cannot be loaded. */ - // if (!class_exists($adapterName)) { + if (!class_exists($adapterName)) { // require_once 'Zend/Loader.php'; - // Zend_Loader::loadClass($adapterName); - // } + Zend_Loader::loadClass($adapterName); + } /* * Create an instance of the adapter class. diff --git a/libs/Zend/Db/Adapter/Abstract.php b/libs/Zend/Db/Adapter/Abstract.php index 09ab9e692d..55b77a60e1 100644 --- a/libs/Zend/Db/Adapter/Abstract.php +++ b/libs/Zend/Db/Adapter/Abstract.php @@ -379,10 +379,10 @@ abstract class Zend_Db_Adapter_Abstract } if ($profilerInstance === null) { - // if (!class_exists($profilerClass)) { + if (!class_exists($profilerClass)) { // require_once 'Zend/Loader.php'; - // Zend_Loader::loadClass($profilerClass); - // } + Zend_Loader::loadClass($profilerClass); + } $profilerInstance = new $profilerClass(); } diff --git a/libs/Zend/Db/Adapter/Db2.php b/libs/Zend/Db/Adapter/Db2.php index bde2100793..3fa4b4c618 100644 --- a/libs/Zend/Db/Adapter/Db2.php +++ b/libs/Zend/Db/Adapter/Db2.php @@ -223,10 +223,10 @@ class Zend_Db_Adapter_Db2 extends Zend_Db_Adapter_Abstract { $this->_connect(); $stmtClass = $this->_defaultStmtClass; - // if (!class_exists($stmtClass)) { + if (!class_exists($stmtClass)) { // require_once 'Zend/Loader.php'; - // Zend_Loader::loadClass($stmtClass); - // } + Zend_Loader::loadClass($stmtClass); + } $stmt = new $stmtClass($this, $sql); $stmt->setFetchMode($this->_fetchMode); return $stmt; diff --git a/libs/Zend/Db/Adapter/Mysqli.php b/libs/Zend/Db/Adapter/Mysqli.php index eb9437d059..6733a09a6d 100644 --- a/libs/Zend/Db/Adapter/Mysqli.php +++ b/libs/Zend/Db/Adapter/Mysqli.php @@ -374,10 +374,10 @@ class Zend_Db_Adapter_Mysqli extends Zend_Db_Adapter_Abstract $this->_stmt->close(); } $stmtClass = $this->_defaultStmtClass; - // if (!class_exists($stmtClass)) { + if (!class_exists($stmtClass)) { // require_once 'Zend/Loader.php'; - // Zend_Loader::loadClass($stmtClass); - // } + Zend_Loader::loadClass($stmtClass); + } $stmt = new $stmtClass($this, $sql); if ($stmt === false) { return false; diff --git a/libs/Zend/Db/Adapter/Oracle.php b/libs/Zend/Db/Adapter/Oracle.php index 17fb8488f4..b803878a64 100644 --- a/libs/Zend/Db/Adapter/Oracle.php +++ b/libs/Zend/Db/Adapter/Oracle.php @@ -204,10 +204,10 @@ class Zend_Db_Adapter_Oracle extends Zend_Db_Adapter_Abstract { $this->_connect(); $stmtClass = $this->_defaultStmtClass; - // if (!class_exists($stmtClass)) { + if (!class_exists($stmtClass)) { // require_once 'Zend/Loader.php'; - // Zend_Loader::loadClass($stmtClass); - // } + Zend_Loader::loadClass($stmtClass); + } $stmt = new $stmtClass($this, $sql); if ($stmt instanceof Zend_Db_Statement_Oracle) { $stmt->setLobAsString($this->getLobAsString()); diff --git a/libs/Zend/Db/Adapter/Pdo/Abstract.php b/libs/Zend/Db/Adapter/Pdo/Abstract.php index 0ffc1f428f..0ae4813ce5 100644 --- a/libs/Zend/Db/Adapter/Pdo/Abstract.php +++ b/libs/Zend/Db/Adapter/Pdo/Abstract.php @@ -177,10 +177,10 @@ abstract class Zend_Db_Adapter_Pdo_Abstract extends Zend_Db_Adapter_Abstract { $this->_connect(); $stmtClass = $this->_defaultStmtClass; - // if (!class_exists($stmtClass)) { + if (!class_exists($stmtClass)) { // require_once 'Zend/Loader.php'; - // Zend_Loader::loadClass($stmtClass); - // } + Zend_Loader::loadClass($stmtClass); + } $stmt = new $stmtClass($this, $sql); $stmt->setFetchMode($this->_fetchMode); return $stmt; diff --git a/libs/Zend/Db/Adapter/Pdo/Pgsql.php b/libs/Zend/Db/Adapter/Pdo/Pgsql.php index bec14b569b..3b48d5921a 100644 --- a/libs/Zend/Db/Adapter/Pdo/Pgsql.php +++ b/libs/Zend/Db/Adapter/Pdo/Pgsql.php @@ -17,7 +17,7 @@ * @subpackage Adapter * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Pgsql.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Pgsql.php 22566 2010-07-16 02:07:36Z ramon $ */ @@ -281,7 +281,10 @@ class Zend_Db_Adapter_Pdo_Pgsql extends Zend_Db_Adapter_Pdo_Abstract public function lastSequenceId($sequenceName) { $this->_connect(); - $value = $this->fetchOne("SELECT CURRVAL(".$this->quote($sequenceName).")"); + $sequenceName = trim((string) $sequenceName, $this->getQuoteIdentifierSymbol()); + $value = $this->fetchOne("SELECT CURRVAL(" + . $this->quote($this->quoteIdentifier($sequenceName, true)) + . ")"); return $value; } @@ -296,7 +299,10 @@ class Zend_Db_Adapter_Pdo_Pgsql extends Zend_Db_Adapter_Pdo_Abstract public function nextSequenceId($sequenceName) { $this->_connect(); - $value = $this->fetchOne("SELECT NEXTVAL(".$this->quote($sequenceName).")"); + $sequenceName = trim((string) $sequenceName, $this->getQuoteIdentifierSymbol()); + $value = $this->fetchOne("SELECT NEXTVAL(" + . $this->quote($this->quoteIdentifier($sequenceName, true)) + . ")"); return $value; } diff --git a/libs/Zend/Db/Adapter/Sqlsrv.php b/libs/Zend/Db/Adapter/Sqlsrv.php index 533523759e..7e56025eab 100644 --- a/libs/Zend/Db/Adapter/Sqlsrv.php +++ b/libs/Zend/Db/Adapter/Sqlsrv.php @@ -287,13 +287,13 @@ class Zend_Db_Adapter_Sqlsrv extends Zend_Db_Adapter_Abstract $this->_connect(); $stmtClass = $this->_defaultStmtClass; - // if (!class_exists($stmtClass)) { + if (!class_exists($stmtClass)) { /** * @see Zend_Loader */ // require_once 'Zend/Loader.php'; - // Zend_Loader::loadClass($stmtClass); - // } + Zend_Loader::loadClass($stmtClass); + } $stmt = new $stmtClass($this, $sql); $stmt->setFetchMode($this->_fetchMode); diff --git a/libs/Zend/Db/Table/Abstract.php b/libs/Zend/Db/Table/Abstract.php index e07ed22517..b1ab26f1f4 100644 --- a/libs/Zend/Db/Table/Abstract.php +++ b/libs/Zend/Db/Table/Abstract.php @@ -1276,10 +1276,10 @@ abstract class Zend_Db_Table_Abstract // issue ZF-5775 (empty where clause should return empty rowset) if ($whereClause == null) { $rowsetClass = $this->getRowsetClass(); - // if (!class_exists($rowsetClass)) { + if (!class_exists($rowsetClass)) { // require_once 'Zend/Loader.php'; - // Zend_Loader::loadClass($rowsetClass); - // } + Zend_Loader::loadClass($rowsetClass); + } return new $rowsetClass(array('table' => $this, 'rowClass' => $this->getRowClass(), 'stored' => true)); } @@ -1329,10 +1329,10 @@ abstract class Zend_Db_Table_Abstract ); $rowsetClass = $this->getRowsetClass(); - // if (!class_exists($rowsetClass)) { + if (!class_exists($rowsetClass)) { // require_once 'Zend/Loader.php'; - // Zend_Loader::loadClass($rowsetClass); - // } + Zend_Loader::loadClass($rowsetClass); + } return new $rowsetClass($data); } @@ -1378,10 +1378,10 @@ abstract class Zend_Db_Table_Abstract ); $rowClass = $this->getRowClass(); - // if (!class_exists($rowClass)) { + if (!class_exists($rowClass)) { // require_once 'Zend/Loader.php'; - // Zend_Loader::loadClass($rowClass); - // } + Zend_Loader::loadClass($rowClass); + } return new $rowClass($data); } @@ -1441,10 +1441,10 @@ abstract class Zend_Db_Table_Abstract ); $rowClass = $this->getRowClass(); - // if (!class_exists($rowClass)) { + if (!class_exists($rowClass)) { // require_once 'Zend/Loader.php'; - // Zend_Loader::loadClass($rowClass); - // } + Zend_Loader::loadClass($rowClass); + } $row = new $rowClass($config); $row->setFromArray($data); return $row; diff --git a/libs/Zend/Db/Table/Row/Abstract.php b/libs/Zend/Db/Table/Row/Abstract.php index c7243eb003..bc7e5b5274 100644 --- a/libs/Zend/Db/Table/Row/Abstract.php +++ b/libs/Zend/Db/Table/Row/Abstract.php @@ -1083,15 +1083,15 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess, IteratorAggreg ); $rowsetClass = $matchTable->getRowsetClass(); - // if (!class_exists($rowsetClass)) { - // try { + if (!class_exists($rowsetClass)) { + try { // require_once 'Zend/Loader.php'; - // Zend_Loader::loadClass($rowsetClass); - // } catch (Zend_Exception $e) { + Zend_Loader::loadClass($rowsetClass); + } catch (Zend_Exception $e) { // require_once 'Zend/Db/Table/Row/Exception.php'; - // throw new Zend_Db_Table_Row_Exception($e->getMessage(), $e->getCode(), $e); - // } - // } + throw new Zend_Db_Table_Row_Exception($e->getMessage(), $e->getCode(), $e); + } + } $rowset = new $rowsetClass($config); return $rowset; } @@ -1177,15 +1177,15 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess, IteratorAggreg } // assume the tableName is the class name - // if (!class_exists($tableName)) { - // try { + if (!class_exists($tableName)) { + try { // require_once 'Zend/Loader.php'; - // Zend_Loader::loadClass($tableName); - // } catch (Zend_Exception $e) { + Zend_Loader::loadClass($tableName); + } catch (Zend_Exception $e) { // require_once 'Zend/Db/Table/Row/Exception.php'; - // throw new Zend_Db_Table_Row_Exception($e->getMessage(), $e->getCode(), $e); - // } - // } + throw new Zend_Db_Table_Row_Exception($e->getMessage(), $e->getCode(), $e); + } + } $options = array(); diff --git a/libs/Zend/Db/Table/Rowset/Abstract.php b/libs/Zend/Db/Table/Rowset/Abstract.php index 8cafadc91e..ec24b7c620 100644 --- a/libs/Zend/Db/Table/Rowset/Abstract.php +++ b/libs/Zend/Db/Table/Rowset/Abstract.php @@ -17,7 +17,7 @@ * @subpackage Table * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Abstract.php 22616 2010-07-17 15:53:16Z ramon $ */ /** @@ -111,10 +111,10 @@ abstract class Zend_Db_Table_Rowset_Abstract implements SeekableIterator, Counta if (isset($config['rowClass'])) { $this->_rowClass = $config['rowClass']; } - // if (!class_exists($this->_rowClass)) { + if (!class_exists($this->_rowClass)) { // require_once 'Zend/Loader.php'; - // Zend_Loader::loadClass($this->_rowClass); - // } + Zend_Loader::loadClass($this->_rowClass); + } if (isset($config['data'])) { $this->_data = $config['data']; } @@ -294,7 +294,7 @@ abstract class Zend_Db_Table_Rowset_Abstract implements SeekableIterator, Counta */ public function valid() { - return $this->_pointer < $this->_count; + return $this->_pointer >= 0 && $this->_pointer < $this->_count; } /** @@ -349,7 +349,12 @@ abstract class Zend_Db_Table_Rowset_Abstract implements SeekableIterator, Counta */ public function offsetGet($offset) { - $this->_pointer = (int) $offset; + $offset = (int) $offset; + if ($offset < 0 || $offset >= $this->_count) { + // require_once 'Zend/Db/Table/Rowset/Exception.php'; + throw new Zend_Db_Table_Rowset_Exception("Illegal index $offset"); + } + $this->_pointer = $offset; return $this->current(); } diff --git a/libs/Zend/Feed.php b/libs/Zend/Feed.php index 5e4d7b0894..efc7c7a309 100644 --- a/libs/Zend/Feed.php +++ b/libs/Zend/Feed.php @@ -380,10 +380,10 @@ class Zend_Feed public static function importArray(array $data, $format = 'atom') { $obj = 'Zend_Feed_' . ucfirst(strtolower($format)); - // if (!class_exists($obj)) { + if (!class_exists($obj)) { // require_once 'Zend/Loader.php'; - // Zend_Loader::loadClass($obj); - // } + Zend_Loader::loadClass($obj); + } /** * @see Zend_Feed_Builder @@ -402,10 +402,10 @@ class Zend_Feed public static function importBuilder(Zend_Feed_Builder_Interface $builder, $format = 'atom') { $obj = 'Zend_Feed_' . ucfirst(strtolower($format)); - // if (!class_exists($obj)) { + if (!class_exists($obj)) { // require_once 'Zend/Loader.php'; - // Zend_Loader::loadClass($obj); - // } + Zend_Loader::loadClass($obj); + } return new $obj(null, null, $builder); } } diff --git a/libs/Zend/Feed/Pubsubhubbub/Model/Subscription.php b/libs/Zend/Feed/Pubsubhubbub/Model/Subscription.php index ea971b4f77..5858b19d1a 100644 --- a/libs/Zend/Feed/Pubsubhubbub/Model/Subscription.php +++ b/libs/Zend/Feed/Pubsubhubbub/Model/Subscription.php @@ -25,6 +25,9 @@ /** @see Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface */ // require_once 'Zend/Feed/Pubsubhubbub/Model/SubscriptionInterface.php'; +/** @see Zend_Date */ +// require_once 'Zend/Date.php'; + /** * @category Zend * @package Zend_Feed_Pubsubhubbub @@ -36,7 +39,7 @@ class Zend_Feed_Pubsubhubbub_Model_Subscription extends Zend_Feed_Pubsubhubbub_Model_ModelAbstract implements Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface { - + /** * Save subscription to RDMBS * @@ -52,10 +55,10 @@ class Zend_Feed_Pubsubhubbub_Model_Subscription ); } $result = $this->_db->find($data['id']); - if ($result) { + if (count($result)) { $data['created_time'] = $result->current()->created_time; $now = new Zend_Date; - if ($data['lease_seconds']) { + if (isset($data['lease_seconds'])) { $data['expiration_time'] = $now->add($data['lease_seconds'], Zend_Date::SECOND) ->get('yyyy-MM-dd HH:mm:ss'); } @@ -69,11 +72,11 @@ class Zend_Feed_Pubsubhubbub_Model_Subscription $this->_db->insert($data); return true; } - + /** * Get subscription by ID/key - * - * @param string $key + * + * @param string $key * @return array */ public function getSubscription($key) @@ -84,16 +87,16 @@ class Zend_Feed_Pubsubhubbub_Model_Subscription .' of "' . $key . '" must be a non-empty string'); } $result = $this->_db->find($key); - if ($result) { - return (array) $result->current(); + if (count($result)) { + return $result->current()->toArray(); } return false; } /** * Determine if a subscription matching the key exists - * - * @param string $key + * + * @param string $key * @return bool */ public function hasSubscription($key) @@ -104,12 +107,12 @@ class Zend_Feed_Pubsubhubbub_Model_Subscription .' of "' . $key . '" must be a non-empty string'); } $result = $this->_db->find($key); - if ($result) { + if (count($result)) { return true; } return false; } - + /** * Delete a subscription * @@ -119,7 +122,7 @@ class Zend_Feed_Pubsubhubbub_Model_Subscription public function deleteSubscription($key) { $result = $this->_db->find($key); - if ($result) { + if (count($result)) { $this->_db->delete( $this->_db->getAdapter()->quoteInto('id = ?', $key) ); @@ -127,5 +130,5 @@ class Zend_Feed_Pubsubhubbub_Model_Subscription } return false; } - + } diff --git a/libs/Zend/Http/Client.php b/libs/Zend/Http/Client.php index 1cd17e8da4..d59c67ff7a 100644 --- a/libs/Zend/Http/Client.php +++ b/libs/Zend/Http/Client.php @@ -16,7 +16,7 @@ * @category Zend * @package Zend_Http * @subpackage Client - * @version $Id: Client.php 21952 2010-04-19 18:44:26Z shahar $ + * @version $Id: Client.php 22539 2010-07-08 12:47:44Z shahar $ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -585,9 +585,7 @@ class Zend_Http_Client */ public function setCookieJar($cookiejar = true) { - if (! class_exists('Zend_Http_CookieJar')) { - // require_once 'Zend/Http/CookieJar.php'; - } + // Zend_Loader::loadClass('Zend_Http_CookieJar'); if ($cookiejar instanceof Zend_Http_CookieJar) { $this->cookiejar = $cookiejar; @@ -625,9 +623,7 @@ class Zend_Http_Client */ public function setCookie($cookie, $value = null) { - if (! class_exists('Zend_Http_Cookie')) { - // require_once 'Zend/Http/Cookie.php'; - } + // Zend_Loader::loadClass('Zend_Http_Cookie'); if (is_array($cookie)) { foreach ($cookie as $c => $v) { @@ -839,16 +835,13 @@ class Zend_Http_Client public function setAdapter($adapter) { if (is_string($adapter)) { - if (!class_exists($adapter)) { - try { - // require_once 'Zend/Loader.php'; - Zend_Loader::loadClass($adapter); - } catch (Zend_Exception $e) { - /** @see Zend_Http_Client_Exception */ - // require_once 'Zend/Http/Client/Exception.php'; - throw new Zend_Http_Client_Exception("Unable to load adapter '$adapter': {$e->getMessage()}", 0, $e); - } - } + // try { + // Zend_Loader::loadClass($adapter); + // } catch (Zend_Exception $e) { + /** @see Zend_Http_Client_Exception */ + // require_once 'Zend/Http/Client/Exception.php'; + // throw new Zend_Http_Client_Exception("Unable to load adapter '$adapter': {$e->getMessage()}", 0, $e); + // } $adapter = new $adapter; } diff --git a/libs/Zend/Http/Client/Adapter/Socket.php b/libs/Zend/Http/Client/Adapter/Socket.php index 4f3d41722d..9d91ed7b85 100644 --- a/libs/Zend/Http/Client/Adapter/Socket.php +++ b/libs/Zend/Http/Client/Adapter/Socket.php @@ -16,7 +16,7 @@ * @category Zend * @package Zend_Http * @subpackage Client_Adapter - * @version $Id: Socket.php 21778 2010-04-06 11:19:35Z shahar $ + * @version $Id: Socket.php 22577 2010-07-16 15:51:51Z dragonbe $ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -405,6 +405,7 @@ class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interf } while ($chunksize > 0); } else { $this->close(); + // require_once 'Zend/Http/Client/Adapter/Exception.php'; throw new Zend_Http_Client_Adapter_Exception('Cannot handle "' . $headers['transfer-encoding'] . '" transfer encoding'); } diff --git a/libs/Zend/Http/Response.php b/libs/Zend/Http/Response.php index decb5f357e..e460018977 100644 --- a/libs/Zend/Http/Response.php +++ b/libs/Zend/Http/Response.php @@ -16,7 +16,7 @@ * @category Zend * @package Zend_Http * @subpackage Response - * @version $Id: Response.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Response.php 22555 2010-07-13 16:06:29Z shahar $ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -487,8 +487,8 @@ class Zend_Http_Response /** * Extract the headers from a response string * - * @param string $response_str - * @return array + * @param string $response_str + * @return array */ public static function extractHeaders($response_str) { @@ -507,7 +507,8 @@ class Zend_Http_Response $line = trim($line, "\r\n"); if ($line == "") break; - if (preg_match("|^([\w-]+):\s+(.+)|", $line, $m)) { + // Locate headers like 'Location: ...' and 'Location:...' (note the missing space) + if (preg_match("|^([\w-]+):\s*(.+)|", $line, $m)) { unset($last_header); $h_name = strtolower($m[1]); $h_value = $m[2]; diff --git a/libs/Zend/Loader/PluginLoader.php b/libs/Zend/Loader/PluginLoader.php index f3f6170c67..43e9fda963 100644 --- a/libs/Zend/Loader/PluginLoader.php +++ b/libs/Zend/Loader/PluginLoader.php @@ -17,7 +17,7 @@ * @subpackage PluginLoader * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: PluginLoader.php 21170 2010-02-23 19:50:16Z matthew $ + * @version $Id: PluginLoader.php 22604 2010-07-17 00:14:06Z ramon $ */ /** Zend_Loader_PluginLoader_Interface */ @@ -256,7 +256,7 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface if ($path != null) { $pos = array_search($path, $registry[$prefix]); - if ($pos === null) { + if (false === $pos) { // require_once 'Zend/Loader/PluginLoader/Exception.php'; throw new Zend_Loader_PluginLoader_Exception('Prefix ' . $prefix . ' / Path ' . $path . ' was not found in the PluginLoader.'); } diff --git a/libs/Zend/Log.php b/libs/Zend/Log.php index 471c0e3cf4..ab263d3b63 100644 --- a/libs/Zend/Log.php +++ b/libs/Zend/Log.php @@ -16,7 +16,7 @@ * @package Zend_Log * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Log.php 20893 2010-02-03 22:59:25Z yoshida@zend.co.jp $ + * @version $Id: Log.php 22632 2010-07-18 18:30:08Z ramon $ */ /** @@ -24,7 +24,7 @@ * @package Zend_Log * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Log.php 20893 2010-02-03 22:59:25Z yoshida@zend.co.jp $ + * @version $Id: Log.php 22632 2010-07-18 18:30:08Z ramon $ */ class Zend_Log { @@ -130,6 +130,9 @@ class Zend_Log $writer = $this->_constructFromConfig('writer', $config, $this->_defaultWriterNamespace); if (!$writer instanceof Zend_Log_Writer_Abstract) { + $writerName = is_object($writer) + ? get_class($writer) + : 'The specified writer'; /** @see Zend_Log_Exception */ // require_once 'Zend/Log/Exception.php'; throw new Zend_Log_Exception("{$writerName} does not extend Zend_Log_Writer_Abstract!"); @@ -154,6 +157,9 @@ class Zend_Log $filter = $this->_constructFromConfig('filter', $config, $this->_defaultFilterNamespace); if (!$filter instanceof Zend_Log_Filter_Interface) { + $filterName = is_object($filter) + ? get_class($filter) + : 'The specified filter'; /** @see Zend_Log_Exception */ // require_once 'Zend/Log/Exception.php'; throw new Zend_Log_Exception("{$filterName} does not implement Zend_Log_Filter_Interface"); @@ -185,10 +191,10 @@ class Zend_Log $params = isset($config[ $type .'Params' ]) ? $config[ $type .'Params' ] : array(); $className = $this->getClassName($config, $type, $namespace); - // if (!class_exists($className)) { + if (!class_exists($className)) { // require_once 'Zend/Loader.php'; - // Zend_Loader::loadClass($className); - // } + Zend_Loader::loadClass($className); + } $reflection = new ReflectionClass($className); if (!$reflection->implementsInterface('Zend_Log_FactoryInterface')) { @@ -351,7 +357,7 @@ class Zend_Log $name = strtoupper($name); if (isset($this->_priorities[$priority]) - || array_search($name, $this->_priorities)) { + || false !== array_search($name, $this->_priorities)) { /** @see Zend_Log_Exception */ // require_once 'Zend/Log/Exception.php'; throw new Zend_Log_Exception('Existing priorities cannot be overwritten'); @@ -419,7 +425,8 @@ class Zend_Log * @param $value Value of the field * @return void */ - public function setEventItem($name, $value) { + public function setEventItem($name, $value) + { $this->_extras = array_merge($this->_extras, array($name => $value)); } } diff --git a/libs/Zend/Log/Writer/Abstract.php b/libs/Zend/Log/Writer/Abstract.php index 80b939db18..b3e244ba0e 100644 --- a/libs/Zend/Log/Writer/Abstract.php +++ b/libs/Zend/Log/Writer/Abstract.php @@ -17,7 +17,7 @@ * @subpackage Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Abstract.php 22632 2010-07-18 18:30:08Z ramon $ */ /** Zend_Log_Filter_Priority */ @@ -29,7 +29,7 @@ * @subpackage Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Abstract.php 22632 2010-07-18 18:30:08Z ramon $ */ abstract class Zend_Log_Writer_Abstract implements Zend_Log_FactoryInterface { @@ -56,6 +56,12 @@ abstract class Zend_Log_Writer_Abstract implements Zend_Log_FactoryInterface $filter = new Zend_Log_Filter_Priority($filter); } + if (!$filter instanceof Zend_Log_Filter_Interface) { + /** @see Zend_Log_Exception */ + // require_once 'Zend/Log/Exception.php'; + throw new Zend_Log_Exception('Invalid filter provided'); + } + $this->_filters[] = $filter; } @@ -83,7 +89,7 @@ abstract class Zend_Log_Writer_Abstract implements Zend_Log_FactoryInterface * @param Zend_Log_Formatter_Interface $formatter * @return void */ - public function setFormatter($formatter) + public function setFormatter(Zend_Log_Formatter_Interface $formatter) { $this->_formatter = $formatter; } @@ -106,7 +112,7 @@ abstract class Zend_Log_Writer_Abstract implements Zend_Log_FactoryInterface /** * Validate and optionally convert the config to array - * + * * @param array|Zend_Config $config Zend_Config or Array * @return array * @throws Zend_Log_Exception diff --git a/libs/Zend/Log/Writer/Db.php b/libs/Zend/Log/Writer/Db.php index 6f77a12cb7..54634040b4 100644 --- a/libs/Zend/Log/Writer/Db.php +++ b/libs/Zend/Log/Writer/Db.php @@ -17,7 +17,7 @@ * @subpackage Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Db.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Db.php 22514 2010-07-01 14:11:18Z ramon $ */ /** Zend_Log_Writer_Abstract */ @@ -29,7 +29,7 @@ * @subpackage Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Db.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Db.php 22514 2010-07-01 14:11:18Z ramon $ */ class Zend_Log_Writer_Db extends Zend_Log_Writer_Abstract { @@ -68,7 +68,7 @@ class Zend_Log_Writer_Db extends Zend_Log_Writer_Abstract /** * Create a new instance of Zend_Log_Writer_Db - * + * * @param array|Zend_Config $config * @return Zend_Log_Writer_Db * @throws Zend_Log_Exception @@ -77,15 +77,15 @@ class Zend_Log_Writer_Db extends Zend_Log_Writer_Abstract { $config = self::_parseConfig($config); $config = array_merge(array( - 'db' => null, - 'table' => null, + 'db' => null, + 'table' => null, 'columnMap' => null, ), $config); - + if (isset($config['columnmap'])) { $config['columnMap'] = $config['columnmap']; } - + return new self( $config['db'], $config['table'], @@ -96,10 +96,10 @@ class Zend_Log_Writer_Db extends Zend_Log_Writer_Abstract /** * Formatting is not possible on this writer */ - public function setFormatter($formatter) + public function setFormatter(Zend_Log_Formatter_Interface $formatter) { // require_once 'Zend/Log/Exception.php'; - throw new Zend_Log_Exception(get_class() . ' does not support formatting'); + throw new Zend_Log_Exception(get_class($this) . ' does not support formatting'); } /** diff --git a/libs/Zend/Log/Writer/Syslog.php b/libs/Zend/Log/Writer/Syslog.php index d7827c9ce3..722744271b 100644 --- a/libs/Zend/Log/Writer/Syslog.php +++ b/libs/Zend/Log/Writer/Syslog.php @@ -17,7 +17,7 @@ * @subpackage Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Syslog.php 22477 2010-06-21 12:15:35Z matthew $ + * @version $Id: Syslog.php 22632 2010-07-18 18:30:08Z ramon $ */ /** Zend_Log_Writer_Abstract */ @@ -191,7 +191,7 @@ class Zend_Log_Writer_Syslog extends Zend_Log_Writer_Abstract throw new Zend_Log_Exception('Invalid log facility provided; please see http://php.net/openlog for a list of valid facility values'); } - if (strstr(strtolower(PHP_OS), 'windows') + if ('WIN' == strtoupper(substr(PHP_OS, 0, 3)) && ($facility !== LOG_USER) ) { // require_once 'Zend/Log/Exception.php'; diff --git a/libs/Zend/Log/Writer/ZendMonitor.php b/libs/Zend/Log/Writer/ZendMonitor.php index 59a648fa8b..a6c1843779 100644 --- a/libs/Zend/Log/Writer/ZendMonitor.php +++ b/libs/Zend/Log/Writer/ZendMonitor.php @@ -17,7 +17,7 @@ * @subpackage Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: ZendMonitor.php 22533 2010-07-07 02:38:14Z ramon $ */ /** Zend_Log_Writer_Abstract */ @@ -29,7 +29,7 @@ * @subpackage Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ + * @version $Id: ZendMonitor.php 22533 2010-07-07 02:38:14Z ramon $ */ class Zend_Log_Writer_ZendMonitor extends Zend_Log_Writer_Abstract { @@ -51,7 +51,7 @@ class Zend_Log_Writer_ZendMonitor extends Zend_Log_Writer_Abstract /** * Create a new instance of Zend_Log_Writer_ZendMonitor - * + * * @param array|Zend_Config $config * @return Zend_Log_Writer_Syslog * @throws Zend_Log_Exception @@ -64,10 +64,10 @@ class Zend_Log_Writer_ZendMonitor extends Zend_Log_Writer_Abstract /** * Is logging to this writer enabled? * - * If the Zend Monitor extension is not enabled, this log writer will - * fail silently. You can query this method to determine if the log + * If the Zend Monitor extension is not enabled, this log writer will + * fail silently. You can query this method to determine if the log * writer is enabled. - * + * * @return bool */ public function isEnabled() @@ -103,7 +103,7 @@ class Zend_Log_Writer_ZendMonitor extends Zend_Log_Writer_Abstract unset($event['priority'], $event['message']); if (!empty($event)) { - monitor_custom_event($priority, $message, $event); + monitor_custom_event($priority, $message, false, $event); } else { monitor_custom_event($priority, $message); } diff --git a/libs/Zend/Mail/Protocol/Smtp/Auth/Crammd5.php b/libs/Zend/Mail/Protocol/Smtp/Auth/Crammd5.php index 523d383e23..2356422129 100644 --- a/libs/Zend/Mail/Protocol/Smtp/Auth/Crammd5.php +++ b/libs/Zend/Mail/Protocol/Smtp/Auth/Crammd5.php @@ -17,7 +17,7 @@ * @subpackage Protocol * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Crammd5.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Crammd5.php 22655 2010-07-22 18:47:20Z mabe $ */ @@ -94,7 +94,7 @@ class Zend_Mail_Protocol_Smtp_Auth_Crammd5 extends Zend_Mail_Protocol_Smtp if (strlen($key) > 64) { $key = pack('H32', md5($key)); } elseif (strlen($key) < 64) { - $key = str_pad($key, $block, chr(0)); + $key = str_pad($key, $block, "\0"); } $k_ipad = substr($key, 0, 64) ^ str_repeat(chr(0x36), 64); diff --git a/libs/Zend/Mail/Protocol/Smtp/Auth/Plain.php b/libs/Zend/Mail/Protocol/Smtp/Auth/Plain.php index 02784cb9d3..ce5ba241ac 100644 --- a/libs/Zend/Mail/Protocol/Smtp/Auth/Plain.php +++ b/libs/Zend/Mail/Protocol/Smtp/Auth/Plain.php @@ -17,7 +17,7 @@ * @subpackage Protocol * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Plain.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Plain.php 22655 2010-07-22 18:47:20Z mabe $ */ @@ -89,7 +89,7 @@ class Zend_Mail_Protocol_Smtp_Auth_Plain extends Zend_Mail_Protocol_Smtp $this->_send('AUTH PLAIN'); $this->_expect(334); - $this->_send(base64_encode(chr(0) . $this->_username . chr(0) . $this->_password)); + $this->_send(base64_encode("\0" . $this->_username . "\0" . $this->_password)); $this->_expect(235); $this->_auth = true; } diff --git a/libs/Zend/Mail/Transport/Smtp.php b/libs/Zend/Mail/Transport/Smtp.php index 288cb4644f..a89f6bcf73 100644 --- a/libs/Zend/Mail/Transport/Smtp.php +++ b/libs/Zend/Mail/Transport/Smtp.php @@ -191,10 +191,10 @@ class Zend_Mail_Transport_Smtp extends Zend_Mail_Transport_Abstract if ($this->_auth) { $connectionClass .= '_Auth_' . ucwords($this->_auth); } - // if (!class_exists($connectionClass)) { + if (!class_exists($connectionClass)) { // require_once 'Zend/Loader.php'; - // Zend_Loader::loadClass($connectionClass); - // } + Zend_Loader::loadClass($connectionClass); + } $this->setConnection(new $connectionClass($this->_host, $this->_port, $this->_config)); $this->_connection->connect(); $this->_connection->helo($this->_name); diff --git a/libs/Zend/Registry.php b/libs/Zend/Registry.php index 845ef66bba..d41b4ad7c2 100644 --- a/libs/Zend/Registry.php +++ b/libs/Zend/Registry.php @@ -109,10 +109,10 @@ class Zend_Registry extends ArrayObject /** * @see Zend_Loader */ - // if (!class_exists($registryClassName)) { + if (!class_exists($registryClassName)) { // require_once 'Zend/Loader.php'; - // Zend_Loader::loadClass($registryClassName); - // } + Zend_Loader::loadClass($registryClassName); + } self::$_registryClassName = $registryClassName; } diff --git a/libs/Zend/Session.php b/libs/Zend/Session.php index e361d15db2..3dddcae8ac 100644 --- a/libs/Zend/Session.php +++ b/libs/Zend/Session.php @@ -17,7 +17,7 @@ * @package Zend_Session * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Session.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Session.php 22588 2010-07-16 20:22:07Z ralph $ * @since Preview Release 0.2 */ @@ -531,8 +531,9 @@ class Zend_Session extends Zend_Session_Abstract unset($_SESSION['__ZF'][$namespace]); } - // Expire Namespace by Global Hop (ENGH) - if (isset($namespace_metadata['ENGH']) && $namespace_metadata['ENGH'] >= 1) { + // Expire Namespace by Global Hop (ENGH) if it wasnt expired above + if (isset($_SESSION['__ZF'][$namespace]) && isset($namespace_metadata['ENGH']) && $namespace_metadata['ENGH'] >= 1) { + $_SESSION['__ZF'][$namespace]['ENGH']--; if ($_SESSION['__ZF'][$namespace]['ENGH'] === 0) { @@ -570,8 +571,8 @@ class Zend_Session extends Zend_Session_Abstract unset($_SESSION['__ZF'][$namespace]['ENVGH'][$variable]); } } - if(empty($_SESSION['__ZF'][$namespace]['ENVGH'])) { - unset($_SESSION['__ZF'][$namespace]['ENVGH']); + if (empty($_SESSION['__ZF'][$namespace]['ENVGH'])) { + unset($_SESSION['__ZF'][$namespace]['ENVGH']); } } } @@ -774,10 +775,10 @@ class Zend_Session extends Zend_Session_Abstract private static function _processValidators() { foreach ($_SESSION['__ZF']['VALID'] as $validator_name => $valid_data) { - // if (!class_exists($validator_name)) { + if (!class_exists($validator_name)) { // require_once 'Zend/Loader.php'; - // Zend_Loader::loadClass($validator_name); - // } + Zend_Loader::loadClass($validator_name); + } $validator = new $validator_name; if ($validator->validate() === false) { /** @see Zend_Session_Exception */ diff --git a/libs/Zend/Uri.php b/libs/Zend/Uri.php index ad4c43ee99..d636f3d1df 100644 --- a/libs/Zend/Uri.php +++ b/libs/Zend/Uri.php @@ -16,7 +16,7 @@ * @package Zend_Uri * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Uri.php 22083 2010-05-03 18:49:28Z shahar $ + * @version $Id: Uri.php 22539 2010-07-08 12:47:44Z shahar $ */ /** @@ -127,14 +127,12 @@ abstract class Zend_Uri } } - // if (!class_exists($className)) { - // require_once 'Zend/Loader.php'; - // try { - // Zend_Loader::loadClass($className); - // } catch (Exception $e) { - // require_once 'Zend/Uri/Exception.php'; - // throw new Zend_Uri_Exception("\"$className\" not found"); - // } + // require_once 'Zend/Loader.php'; + // try { + // Zend_Loader::loadClass($className); + // } catch (Exception $e) { + // require_once 'Zend/Uri/Exception.php'; + // throw new Zend_Uri_Exception("\"$className\" not found"); // } $schemeHandler = new $className($scheme, $schemeSpecific); diff --git a/libs/Zend/Validate/Alnum.php b/libs/Zend/Validate/Alnum.php index 9db12a3062..68ff74d6f0 100644 --- a/libs/Zend/Validate/Alnum.php +++ b/libs/Zend/Validate/Alnum.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Alnum.php 20442 2010-01-20 15:15:40Z matthew $ + * @version $Id: Alnum.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/Alpha.php b/libs/Zend/Validate/Alpha.php index 42864fa561..e82f17f823 100644 --- a/libs/Zend/Validate/Alpha.php +++ b/libs/Zend/Validate/Alpha.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Alpha.php 20442 2010-01-20 15:15:40Z matthew $ + * @version $Id: Alpha.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/Barcode.php b/libs/Zend/Validate/Barcode.php index 111010880e..8b0c7705fa 100644 --- a/libs/Zend/Validate/Barcode.php +++ b/libs/Zend/Validate/Barcode.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Barcode.php 21748 2010-04-03 10:29:56Z thomas $ + * @version $Id: Barcode.php 22697 2010-07-26 21:14:47Z alexander $ */ /** @@ -137,9 +137,9 @@ class Zend_Validate_Barcode extends Zend_Validate_Abstract $adapter = 'Zend_Validate_Barcode_' . $adapter; } - // if (!class_exists($adapter)) { - // Zend_Loader::loadClass($adapter); - // } + if (!class_exists($adapter)) { + Zend_Loader::loadClass($adapter); + } $this->_adapter = new $adapter($options); if (!$this->_adapter instanceof Zend_Validate_Barcode_AdapterInterface) { @@ -194,6 +194,17 @@ class Zend_Validate_Barcode extends Zend_Validate_Abstract $this->_length = $adapter->getLength(); $result = $adapter->checkLength($value); if (!$result) { + if (is_array($this->_length)) { + $temp = $this->_length; + $this->_length = ""; + foreach($temp as $length) { + $this->_length .= "/"; + $this->_length .= $length; + } + + $this->_length = substr($this->_length, 1); + } + $this->_error(self::INVALID_LENGTH); return false; } @@ -214,4 +225,4 @@ class Zend_Validate_Barcode extends Zend_Validate_Abstract return true; } -} +}
\ No newline at end of file diff --git a/libs/Zend/Validate/Callback.php b/libs/Zend/Validate/Callback.php index 398e27324c..df12de08e6 100644 --- a/libs/Zend/Validate/Callback.php +++ b/libs/Zend/Validate/Callback.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Callback.php 20096 2010-01-06 02:05:09Z bkarwin $ + * @version $Id: Callback.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/CreditCard.php b/libs/Zend/Validate/CreditCard.php index 9c8c039718..c76fd11f8a 100644 --- a/libs/Zend/Validate/CreditCard.php +++ b/libs/Zend/Validate/CreditCard.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: CreditCard.php 21570 2010-03-19 19:00:50Z thomas $ + * @version $Id: CreditCard.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/Date.php b/libs/Zend/Validate/Date.php index 22e49b7aee..1353f56c5f 100644 --- a/libs/Zend/Validate/Date.php +++ b/libs/Zend/Validate/Date.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Date.php 20358 2010-01-17 19:03:49Z thomas $ + * @version $Id: Date.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/Db/Abstract.php b/libs/Zend/Validate/Db/Abstract.php index 5811c495a9..240b96c9f5 100644 --- a/libs/Zend/Validate/Db/Abstract.php +++ b/libs/Zend/Validate/Db/Abstract.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Abstract.php 22225 2010-05-21 09:12:52Z bittarman $ + * @version $Id: Abstract.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/Digits.php b/libs/Zend/Validate/Digits.php index 9194568e27..da81750fb3 100644 --- a/libs/Zend/Validate/Digits.php +++ b/libs/Zend/Validate/Digits.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Digits.php 21136 2010-02-22 22:30:50Z thomas $ + * @version $Id: Digits.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/EmailAddress.php b/libs/Zend/Validate/EmailAddress.php index c008dcfe9f..ad008b407d 100644 --- a/libs/Zend/Validate/EmailAddress.php +++ b/libs/Zend/Validate/EmailAddress.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: EmailAddress.php 21461 2010-03-10 22:34:03Z thomas $ + * @version $Id: EmailAddress.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/File/Crc32.php b/libs/Zend/Validate/File/Crc32.php index 31b420585e..aef309353e 100644 --- a/libs/Zend/Validate/File/Crc32.php +++ b/libs/Zend/Validate/File/Crc32.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Crc32.php 20358 2010-01-17 19:03:49Z thomas $ + * @version $Id: Crc32.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/File/ExcludeExtension.php b/libs/Zend/Validate/File/ExcludeExtension.php index 94fb27bb6d..0bf2d5bdf9 100644 --- a/libs/Zend/Validate/File/ExcludeExtension.php +++ b/libs/Zend/Validate/File/ExcludeExtension.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: ExcludeExtension.php 20358 2010-01-17 19:03:49Z thomas $ + * @version $Id: ExcludeExtension.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/File/Extension.php b/libs/Zend/Validate/File/Extension.php index 8d903e4093..b5e63a2e95 100644 --- a/libs/Zend/Validate/File/Extension.php +++ b/libs/Zend/Validate/File/Extension.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Extension.php 20358 2010-01-17 19:03:49Z thomas $ + * @version $Id: Extension.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/File/Hash.php b/libs/Zend/Validate/File/Hash.php index 6ade30cf41..4b9772887c 100644 --- a/libs/Zend/Validate/File/Hash.php +++ b/libs/Zend/Validate/File/Hash.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Hash.php 20358 2010-01-17 19:03:49Z thomas $ + * @version $Id: Hash.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/File/ImageSize.php b/libs/Zend/Validate/File/ImageSize.php index 54c1457500..aa882a5b5d 100644 --- a/libs/Zend/Validate/File/ImageSize.php +++ b/libs/Zend/Validate/File/ImageSize.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: ImageSize.php 20358 2010-01-17 19:03:49Z thomas $ + * @version $Id: ImageSize.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/File/IsCompressed.php b/libs/Zend/Validate/File/IsCompressed.php index dc0d99abb5..30415e3229 100644 --- a/libs/Zend/Validate/File/IsCompressed.php +++ b/libs/Zend/Validate/File/IsCompressed.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: IsCompressed.php 21138 2010-02-22 22:37:11Z thomas $ + * @version $Id: IsCompressed.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/File/IsImage.php b/libs/Zend/Validate/File/IsImage.php index d602ebe763..4fa966266f 100644 --- a/libs/Zend/Validate/File/IsImage.php +++ b/libs/Zend/Validate/File/IsImage.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: IsImage.php 21138 2010-02-22 22:37:11Z thomas $ + * @version $Id: IsImage.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/File/Md5.php b/libs/Zend/Validate/File/Md5.php index e76df71917..d2626ba638 100644 --- a/libs/Zend/Validate/File/Md5.php +++ b/libs/Zend/Validate/File/Md5.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Md5.php 20442 2010-01-20 15:15:40Z matthew $ + * @version $Id: Md5.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/File/MimeType.php b/libs/Zend/Validate/File/MimeType.php index a31a7d35a3..7bf1bfd0b1 100644 --- a/libs/Zend/Validate/File/MimeType.php +++ b/libs/Zend/Validate/File/MimeType.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: MimeType.php 21936 2010-04-18 16:23:34Z thomas $ + * @version $Id: MimeType.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/File/Sha1.php b/libs/Zend/Validate/File/Sha1.php index 1b5f8ee622..8d3ee8a03d 100644 --- a/libs/Zend/Validate/File/Sha1.php +++ b/libs/Zend/Validate/File/Sha1.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Sha1.php 20358 2010-01-17 19:03:49Z thomas $ + * @version $Id: Sha1.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/File/Size.php b/libs/Zend/Validate/File/Size.php index a3431cfae1..207a12356e 100644 --- a/libs/Zend/Validate/File/Size.php +++ b/libs/Zend/Validate/File/Size.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Size.php 20455 2010-01-20 22:54:18Z thomas $ + * @version $Id: Size.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/File/WordCount.php b/libs/Zend/Validate/File/WordCount.php index e69bf1db79..2d94bfa605 100644 --- a/libs/Zend/Validate/File/WordCount.php +++ b/libs/Zend/Validate/File/WordCount.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: WordCount.php 20358 2010-01-17 19:03:49Z thomas $ + * @version $Id: WordCount.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/Float.php b/libs/Zend/Validate/Float.php index 37755a8ab7..067f24e28c 100644 --- a/libs/Zend/Validate/Float.php +++ b/libs/Zend/Validate/Float.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Float.php 21664 2010-03-27 21:39:38Z thomas $ + * @version $Id: Float.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/Hex.php b/libs/Zend/Validate/Hex.php index b2080d3aaa..bd8a39a449 100644 --- a/libs/Zend/Validate/Hex.php +++ b/libs/Zend/Validate/Hex.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Hex.php 20358 2010-01-17 19:03:49Z thomas $ + * @version $Id: Hex.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/Int.php b/libs/Zend/Validate/Int.php index 89fa168627..012a58a0ee 100644 --- a/libs/Zend/Validate/Int.php +++ b/libs/Zend/Validate/Int.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Int.php 20532 2010-01-22 20:18:23Z thomas $ + * @version $Id: Int.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/Ip.php b/libs/Zend/Validate/Ip.php index 992e60a787..8cb9a1e379 100644 --- a/libs/Zend/Validate/Ip.php +++ b/libs/Zend/Validate/Ip.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Ip.php 20358 2010-01-17 19:03:49Z thomas $ + * @version $Id: Ip.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/Isbn.php b/libs/Zend/Validate/Isbn.php index e977871b20..61ebf0b9a8 100644 --- a/libs/Zend/Validate/Isbn.php +++ b/libs/Zend/Validate/Isbn.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Isbn.php 21761 2010-04-04 21:37:18Z thomas $ + * @version $Id: Isbn.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/NotEmpty.php b/libs/Zend/Validate/NotEmpty.php index e370459cf9..150efddbde 100644 --- a/libs/Zend/Validate/NotEmpty.php +++ b/libs/Zend/Validate/NotEmpty.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: NotEmpty.php 20193 2010-01-11 10:40:43Z thomas $ + * @version $Id: NotEmpty.php 22697 2010-07-26 21:14:47Z alexander $ */ /** @@ -32,31 +32,37 @@ */ class Zend_Validate_NotEmpty extends Zend_Validate_Abstract { - const BOOLEAN = 1; - const INTEGER = 2; - const FLOAT = 4; - const STRING = 8; - const ZERO = 16; - const EMPTY_ARRAY = 32; - const NULL = 64; - const PHP = 127; - const SPACE = 128; - const ALL = 255; + const BOOLEAN = 1; + const INTEGER = 2; + const FLOAT = 4; + const STRING = 8; + const ZERO = 16; + const EMPTY_ARRAY = 32; + const NULL = 64; + const PHP = 127; + const SPACE = 128; + const OBJECT = 256; + const OBJECT_STRING = 512; + const OBJECT_COUNT = 1024; + const ALL = 2047; const INVALID = 'notEmptyInvalid'; const IS_EMPTY = 'isEmpty'; protected $_constants = array( - self::BOOLEAN => 'boolean', - self::INTEGER => 'integer', - self::FLOAT => 'float', - self::STRING => 'string', - self::ZERO => 'zero', - self::EMPTY_ARRAY => 'array', - self::NULL => 'null', - self::PHP => 'php', - self::SPACE => 'space', - self::ALL => 'all' + self::BOOLEAN => 'boolean', + self::INTEGER => 'integer', + self::FLOAT => 'float', + self::STRING => 'string', + self::ZERO => 'zero', + self::EMPTY_ARRAY => 'array', + self::NULL => 'null', + self::PHP => 'php', + self::SPACE => 'space', + self::OBJECT => 'object', + self::OBJECT_STRING => 'objectstring', + self::OBJECT_COUNT => 'objectcount', + self::ALL => 'all', ); /** @@ -72,7 +78,7 @@ class Zend_Validate_NotEmpty extends Zend_Validate_Abstract * * @var integer */ - protected $_type = 237; + protected $_type = 493; /** * Constructor @@ -151,14 +157,50 @@ class Zend_Validate_NotEmpty extends Zend_Validate_Abstract */ public function isValid($value) { - if (!is_null($value) && !is_string($value) && !is_int($value) && !is_float($value) && - !is_bool($value) && !is_array($value)) { + if ($value !== null && !is_string($value) && !is_int($value) && !is_float($value) && + !is_bool($value) && !is_array($value) && !is_object($value)) { $this->_error(self::INVALID); return false; } $type = $this->getType(); $this->_setValue($value); + $object = false; + + // OBJECT_COUNT (countable object) + if ($type >= self::OBJECT_COUNT) { + $type -= self::OBJECT_COUNT; + $object = true; + + if (is_object($value) && ($value instanceof Countable) && (count($value) == 0)) { + $this->_error(self::IS_EMPTY); + return false; + } + } + + // OBJECT_STRING (object's toString) + if ($type >= self::OBJECT_STRING) { + $type -= self::OBJECT_STRING; + $object = true; + + if ((is_object($value) && (!method_exists($value, '__toString'))) || + (is_object($value) && (method_exists($value, '__toString')) && (((string) $value) == ""))) { + $this->_error(self::IS_EMPTY); + return false; + } + } + + // OBJECT (object) + if ($type >= self::OBJECT) { + $type -= self::OBJECT; + // fall trough, objects are always not empty + } else if ($object === false) { + // object not allowed but object given -> return false + if (is_object($value)) { + $this->_error(self::IS_EMPTY); + return false; + } + } // SPACE (' ') if ($type >= self::SPACE) { @@ -172,7 +214,7 @@ class Zend_Validate_NotEmpty extends Zend_Validate_Abstract // NULL (null) if ($type >= self::NULL) { $type -= self::NULL; - if (is_null($value)) { + if ($value === null) { $this->_error(self::IS_EMPTY); return false; } diff --git a/libs/Zend/Validate/PostCode.php b/libs/Zend/Validate/PostCode.php index 1ba58a996b..9f7ea69e63 100644 --- a/libs/Zend/Validate/PostCode.php +++ b/libs/Zend/Validate/PostCode.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: PostCode.php 21487 2010-03-14 10:17:35Z thomas $ + * @version $Id: PostCode.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/Regex.php b/libs/Zend/Validate/Regex.php index e46143287f..ff7cbb5252 100644 --- a/libs/Zend/Validate/Regex.php +++ b/libs/Zend/Validate/Regex.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Regex.php 21574 2010-03-19 20:00:37Z thomas $ + * @version $Id: Regex.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/Sitemap/Changefreq.php b/libs/Zend/Validate/Sitemap/Changefreq.php index 6f023856dc..3f190efa0f 100644 --- a/libs/Zend/Validate/Sitemap/Changefreq.php +++ b/libs/Zend/Validate/Sitemap/Changefreq.php @@ -17,7 +17,7 @@ * @subpackage Sitemap * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Changefreq.php 21365 2010-03-07 09:38:41Z thomas $ + * @version $Id: Changefreq.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/Sitemap/Lastmod.php b/libs/Zend/Validate/Sitemap/Lastmod.php index aa2266ecd9..362e562eac 100644 --- a/libs/Zend/Validate/Sitemap/Lastmod.php +++ b/libs/Zend/Validate/Sitemap/Lastmod.php @@ -17,7 +17,7 @@ * @subpackage Sitemap * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Lastmod.php 21365 2010-03-07 09:38:41Z thomas $ + * @version $Id: Lastmod.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/Sitemap/Loc.php b/libs/Zend/Validate/Sitemap/Loc.php index 180f669a01..d4df42e307 100644 --- a/libs/Zend/Validate/Sitemap/Loc.php +++ b/libs/Zend/Validate/Sitemap/Loc.php @@ -17,7 +17,7 @@ * @subpackage Sitemap * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Loc.php 21365 2010-03-07 09:38:41Z thomas $ + * @version $Id: Loc.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/Sitemap/Priority.php b/libs/Zend/Validate/Sitemap/Priority.php index 58772d5b2d..8d340de900 100644 --- a/libs/Zend/Validate/Sitemap/Priority.php +++ b/libs/Zend/Validate/Sitemap/Priority.php @@ -17,7 +17,7 @@ * @subpackage Sitemap * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Priority.php 21365 2010-03-07 09:38:41Z thomas $ + * @version $Id: Priority.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Validate/StringLength.php b/libs/Zend/Validate/StringLength.php index c9362ace22..807269178f 100644 --- a/libs/Zend/Validate/StringLength.php +++ b/libs/Zend/Validate/StringLength.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: StringLength.php 20358 2010-01-17 19:03:49Z thomas $ + * @version $Id: StringLength.php 22697 2010-07-26 21:14:47Z alexander $ */ /** diff --git a/libs/Zend/Version.php b/libs/Zend/Version.php index 96dbbf353c..5bb57f0ac5 100644 --- a/libs/Zend/Version.php +++ b/libs/Zend/Version.php @@ -16,7 +16,7 @@ * @package Zend_Version * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Version.php 22482 2010-06-21 17:58:24Z matthew $ + * @version $Id: Version.php 22703 2010-07-27 12:38:42Z matthew $ */ /** @@ -32,7 +32,7 @@ final class Zend_Version /** * Zend Framework version identification - see compareVersion() */ - const VERSION = '1.10.6'; + const VERSION = '1.10.7'; /** * Compare the specified Zend Framework version string $version |