diff --git a/library/Zend/Application/Resource/Db.php b/library/Zend/Application/Resource/Db.php index ed5c59aea..e950f1345 100644 --- a/library/Zend/Application/Resource/Db.php +++ b/library/Zend/Application/Resource/Db.php @@ -17,7 +17,7 @@ * @subpackage Resource * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Db.php 23775 2011-03-01 17:25:24Z ralph $ + * @version $Id: Db.php 24297 2011-07-29 00:11:25Z adamlundrigan $ */ /** @@ -45,7 +45,7 @@ class Zend_Application_Resource_Db extends Zend_Application_Resource_ResourceAbs protected $_adapter = null; /** - * @var Zend_Db_Adapter_Interface + * @var Zend_Db_Adapter_Abstract */ protected $_db; @@ -132,7 +132,7 @@ class Zend_Application_Resource_Db extends Zend_Application_Resource_ResourceAbs /** * Retrieve initialized DB connection * - * @return null|Zend_Db_Adapter_Interface + * @return null|Zend_Db_Adapter_Abstract */ public function getDbAdapter() { diff --git a/library/Zend/Application/Resource/View.php b/library/Zend/Application/Resource/View.php index 633052ec9..a5dac4716 100644 --- a/library/Zend/Application/Resource/View.php +++ b/library/Zend/Application/Resource/View.php @@ -17,7 +17,7 @@ * @subpackage Resource * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: View.php 23992 2011-05-04 03:32:01Z ralph $ + * @version $Id: View.php 24288 2011-07-28 20:37:43Z matthew $ */ /** @@ -52,9 +52,8 @@ class Zend_Application_Resource_View extends Zend_Application_Resource_ResourceA { $view = $this->getView(); - $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer(); + $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); $viewRenderer->setView($view); - Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); return $view; } diff --git a/library/Zend/Cache/Backend/TwoLevels.php b/library/Zend/Cache/Backend/TwoLevels.php index c4ff282c6..127f21d30 100644 --- a/library/Zend/Cache/Backend/TwoLevels.php +++ b/library/Zend/Cache/Backend/TwoLevels.php @@ -17,7 +17,7 @@ * @subpackage Zend_Cache_Backend * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: TwoLevels.php 23775 2011-03-01 17:25:24Z ralph $ + * @version $Id: TwoLevels.php 24254 2011-07-22 12:04:41Z mabe $ */ @@ -383,7 +383,6 @@ class Zend_Cache_Backend_TwoLevels extends Zend_Cache_Backend implements Zend_Ca return $this->_slowBackend->getIdsMatchingAnyTags($tags); } - /** * Return the filling percentage of the backend storage * @@ -481,18 +480,19 @@ class Zend_Cache_Backend_TwoLevels extends Zend_Cache_Backend implements Zend_Ca */ private function _getFastLifetime($lifetime, $priority, $maxLifetime = null) { - if ($lifetime === null) { - // if lifetime is null, we have an infinite lifetime + if ($lifetime <= 0) { + // if no lifetime, we have an infinite lifetime // we need to use arbitrary lifetimes $fastLifetime = (int) (2592000 / (11 - $priority)); } else { - $fastLifetime = (int) ($lifetime / (11 - $priority)); + // prevent computed infinite lifetime (0) by ceil + $fastLifetime = (int) ceil($lifetime / (11 - $priority)); } - if (($maxLifetime !== null) && ($maxLifetime >= 0)) { - if ($fastLifetime > $maxLifetime) { - return $maxLifetime; - } + + if ($maxLifetime >= 0 && $fastLifetime > $maxLifetime) { + return $maxLifetime; } + return $fastLifetime; } diff --git a/library/Zend/Controller/Action.php b/library/Zend/Controller/Action.php index 5457bb24c..a6c178551 100644 --- a/library/Zend/Controller/Action.php +++ b/library/Zend/Controller/Action.php @@ -16,7 +16,7 @@ * @package Zend_Controller * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Action.php 23775 2011-03-01 17:25:24Z ralph $ + * @version $Id: Action.php 24253 2011-07-22 00:15:05Z adamlundrigan $ */ /** @@ -505,14 +505,18 @@ abstract class Zend_Controller_Action implements Zend_Controller_Action_Interfac $this->_classMethods = get_class_methods($this); } - // preDispatch() didn't change the action, so we can continue - if ($this->getInvokeArg('useCaseSensitiveActions') || in_array($action, $this->_classMethods)) { - if ($this->getInvokeArg('useCaseSensitiveActions')) { - trigger_error('Using case sensitive actions without word separators is deprecated; please do not rely on this "feature"'); + // If pre-dispatch hooks introduced a redirect then stop dispatch + // @see ZF-7496 + if (!($this->getResponse()->isRedirect())) { + // preDispatch() didn't change the action, so we can continue + if ($this->getInvokeArg('useCaseSensitiveActions') || in_array($action, $this->_classMethods)) { + if ($this->getInvokeArg('useCaseSensitiveActions')) { + trigger_error('Using case sensitive actions without word separators is deprecated; please do not rely on this "feature"'); + } + $this->$action(); + } else { + $this->__call($action, array()); } - $this->$action(); - } else { - $this->__call($action, array()); } $this->postDispatch(); } diff --git a/library/Zend/Controller/Action/Helper/ViewRenderer.php b/library/Zend/Controller/Action/Helper/ViewRenderer.php index 7b1c5efe2..51059be5e 100644 --- a/library/Zend/Controller/Action/Helper/ViewRenderer.php +++ b/library/Zend/Controller/Action/Helper/ViewRenderer.php @@ -17,7 +17,7 @@ * @subpackage Zend_Controller_Action_Helper * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: ViewRenderer.php 24225 2011-07-12 19:23:12Z matthew $ + * @version $Id: ViewRenderer.php 24282 2011-07-28 18:59:26Z matthew $ */ /** @@ -630,14 +630,6 @@ class Zend_Controller_Action_Helper_ViewRenderer extends Zend_Controller_Action_ $replacePattern = array('/[^a-z0-9]+$/i', '/^[^a-z0-9]+/i'); $vars['action'] = preg_replace($replacePattern, '', $vars['action']); - // Remove non-alphanumeric characters from action name - // see ZF-10725 - $vars['action'] = preg_replace( - array('/[^a-z0-9]+$/', '/^[^a-z0-9]+/'), - array('', ''), - $vars['action'] - ); - $inflector = $this->getInflector(); if ($this->getNoController() || $this->getNeverController()) { $this->_setInflectorTarget($this->getViewScriptPathNoControllerSpec()); diff --git a/library/Zend/Filter/Input.php b/library/Zend/Filter/Input.php index 673c48dd0..d3cbacae9 100644 --- a/library/Zend/Filter/Input.php +++ b/library/Zend/Filter/Input.php @@ -16,7 +16,7 @@ * @package Zend_Filter * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Input.php 24229 2011-07-13 11:05:10Z mcleod@spaceweb.nl $ + * @version $Id: Input.php 24268 2011-07-25 14:47:42Z guilhermeblanco $ */ /** diff --git a/library/Zend/Filter/StripTags.php b/library/Zend/Filter/StripTags.php index 0d6c05c67..217babbe0 100644 --- a/library/Zend/Filter/StripTags.php +++ b/library/Zend/Filter/StripTags.php @@ -16,7 +16,7 @@ * @package Zend_Filter * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: StripTags.php 23775 2011-03-01 17:25:24Z ralph $ + * @version $Id: StripTags.php 24278 2011-07-28 18:32:21Z adamlundrigan $ */ @@ -319,7 +319,7 @@ class Zend_Filter_StripTags implements Zend_Filter_Interface // If there are non-whitespace characters in the attribute string if (strlen($tagAttributes)) { // Parse iteratively for well-formed attributes - preg_match_all('/(\w+)\s*=\s*(?:(")(.*?)"|(\')(.*?)\')/s', $tagAttributes, $matches); + preg_match_all('/([\w-]+)\s*=\s*(?:(")(.*?)"|(\')(.*?)\')/s', $tagAttributes, $matches); // Initialize valid attribute accumulator $tagAttributes = ''; diff --git a/library/Zend/Form/Element/Captcha.php b/library/Zend/Form/Element/Captcha.php index 3955d7fdb..42706c93c 100644 --- a/library/Zend/Form/Element/Captcha.php +++ b/library/Zend/Form/Element/Captcha.php @@ -17,7 +17,7 @@ * @subpackage Element * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Captcha.php 24224 2011-07-12 17:45:49Z matthew $ + * @version $Id: Captcha.php 24294 2011-07-28 21:34:50Z matthew $ */ /** @see Zend_Form_Element_Xhtml */ @@ -178,17 +178,24 @@ class Zend_Form_Element_Captcha extends Zend_Form_Element_Xhtml $captcha = $this->getCaptcha(); $captcha->setName($this->getFullyQualifiedName()); - $decorators = $this->getDecorators(); + if (!$this->loadDefaultDecoratorsIsDisabled()) { + $decorators = $this->getDecorators(); + $decorator = $captcha->getDecorator(); + $key = get_class($this->_getDecorator($decorator, null)); + + if (!empty($decorator) && !array_key_exists($key, $decorators)) { + array_unshift($decorators, $decorator); + } - $decorator = $captcha->getDecorator(); - if (!empty($decorator)) { - array_unshift($decorators, $decorator); - } else { $decorator = array('Captcha', array('captcha' => $captcha)); - array_unshift($decorators, $decorator); - } + $key = get_class($this->_getDecorator($decorator[0], $decorator[1])); - $this->setDecorators($decorators); + if ($captcha instanceof Zend_Captcha_Word && !array_key_exists($key, $decorators)) { + array_unshift($decorators, $decorator); + } + + $this->setDecorators($decorators); + } $this->setValue($this->getCaptcha()->generate()); diff --git a/library/Zend/Form/Element/Submit.php b/library/Zend/Form/Element/Submit.php index 7c8a99c4c..6b7ef9f03 100644 --- a/library/Zend/Form/Element/Submit.php +++ b/library/Zend/Form/Element/Submit.php @@ -30,7 +30,7 @@ require_once 'Zend/Form/Element/Xhtml.php'; * @subpackage Element * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Submit.php 23871 2011-04-23 22:40:16Z ramon $ + * @version $Id: Submit.php 24280 2011-07-28 18:39:33Z matthew $ */ class Zend_Form_Element_Submit extends Zend_Form_Element_Xhtml { @@ -75,10 +75,10 @@ class Zend_Form_Element_Submit extends Zend_Form_Element_Xhtml if (null === $value) { $value = $this->getName(); - } - if (null !== ($translator = $this->getTranslator())) { - return $translator->translate($value); + if (null !== ($translator = $this->getTranslator())) { + return $translator->translate($value); + } } return $value; diff --git a/library/Zend/Gdata/AuthSub.php b/library/Zend/Gdata/AuthSub.php index 6492cfca5..7aa9d1118 100644 --- a/library/Zend/Gdata/AuthSub.php +++ b/library/Zend/Gdata/AuthSub.php @@ -18,7 +18,7 @@ * @subpackage Gdata * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: AuthSub.php 24061 2011-05-28 17:25:04Z adamlundrigan $ + * @version $Id: AuthSub.php 24319 2011-07-30 13:43:41Z mikaelkael $ */ /** @@ -169,6 +169,7 @@ class Zend_Gdata_AuthSub try { $response = $client->request('GET'); } catch (Zend_Http_Client_Exception $e) { + ob_end_clean(); require_once 'Zend/Gdata/App/HttpException.php'; throw new Zend_Gdata_App_HttpException($e->getMessage(), $e); } @@ -210,6 +211,7 @@ class Zend_Gdata_AuthSub try { $response = $client->request('GET'); } catch (Zend_Http_Client_Exception $e) { + ob_end_clean(); require_once 'Zend/Gdata/App/HttpException.php'; throw new Zend_Gdata_App_HttpException($e->getMessage(), $e); } diff --git a/library/Zend/Http/Client.php b/library/Zend/Http/Client.php index ddb4e677e..546207900 100644 --- a/library/Zend/Http/Client.php +++ b/library/Zend/Http/Client.php @@ -16,7 +16,7 @@ * @category Zend * @package Zend_Http * @subpackage Client - * @version $Id: Client.php 24194 2011-07-05 15:53:45Z matthew $ + * @version $Id: Client.php 24337 2011-08-01 13:04:41Z ezimuel $ * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -282,7 +282,10 @@ class Zend_Http_Client */ public function setUri($uri) { - if (is_string($uri)) { + if ($uri instanceof Zend_Uri_Http) { + // clone the URI in order to keep the passed parameter constant + $uri = clone $uri; + } elseif (is_string($uri)) { $uri = Zend_Uri::factory($uri); } @@ -371,7 +374,7 @@ class Zend_Http_Client throw new Zend_Http_Client_Exception("'{$method}' is not a valid HTTP request method."); } - if ($method == self::POST && $this->enctype === null) { + if (($method == self::POST || $method == self::PUT || $method == self::DELETE) && $this->enctype === null) { $this->setEncType(self::ENC_URLENCODED); } @@ -891,6 +894,10 @@ class Zend_Http_Client */ public function getAdapter() { + if (null === $this->adapter) { + $this->setAdapter($this->config['adapter']); + } + return $this->adapter; } @@ -1019,7 +1026,10 @@ class Zend_Http_Client } if($this->config['output_stream']) { - rewind($stream); + $streamMetaData = stream_get_meta_data($stream); + if ($streamMetaData['seekable']) { + rewind($stream); + } // cleanup the adapter $this->adapter->setOutputStream(null); $response = Zend_Http_Response_Stream::fromStream($response, $stream); @@ -1226,20 +1236,13 @@ class Zend_Http_Client // Encode body as multipart/form-data $boundary = '---ZENDHTTPCLIENT-' . md5(microtime()); $this->setHeaders(self::CONTENT_TYPE, self::ENC_FORMDATA . "; boundary={$boundary}"); - - // Map the formname of each file to the array index it is stored in - $fileIndexMap = array(); - foreach ($this->files as $key=>$fdata ) { - $fileIndexMap[$fdata['formname']] = $key; - } // Encode all files and POST vars in the order they were given foreach ($this->body_field_order as $fieldName=>$fieldType) { switch ($fieldType) { case self::VTYPE_FILE: - if (isset($fileIndexMap[$fieldName])) { - if (isset($this->files[$fileIndexMap[$fieldName]])) { - $file = $this->files[$fileIndexMap[$fieldName]]; + foreach ($this->files as $file) { + if ($file['formname']===$fieldName) { $fhead = array(self::CONTENT_TYPE => $file['ctype']); $body .= self::encodeFormData($boundary, $file['formname'], $file['data'], $file['filename'], $fhead); } diff --git a/library/Zend/Http/Client/Adapter/Curl.php b/library/Zend/Http/Client/Adapter/Curl.php index aff210e2e..fa51703e4 100644 --- a/library/Zend/Http/Client/Adapter/Curl.php +++ b/library/Zend/Http/Client/Adapter/Curl.php @@ -16,7 +16,7 @@ * @category Zend * @package Zend_Http * @subpackage Client_Adapter - * @version $Id: Curl.php 23775 2011-03-01 17:25:24Z ralph $ + * @version $Id: Curl.php 24272 2011-07-27 21:12:08Z mcleod@spaceweb.nl $ * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -393,6 +393,9 @@ class Zend_Http_Client_Adapter_Curl implements Zend_Http_Client_Adapter_Interfac } elseif ($method == Zend_Http_Client::PUT) { // This is a PUT by a setRawData string, not by file-handle curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $body); + } elseif ($method == Zend_Http_Client::DELETE) { + // This is a DELETE by a setRawData string + curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $body); } // set additional curl options diff --git a/library/Zend/Http/Client/Adapter/Test.php b/library/Zend/Http/Client/Adapter/Test.php index 43d3b03b7..35690fe11 100644 --- a/library/Zend/Http/Client/Adapter/Test.php +++ b/library/Zend/Http/Client/Adapter/Test.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Http * @subpackage Client_Adapter - * @version $Id: Test.php 23775 2011-03-01 17:25:24Z ralph $ + * @version $Id: Test.php 24309 2011-07-30 02:52:32Z ramon $ * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -235,4 +235,14 @@ class Zend_Http_Client_Adapter_Test implements Zend_Http_Client_Adapter_Interfac } $this->responseIndex = $index; } + + /** + * Retrieve the array of all configuration options + * + * @return array + */ + public function getConfig() + { + return $this->config; + } } diff --git a/library/Zend/Http/UserAgent/AbstractDevice.php b/library/Zend/Http/UserAgent/AbstractDevice.php index 13f347766..06a62d89d 100644 --- a/library/Zend/Http/UserAgent/AbstractDevice.php +++ b/library/Zend/Http/UserAgent/AbstractDevice.php @@ -555,7 +555,11 @@ abstract class Zend_Http_UserAgent_AbstractDevice $result['device'] = strtolower($result['compatibility_flag']); $result['device_os_token'] = 'iPhone OS'; $result['browser_language'] = trim($comment[3]); - $result['browser_version'] = $result['others']['detail'][1][2]; + if (isset($result['others']['detail'][1])) { + $result['browser_version'] = $result['others']['detail'][1][2]; + } elseif (count($result['others']['detail'])) { + $result['browser_version'] = $result['others']['detail'][0][2]; + } if (!empty($result['others']['detail'][2])) { $result['firmware'] = $result['others']['detail'][2][2]; } @@ -570,7 +574,7 @@ abstract class Zend_Http_UserAgent_AbstractDevice if (isset($result['others'])) { if ($result['others']['detail'][0][1] == 'AppleWebKit') { $result['browser_engine'] = 'AppleWebKit'; - if ($result['others']['detail'][1][1] == 'Version') { + if (isset($result['others']['detail'][1]) && $result['others']['detail'][1][1] == 'Version') { $result['browser_version'] = $result['others']['detail'][1][2]; } else { $result['browser_version'] = $result['others']['detail'][count($result['others']['detail']) - 1][2]; @@ -582,8 +586,13 @@ abstract class Zend_Http_UserAgent_AbstractDevice $last = $result['others']['detail'][count($result['others']['detail']) - 1][1]; if (empty($result['others']['detail'][2][1]) || $result['others']['detail'][2][1] == 'Safari') { - $result['browser_name'] = ($result['others']['detail'][1][1] && $result['others']['detail'][1][1] != 'Version' ? $result['others']['detail'][1][1] : 'Safari'); - $result['browser_version'] = ($result['others']['detail'][1][2] ? $result['others']['detail'][1][2] : $result['others']['detail'][0][2]); + if (isset($result['others']['detail'][1])) { + $result['browser_name'] = ($result['others']['detail'][1][1] && $result['others']['detail'][1][1] != 'Version' ? $result['others']['detail'][1][1] : 'Safari'); + $result['browser_version'] = ($result['others']['detail'][1][2] ? $result['others']['detail'][1][2] : $result['others']['detail'][0][2]); + } else { + $result['browser_name'] = ($result['others']['detail'][0][1] && $result['others']['detail'][0][1] != 'Version' ? $result['others']['detail'][0][1] : 'Safari'); + $result['browser_version'] = $result['others']['detail'][0][2]; + } } else { $result['browser_name'] = $result['others']['detail'][2][1]; $result['browser_version'] = $result['others']['detail'][2][2]; diff --git a/library/Zend/Json/Server.php b/library/Zend/Json/Server.php index 2f80d4c8e..b4c13f83a 100644 --- a/library/Zend/Json/Server.php +++ b/library/Zend/Json/Server.php @@ -16,7 +16,7 @@ * @package Zend_Json * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Server.php 23775 2011-03-01 17:25:24Z ralph $ + * @version $Id: Server.php 24272 2011-07-27 21:12:08Z mcleod@spaceweb.nl $ */ /** diff --git a/library/Zend/Mail/Transport/File.php b/library/Zend/Mail/Transport/File.php index 1de78f20e..6a0bdcac3 100644 --- a/library/Zend/Mail/Transport/File.php +++ b/library/Zend/Mail/Transport/File.php @@ -86,7 +86,7 @@ class Zend_Mail_Transport_File extends Zend_Mail_Transport_Abstract */ public function setOptions(array $options) { - if (isset($options['path'])&& is_dir($options['path'])) { + if (isset($options['path']) && is_dir($options['path'])) { $this->_path = $options['path']; } if (isset($options['callback']) && is_callable($options['callback'])) { diff --git a/library/Zend/Markup/Parser/Textile.php b/library/Zend/Markup/Parser/Textile.php index d1f0a2b84..8c5f187a3 100644 --- a/library/Zend/Markup/Parser/Textile.php +++ b/library/Zend/Markup/Parser/Textile.php @@ -17,7 +17,7 @@ * @subpackage Parser * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Textile.php 23775 2011-03-01 17:25:24Z ralph $ + * @version $Id: Textile.php 24266 2011-07-24 14:37:43Z ramon $ */ /** @@ -288,7 +288,7 @@ class Zend_Markup_Parser_Textile implements Zend_Markup_Parser_ParserInterface $this->_temp = array( 'tag' => '', 'name' => 'p', - 'type' => Zend_Markup_token::TYPE_TAG, + 'type' => Zend_Markup_Token::TYPE_TAG, 'attributes' => array() ); } else { diff --git a/library/Zend/Oauth/Client.php b/library/Zend/Oauth/Client.php index 3609af221..9ec4531f7 100644 --- a/library/Zend/Oauth/Client.php +++ b/library/Zend/Oauth/Client.php @@ -16,7 +16,7 @@ * @package Zend_Oauth * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Client.php 23983 2011-05-03 19:27:35Z ralph $ + * @version $Id: Client.php 24311 2011-07-30 03:12:18Z ramon $ */ /** Zend_Oauth */ @@ -69,14 +69,18 @@ class Zend_Oauth_Client extends Zend_Http_Client * assist in automating OAuth parameter generation, addition and * cryptographioc signing of requests. * - * @param array $oauthOptions - * @param string $uri + * @param array|Zend_Config $oauthOptions + * @param string $uri * @param array|Zend_Config $config * @return void */ public function __construct($oauthOptions, $uri = null, $config = null) { - if (!isset($config['rfc3986_strict'])) { + if ($config instanceof Zend_Config && !isset($config->rfc3986_strict)) { + $config = $config->toArray(); + $config['rfc3986_strict'] = true; + } else if (null === $config || + (is_array($config) && !isset($config['rfc3986_strict']))) { $config['rfc3986_strict'] = true; } parent::__construct($uri, $config); @@ -89,16 +93,6 @@ class Zend_Oauth_Client extends Zend_Http_Client } } - /** - * Return the current connection adapter - * - * @return Zend_Http_Client_Adapter_Interface|string $adapter - */ - public function getAdapter() - { - return $this->adapter; - } - /** * Load the connection adapter * @@ -274,7 +268,7 @@ class Zend_Oauth_Client extends Zend_Http_Client foreach ($queryParts as $queryPart) { $kvTuple = explode('=', $queryPart); $params[urldecode($kvTuple[0])] = - (array_key_exists(1, $kvTuple) ? urldecode($kvTuple[1]) : NULL); + (array_key_exists(1, $kvTuple) ? urldecode($kvTuple[1]) : null); } } if (!empty($this->paramsPost)) { diff --git a/library/Zend/Rest/Client.php b/library/Zend/Rest/Client.php index 00ba51fdb..439e6f50e 100644 --- a/library/Zend/Rest/Client.php +++ b/library/Zend/Rest/Client.php @@ -17,7 +17,7 @@ * @subpackage Client * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Client.php 23775 2011-03-01 17:25:24Z ralph $ + * @version $Id: Client.php 24274 2011-07-28 09:25:31Z mcleod@spaceweb.nl $ */ @@ -98,7 +98,7 @@ class Zend_Rest_Client extends Zend_Service_Abstract * @throws Zend_Rest_Client_Exception * @return void */ - final private function _prepareRest($path) + private function _prepareRest($path) { // Get the URI object and configure it if (!$this->_uri instanceof Zend_Uri_Http) { @@ -129,7 +129,7 @@ class Zend_Rest_Client extends Zend_Service_Abstract * @throws Zend_Http_Client_Exception * @return Zend_Http_Response */ - final public function restGet($path, array $query = null) + public function restGet($path, array $query = null) { $this->_prepareRest($path); $client = self::getHttpClient(); @@ -167,7 +167,7 @@ class Zend_Rest_Client extends Zend_Service_Abstract * @throws Zend_Http_Client_Exception * @return Zend_Http_Response */ - final public function restPost($path, $data = null) + public function restPost($path, $data = null) { $this->_prepareRest($path); return $this->_performPost('POST', $data); @@ -181,7 +181,7 @@ class Zend_Rest_Client extends Zend_Service_Abstract * @throws Zend_Http_Client_Exception * @return Zend_Http_Response */ - final public function restPut($path, $data = null) + public function restPut($path, $data = null) { $this->_prepareRest($path); return $this->_performPost('PUT', $data); @@ -194,10 +194,10 @@ class Zend_Rest_Client extends Zend_Service_Abstract * @throws Zend_Http_Client_Exception * @return Zend_Http_Response */ - final public function restDelete($path) + public function restDelete($path, $data = null) { $this->_prepareRest($path); - return self::getHttpClient()->request('DELETE'); + return $this->_performPost('DELETE', $data); } /** diff --git a/library/Zend/Tool/Framework/Manifest/ActionMetadata.php b/library/Zend/Tool/Framework/Manifest/ActionMetadata.php new file mode 100644 index 000000000..7552cf28a --- /dev/null +++ b/library/Zend/Tool/Framework/Manifest/ActionMetadata.php @@ -0,0 +1,31 @@ +_registry->getRequest(); $response = $this->_registry->getResponse(); - + // determine if testing is enabled in the project require_once 'Zend/Tool/Project/Provider/Test.php'; $testingEnabled = Zend_Tool_Project_Provider_Test::isTestingEnabled($this->_loadedProfile); - + if ($testingEnabled && !Zend_Tool_Project_Provider_Test::isPHPUnitAvailable()) { $testingEnabled = false; $response->appendContent( @@ -146,7 +146,7 @@ class Zend_Tool_Project_Provider_Action array('color' => array('yellow')) ); } - + // Check that there is not a dash or underscore, return if doesnt match regex if (preg_match('#[_-]#', $name)) { throw new Zend_Tool_Project_Provider_Exception('Action names should be camel cased.'); @@ -167,6 +167,7 @@ class Zend_Tool_Project_Provider_Action $actionMethodResource = self::createResource($this->_loadedProfile, $name, $controllerName, $module); + $testActionMethodResource = null; if ($testingEnabled) { $testActionMethodResource = Zend_Tool_Project_Provider_Test::createApplicationResource($this->_loadedProfile, $controllerName, $name, $module); } @@ -199,23 +200,23 @@ class Zend_Tool_Project_Provider_Action 'Would create an action named ' . $name . ' inside controller at ' . $actionMethodResource->getParentResource()->getContext()->getPath() ); - + if ($testActionMethodResource) { $response->appendContent('Would create an action test in ' . $testActionMethodResource->getParentResource()->getContext()->getPath()); } - + } else { $response->appendContent( 'Creating an action named ' . $name . ' inside controller at ' . $actionMethodResource->getParentResource()->getContext()->getPath() ); $actionMethodResource->create(); - + if ($testActionMethodResource) { $response->appendContent('Creating an action test in ' . $testActionMethodResource->getParentResource()->getContext()->getPath()); $testActionMethodResource->create(); } - + $this->_storeProfile(); } diff --git a/library/Zend/Translate/Adapter.php b/library/Zend/Translate/Adapter.php index 80fbefecf..f8a78f750 100644 --- a/library/Zend/Translate/Adapter.php +++ b/library/Zend/Translate/Adapter.php @@ -17,7 +17,7 @@ * @subpackage Zend_Translate_Adapter * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Adapter.php 24215 2011-07-08 21:27:44Z guilhermeblanco $ + * @version $Id: Adapter.php 24268 2011-07-25 14:47:42Z guilhermeblanco $ */ /** @@ -249,7 +249,8 @@ abstract class Zend_Translate_Adapter { new RecursiveRegexIterator( new RecursiveDirectoryIterator($options['content'], RecursiveDirectoryIterator::KEY_AS_PATHNAME), '/^(?!.*(\.svn|\.cvs)).*$/', RecursiveRegexIterator::MATCH - ) + ), + RecursiveIteratorIterator::SELF_FIRST ); foreach ($iterator as $directory => $info) { diff --git a/library/Zend/Validate/EmailAddress.php b/library/Zend/Validate/EmailAddress.php index 407f13006..099cdd5c1 100644 --- a/library/Zend/Validate/EmailAddress.php +++ b/library/Zend/Validate/EmailAddress.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: EmailAddress.php 24125 2011-06-07 16:13:26Z adamlundrigan $ + * @version $Id: EmailAddress.php 24304 2011-07-30 01:12:35Z adamlundrigan $ */ /** @@ -527,9 +527,8 @@ class Zend_Validate_EmailAddress extends Zend_Validate_Abstract $this->_setValue($value); // Split email address up and disallow '..' - // and disallow addresses ending with a '.' if ((strpos($value, '..') !== false) or - (!preg_match('/^(.+)@([^@]+[^.])$/', $value, $matches))) { + (!preg_match('/^(.+)@([^@]+)$/', $value, $matches))) { $this->_error(self::INVALID_FORMAT); return false; } diff --git a/library/Zend/Validate/Hostname.php b/library/Zend/Validate/Hostname.php index 3829614e9..cf51bd92d 100644 --- a/library/Zend/Validate/Hostname.php +++ b/library/Zend/Validate/Hostname.php @@ -16,7 +16,7 @@ * @package Zend_Validate * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Hostname.php 23972 2011-05-03 16:26:36Z ralph $ + * @version $Id: Hostname.php 24307 2011-07-30 02:13:14Z adamlundrigan $ */ /** @@ -100,12 +100,12 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract /** * Allows all types of hostnames */ - const ALLOW_ALL = 7; + const ALLOW_URI = 8; /** * Allows all types of hostnames */ - const ALLOW_URI = 8; + const ALLOW_ALL = 15; /** * Array of valid top-level-domains @@ -495,7 +495,6 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract */ public function isValid($value) { - if (!is_string($value)) { $this->_error(self::INVALID); return false; @@ -503,7 +502,6 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract $this->_setValue($value); // Check input against IP address schema - if (preg_match('/^[0-9a-f:.]*$/i', $value) && $this->_options['ip']->setTranslator($this->getTranslator())->isValid($value)) { if (!($this->_options['allow'] & self::ALLOW_IP)) { @@ -521,16 +519,29 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract // necessary to distinguish between the complete domain name and // some local domain. // - // Strip trailing '.' since it is not necessary to validate a non-IP - // hostname. - // // (see ZF-6363) - if (substr($value, -1) === '.') { - $value = substr($value, 0, strlen($value)-1); - } - // Check input against DNS hostname schema + // Local hostnames are allowed to be partitial (ending '.') + if ($this->_options['allow'] & self::ALLOW_LOCAL) { + if (substr($value, -1) === '.') { + $value = substr($value, 0, -1); + if (substr($value, -1) === '.') { + // Empty hostnames (ending '..') are not allowed + $this->_error(self::INVALID_LOCAL_NAME); + return false; + } + } + } + $domainParts = explode('.', $value); + + // Prevent partitial IP V4 adresses (ending '.') + if ((count($domainParts) == 4) && preg_match('/^[0-9.a-e:.]*$/i', $value) && + $this->_options['ip']->setTranslator($this->getTranslator())->isValid($value)) { + $this->_error(self::INVALID_LOCAL_NAME); + } + + // Check input against DNS hostname schema if ((count($domainParts) > 1) && (strlen($value) >= 4) && (strlen($value) <= 254)) { $status = false; @@ -651,7 +662,7 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract } // Check input against local network name schema; last chance to pass validation - $regexLocal = '/^(([a-zA-Z0-9\x2d]{1,63}\x2e)*[a-zA-Z0-9\x2d]{1,63}){1,254}$/'; + $regexLocal = '/^(([a-zA-Z0-9\x2d]{1,63}\x2e)*[a-zA-Z0-9\x2d]{1,63}[\x2e]{0,1}){1,254}$/'; $status = @preg_match($regexLocal, $value); // If the input passes as a local network name, and local network names are allowed, then the diff --git a/library/Zend/Version.php b/library/Zend/Version.php index a34e2c14a..e9622d7e3 100644 --- a/library/Zend/Version.php +++ b/library/Zend/Version.php @@ -16,7 +16,7 @@ * @package Zend_Version * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Version.php 24230 2011-07-13 17:44:57Z matthew $ + * @version $Id: Version.php 24344 2011-08-02 19:49:32Z matthew $ */ /** @@ -32,7 +32,7 @@ final class Zend_Version /** * Zend Framework version identification - see compareVersion() */ - const VERSION = '1.11.9'; + const VERSION = '1.11.10'; /** * The latest stable version Zend Framework available diff --git a/library/Zend/XmlRpc/Value/DateTime.php b/library/Zend/XmlRpc/Value/DateTime.php index 29ac14b95..027ac6942 100644 --- a/library/Zend/XmlRpc/Value/DateTime.php +++ b/library/Zend/XmlRpc/Value/DateTime.php @@ -17,7 +17,7 @@ * @subpackage Value * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: DateTime.php 23775 2011-03-01 17:25:24Z ralph $ + * @version $Id: DateTime.php 24292 2011-07-28 21:25:22Z matthew $ */ @@ -69,13 +69,13 @@ class Zend_XmlRpc_Value_DateTime extends Zend_XmlRpc_Value_Scalar } elseif (is_numeric($value)) { // The value is numeric, we make sure it is an integer $this->_value = date($this->_phpFormatString, (int)$value); } else { - $timestamp = strtotime($value); - if ($timestamp === false || $timestamp == -1) { // cannot convert the value to a timestamp + $timestamp = new DateTime($value); + if ($timestamp === false) { // cannot convert the value to a timestamp require_once 'Zend/XmlRpc/Value/Exception.php'; throw new Zend_XmlRpc_Value_Exception('Cannot convert given value \''. $value .'\' to a timestamp'); } - $this->_value = date($this->_phpFormatString, $timestamp); // Convert the timestamp to iso8601 format + $this->_value = $timestamp->format($this->_phpFormatString); // Convert the timestamp to iso8601 format } }