Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of git://github.com/zendframework/zf2

  • Loading branch information...
commit cd3deb5b168bb23de6a94f73407c24679a891eae 2 parents d46a241 + edeeaff
@sgehrig sgehrig authored
Showing with 1,013 additions and 336 deletions.
  1. +39 −35 INSTALL.txt
  2. +5 −0 README-DEV.txt
  3. +15 −0 README.txt
  4. +2 −1  library/Zend/Amf/Server.php
  5. +1 −1  library/Zend/Application/Module/Bootstrap.php
  6. +5 −3 library/Zend/Application/Resource/Modules.php
  7. +1 −0  library/Zend/Controller/Action.php
  8. +16 −6 library/Zend/Controller/Action/Helper/FlashMessenger.php
  9. +1 −8 library/Zend/Controller/Action/Helper/Redirector.php
  10. +1 −1  library/Zend/Controller/Action/Helper/ViewRenderer.php
  11. +3 −3 library/Zend/Controller/Dispatcher/AbstractDispatcher.php
  12. +1 −1  library/Zend/Controller/Dispatcher/Standard.php
  13. +3 −3 library/Zend/Controller/Router/Rewrite.php
  14. +1 −1  library/Zend/Db/Table/AbstractRow.php
  15. +38 −3 library/Zend/Feed/Writer/AbstractFeed.php
  16. +1 −1  library/Zend/Feed/Writer/Feed.php
  17. +38 −2 library/Zend/Feed/Writer/Renderer/Entry/Atom.php
  18. +1 −1  library/Zend/Loader/PluginLoader.php
  19. +6 −2 library/Zend/Log/Filter/Priority.php
  20. +1 −1  library/Zend/Log/Writer/Db.php
  21. +14 −14 library/Zend/Log/Writer/Firebug.php
  22. +1 −1  library/Zend/Markup/Markup.php
  23. +1 −1  library/Zend/Markup/Parser/{BBCode.php → Bbcode.php}
  24. +24 −0 library/Zend/Markup/Parser/Textile.php
  25. +2 −6 library/Zend/Markup/Renderer/{HTML.php → Html.php}
  26. +6 −6 library/Zend/Markup/Renderer/Markup/{HTML/AbstractHTML.php → Html/AbstractHtml.php}
  27. +3 −3 library/Zend/Markup/Renderer/Markup/{HTML → Html}/Code.php
  28. +5 −5 library/Zend/Markup/Renderer/Markup/{HTML → Html}/Img.php
  29. +3 −3 library/Zend/Markup/Renderer/Markup/{HTML → Html}/ListItem.php
  30. +3 −3 library/Zend/Markup/Renderer/Markup/{HTML → Html}/Replace.php
  31. +5 −5 library/Zend/Markup/Renderer/Markup/{HTML/URL.php → Html/Url.php}
  32. +2 −2 library/Zend/Navigation/Page/Mvc.php
  33. +1 −1  library/Zend/Serializer/Serializer.php
  34. +74 −8 library/Zend/Session/Container.php
  35. +4 −2 library/Zend/Session/SessionManager.php
  36. +107 −0 library/Zend/Stdlib/SplPriorityQueue.php
  37. +78 −0 library/Zend/Stdlib/SplQueue.php
  38. +78 −0 library/Zend/Stdlib/SplStack.php
  39. +0 −4 library/Zend/Tool/Project/Context/Zf/ProjectProviderFile.php
  40. +2 −1  library/Zend/Tool/Project/Provider/Module.php
  41. +8 −8 tests/Zend/Application/Module/BootstrapTest.php
  42. +3 −3 tests/Zend/Application/Resource/FrontcontrollerTest.php
  43. +3 −3 tests/Zend/Application/Resource/ModulesTest.php
  44. +2 −1  tests/Zend/Application/TestAsset/ZfModuleBootstrap.php
  45. 0  tests/Zend/Application/TestAsset/modules/{default → application}/Bootstrap.php
  46. 0  tests/Zend/Application/TestAsset/modules/{default → application}/controllers/ErrorController.php
  47. +2 −1  tests/Zend/Application/TestAsset/modules/bar/Bootstrap.php
  48. +3 −1 tests/Zend/Application/TestAsset/modules/foo-bar/Bootstrap.php
  49. +2 −1  tests/Zend/Application/TestAsset/modules/foo/Bootstrap.php
  50. +2 −1  tests/Zend/Application/TestAsset/modules/zfappbootstrap/controllers/IndexController.php
  51. +2 −2 tests/Zend/Controller/Action/Helper/RedirectorTest.php
  52. +1 −1  tests/Zend/Controller/Action/Helper/UrlTest.php
  53. +36 −36 tests/Zend/Controller/Action/Helper/ViewRendererTest.php
  54. +12 −11 tests/Zend/Controller/Dispatcher/StandardTest.php
  55. +3 −3 tests/Zend/Controller/FrontTest.php
  56. +3 −3 tests/Zend/Controller/Plugin/ErrorHandlerTest.php
  57. +6 −6 tests/Zend/Controller/Router/RewriteTest.php
  58. +1 −1  tests/Zend/Controller/Router/Route/ChainTest.php
  59. +2 −1  tests/Zend/Controller/_files/Admin/BazController.php
  60. +3 −1 tests/Zend/Controller/_files/Admin/FooBarController.php
  61. +3 −1 tests/Zend/Controller/_files/Admin/FooController.php
  62. +1 −47 tests/Zend/Controller/_files/ManuallyIncludedControllers.php
  63. +23 −0 tests/Zend/Controller/_files/ManuallyIncludedControllersNamespaced.php
  64. +3 −1 tests/Zend/Controller/_files/modules/{default → application}/controllers/Admin/HelperController.php
  65. +3 −1 tests/Zend/Controller/_files/modules/{default → application}/views/helpers/SampleZfHelper.php
  66. 0  tests/Zend/Controller/_files/modules/{default → application}/views/scripts/admin/helper/render.phtml
  67. +2 −1  tests/Zend/Controller/_files/modules/bar/controllers/IndexController.php
  68. +2 −1  tests/Zend/Controller/_files/modules/foo/controllers/Admin/IndexController.php
  69. +2 −1  tests/Zend/Controller/_files/modules/foo/controllers/IndexController.php
  70. +3 −1 tests/Zend/Controller/_files/modules/foo/views/helpers/FooUseHelper.php
  71. +14 −0 tests/Zend/Feed/Writer/FeedTest.php
  72. +18 −0 tests/Zend/Feed/Writer/Renderer/Entry/AtomTest.php
  73. +0 −12 tests/Zend/Filter/StripTagsTest.php
  74. +2 −2 tests/Zend/Log/Filter/PriorityTest.php
  75. +7 −6 tests/Zend/Log/Writer/DbTest.php
  76. +7 −5 tests/Zend/Log/Writer/ZendMonitorTest.php
  77. +4 −4 tests/Zend/Markup/BBCodeAndHTMLTest.php
  78. +8 −0 tests/Zend/Markup/TestAsset/Parser/MockParser.php
  79. +1 −1  tests/Zend/Markup/TestAsset/Renderer/{HTML → Html}/Bar.php
  80. BIN  tests/Zend/Paginator/_files/test.sqlite
  81. +7 −7 tests/Zend/Serializer/SerializerTest.php
  82. +64 −0 tests/Zend/Session/ContainerTest.php
  83. +46 −0 tests/Zend/Stdlib/SplPriorityQueueTest.php
  84. +39 −0 tests/Zend/Stdlib/SplQueueTest.php
  85. +41 −0 tests/Zend/Stdlib/SplStackTest.php
  86. +1 −1  tests/Zend/View/Helper/ActionTest.php
  87. +1 −1  tests/Zend/View/Helper/Navigation/BreadcrumbsTest.php
  88. +1 −1  tests/Zend/View/Helper/Navigation/MenuTest.php
  89. +11 −11 tests/Zend/View/Helper/PartialLoopTest.php
  90. +7 −7 tests/Zend/View/Helper/PartialTest.php
  91. 0  tests/Zend/View/Helper/_files/modules/{default → application}/controllers/ActionBarController.php
  92. 0  tests/Zend/View/Helper/_files/modules/{default → application}/controllers/ActionFooController.php
  93. 0  tests/Zend/View/Helper/_files/modules/{default → application}/views/scripts/action-bar/baz.phtml
  94. 0  tests/Zend/View/Helper/_files/modules/{default → application}/views/scripts/action-foo/bar.phtml
  95. 0  tests/Zend/View/Helper/_files/modules/{default → application}/views/scripts/action-foo/baz.phtml
  96. 0  tests/Zend/View/Helper/_files/modules/{default → application}/views/scripts/partialActionCall.phtml
  97. 0  tests/Zend/View/Helper/_files/modules/{default → application}/views/scripts/partialLoop.phtml
  98. 0  tests/Zend/View/Helper/_files/modules/{default → application}/views/scripts/partialLoopCouter.phtml
  99. 0  tests/Zend/View/Helper/_files/modules/{default → application}/views/scripts/partialLoopObject.phtml
  100. 0  tests/Zend/View/Helper/_files/modules/{default → application}/views/scripts/partialObj.phtml
  101. 0  tests/Zend/View/Helper/_files/modules/{default → application}/views/scripts/partialOne.phtml
  102. 0  tests/Zend/View/Helper/_files/modules/{default → application}/views/scripts/partialThree.phtml
  103. 0  tests/Zend/View/Helper/_files/modules/{default → application}/views/scripts/partialVars.phtml
  104. +3 −1 tests/Zend/View/Helper/_files/modules/foo/controllers/BazController.php
  105. +3 −1 tests/Zend/View/Helper/_files/modules/foo/controllers/FooController.php
View
74 INSTALL.txt
@@ -1,68 +1,72 @@
INSTALLATION
------------
-Zend Framework requires no special installation steps. Simply download the framework,
-extract it to the folder you would like to keep it in, and add the library directory
-to your PHP include_path. To use components in the extras library, add the extras/library
-directory to your PHP include_path, as well.
-If you would like to use Zend_Tool, simply add bin/zf.bat (for Windows) or
-bin/zf.sh (for anything else) to your system executable path.
+Zend Framework requires no special installation steps. Simply download
+the framework, extract it to the folder you would like to keep it in,
+and add the library directory to your PHP include_path. To use
+components in the extras library, add the extras/library directory to
+your PHP include_path as well.
+
+If you would like to use Zend_Tool, simply add "bin/zf.bat" (for Windows)
+or "bin/zf.sh" (for anything else) to your system executable path.
SYSTEM REQUIREMENTS
-------------------
-Zend Framework requires PHP 5.2.4 or later. Please see the system requirements
-appendix for more detailed information:
+Zend Framework 2 requires PHP 5.3.1 or later.
-http://framework.zend.com/manual/en/requirements.html
DEVELOPMENT VERSIONS
--------------------
-If you would like to preview enhancements or bug fixes that have not yet been
-released, you can obtain the current development version of Zend Framework using one
-of the following methods:
+If you would like to preview enhancements or bug fixes that have not yet
+been released, you can obtain the current development version of Zend
+Framework using one of the following methods:
-* Using a Git client. Zend Framework is open source software, and the Git
- repository used for its development is publicly available. Consider using Git
- to get Zend Framework if you already use Git for your application development,
- want to contribute back to the framework, or need to upgrade your framework
- version very often.
+* Using a Git client. Zend Framework is open source software, and the
+ Git repository used for its development is publicly available.
+ Consider using Git to get Zend Framework if you already use Git for
+ your application development, want to contribute back to the
+ framework, or need to upgrade your framework version very often.
- Checking out a working copy is necessary if you would like to directly contribute
- to Zend Framework; a working copy can be updated any time using git pull.
+ Checking out a working copy is necessary if you would like to directly
+ contribute to Zend Framework; a working copy can be updated any time
+ using git pull.
To clone the git repository, use the following URL:
- git://git.zendframework.com/zf.git
+ git://git.zendframework.com/zf.git
For more information about Git, please see the official website:
- http://www.git-scm.org
+ http://www.git-scm.org
CONFIGURING THE INCLUDE PATH
----------------------------
-Once you have a copy of Zend Framework available, your application will need to
-access the framework classes. Though there are several ways to achieve this, your
-PHP include_path needs to contain the path to the Zend Framework classes under the
-/library directory in this distribution. You can find out more about the PHP
-include_path configuration directive here:
+Once you have a copy of Zend Framework available, your application will
+need to access the framework classes. Though there are several ways to
+achieve this, your PHP include_path needs to contain the path to the
+Zend Framework classes under the /library directory in this
+distribution. You can find out more about the PHP include_path
+configuration directive here:
-http://www.php.net/manual/en/ini.core.php#ini.include-path
+ http://www.php.net/manual/en/ini.core.php#ini.include-path
-Instructions on how to change PHP configuration directives can be found here:
+Instructions on how to change PHP configuration directives can be found
+here:
-http://www.php.net/manual/en/configuration.changes.php
+ http://www.php.net/manual/en/configuration.changes.php
GETTING STARTED
---------------
-A great place to get up-to-speed quickly is the Zend Framework QuickStart:
+A great place to get up-to-speed quickly is the Zend Framework
+QuickStart:
-http://framework.zend.com/manual/en/learning.quickstart.html
+ http://framework.zend.com/manual/en/learning.quickstart.html
-The QuickStart covers some of the most commonly used components of ZF. Since
-Zend Framework is designed with a use-at-will architecture and components are
-loosely coupled, you can select and use only those components that are needed for
-your project.
+The QuickStart covers some of the most commonly used components of ZF.
+Since Zend Framework is designed with a use-at-will architecture and
+components are loosely coupled, you can select and use only those
+components that are needed for your project.
View
5 README-DEV.txt
@@ -55,6 +55,11 @@ To run tests:
% phpunit --group Zend_Application
+ This will likely lead to errors, so it's usually best to specify a
+ specific component in which to run test:
+
+ % phpunit --group ZF-XYZ Zend/Application
+
You can turn on conditional tests with the TestConfiguration.php file.
To do so:
View
15 README.txt
@@ -7,6 +7,14 @@ Zend Framework 2.0.0dev1
THIS RELEASE IS A DEVELOPMENT RELEASE AND NOT INTENDED FOR PRODUCTION USE.
PLEASE USE AT YOUR OWN RISK.
+At this time, we have tested all functionality of Zend\Tool, and followed the
+Quick Start application instructions, and all functionality works as it did in
+the ZF1 series of releases. However, most Zend\Service components have not been
+migrated to namespaces, and Zend\Db has not been completely vetted (in favor of
+doing a complete refactor). Again, please use at your own risk, and be prepared
+for major changes in APIs in the development and alpha milestones prior to the
+first beta release.
+
NEW FEATURES
------------
@@ -24,6 +32,13 @@ INSTALLATION
Please see INSTALL.txt.
+CONTRIBUTING
+------------
+
+If you wish to contribute to Zend Framework 2.0, please make sure you have
+signed a CLA (http://framework.zend.com/cla), and please read both the
+README-DEV.txt and README-GIT.txt file.
+
QUESTIONS AND FEEDBACK
----------------------
View
3  library/Zend/Amf/Server.php
@@ -270,7 +270,8 @@ protected function _checkAcl($object, $function)
return true;
}
if($object) {
- $class = is_object($object) ? get_class($object) : $object;
+ $isObject = is_object($object);
+ $class = ($isObject) ? get_class($object) : $object;
if(!$this->_acl->hasResource($class)) {
$this->_acl->addResource(new \Zend\Acl\Resource\GenericResource($class));
}
View
2  library/Zend/Application/Module/Bootstrap.php
@@ -118,7 +118,7 @@ public function getModuleName()
{
if (empty($this->_moduleName)) {
$class = get_class($this);
- if (preg_match('/^([a-z][a-z0-9]*)_/i', $class, $matches)) {
+ if (preg_match('/^([a-z][a-z0-9]*)\\\\/i', $class, $matches)) {
$prefix = $matches[1];
} else {
$prefix = $class;
View
8 library/Zend/Application/Resource/Modules.php
@@ -25,6 +25,8 @@
*/
namespace Zend\Application\Resource;
+use Zend\Application\Exception as Exception;
+
/**
* Module bootstrapping resource
*
@@ -72,7 +74,7 @@ public function init()
$default = $front->getDefaultModule();
$curBootstrapClass = get_class($bootstrap);
foreach ($modules as $module => $moduleDirectory) {
- $bootstrapClass = $this->_formatModuleName($module) . '_Bootstrap';
+ $bootstrapClass = $this->_formatModuleName($module) . '\Bootstrap';
if (!class_exists($bootstrapClass, false)) {
$bootstrapPath = dirname($moduleDirectory) . '/Bootstrap.php';
if (file_exists($bootstrapPath)) {
@@ -81,14 +83,14 @@ public function init()
if (($default != $module)
&& !class_exists($bootstrapClass, false)
) {
- throw new xception(sprintf(
+ throw new Exception(sprintf(
$eMsgTpl, $module, $bootstrapClass
));
} elseif ($default == $module) {
if (!class_exists($bootstrapClass, false)) {
$bootstrapClass = 'Bootstrap';
if (!class_exists($bootstrapClass, false)) {
- throw new xception(sprintf(
+ throw new Exception(sprintf(
$eMsgTpl, $module, $bootstrapClass
));
}
View
1  library/Zend/Controller/Action.php
@@ -280,6 +280,7 @@ public function getViewScript($action = null, $noController = null)
$dispatcher = Front::getInstance()->getDispatcher();
$wordDelimiters = $dispatcher->getWordDelimiter();
$pathDelimiters = $dispatcher->getPathDelimiter();
+ $pathDelimiters = array($pathDelimiters, '_');
$this->_delimiters = array_unique(array_merge($wordDelimiters, (array) $pathDelimiters));
}
View
22 library/Zend/Controller/Action/Helper/FlashMessenger.php
@@ -23,7 +23,8 @@
* @namespace
*/
namespace Zend\Controller\Action\Helper;
-use Zend\Session;
+use Zend\Session,
+ Zend\Stdlib\SplQueue;
/**
* Flash Messenger - implement session-based messages
@@ -77,8 +78,15 @@ public function __construct()
{
if (!self::$_session instanceof Session\Container) {
self::$_session = new Session\Container($this->getName());
+
+ // Should not modify the iterator while iterating; aggregate
+ // namespaces so they may be deleted after retrieving messages.
+ $namespaces = array();
foreach (self::$_session as $namespace => $messages) {
self::$_messages[$namespace] = $messages;
+ $namespaces[] = $namespace;
+ }
+ foreach ($namespaces as $namespace) {
unset(self::$_session->{$namespace});
}
}
@@ -133,11 +141,13 @@ public function addMessage($message)
self::$_session->setExpirationHops(1, null, true);
}
- if (!is_array(self::$_session->{$this->_namespace})) {
- self::$_session->{$this->_namespace} = array();
+ if (!isset(self::$_session->{$this->_namespace})
+ || !(self::$_session->{$this->_namespace} instanceof SplQueue)
+ ) {
+ self::$_session->{$this->_namespace} = new SplQueue();
}
- self::$_session->{$this->_namespace}[] = $message;
+ self::$_session->{$this->_namespace}->push($message);
return $this;
}
@@ -160,7 +170,7 @@ public function hasMessages()
public function getMessages()
{
if ($this->hasMessages()) {
- return self::$_messages[$this->_namespace];
+ return self::$_messages[$this->_namespace]->toArray();
}
return array();
@@ -201,7 +211,7 @@ public function hasCurrentMessages()
public function getCurrentMessages()
{
if ($this->hasCurrentMessages()) {
- return self::$_session->{$this->_namespace};
+ return self::$_session->{$this->_namespace}->toArray();
}
return array();
View
9 library/Zend/Controller/Action/Helper/Redirector.php
@@ -299,7 +299,7 @@ public function setGotoSimple($action, $controller = null, $module = null, array
$params['action'] = $action;
$router = $this->getFrontController()->getRouter();
- $url = $router->assemble($params, 'default', true);
+ $url = $router->assemble($params, 'application', true);
$this->_redirect($url);
}
@@ -477,13 +477,6 @@ public function gotoUrlAndExit($url, array $options = array())
*/
public function redirectAndExit()
{
- if ($this->getCloseSessionOnExit()) {
- // Close session, if started
- if (isset($_SESSION) && !empty($_SESSION)) {
- session_write_close();
- }
- }
-
$this->getResponse()->sendHeaders();
exit();
}
View
2  library/Zend/Controller/Action/Helper/ViewRenderer.php
@@ -345,7 +345,7 @@ protected function _generateDefaultPrefix()
}
$module = $this->getModule();
- if ('default' == $module) {
+ if ('application' == $module) {
return $default;
}
View
6 library/Zend/Controller/Dispatcher/AbstractDispatcher.php
@@ -57,7 +57,7 @@
* Default module
* @var string
*/
- protected $_defaultModule = 'default';
+ protected $_defaultModule = 'application';
/**
* Front Controller instance
@@ -76,7 +76,7 @@
* Path delimiter character
* @var string
*/
- protected $_pathDelimiter = '_';
+ protected $_pathDelimiter = '\\';
/**
* Response object to pass to action controllers, if any
@@ -248,7 +248,7 @@ protected function _formatName($unformatted, $isAction = false)
$segments[$key] = str_replace(' ', '', ucwords($segment));
}
- return implode('_', $segments);
+ return implode('\\', $segments);
}
/**
View
2  library/Zend/Controller/Dispatcher/Standard.php
@@ -177,7 +177,7 @@ public function formatModuleName($unformatted)
*/
public function formatClassName($moduleName, $className)
{
- return $this->formatModuleName($moduleName) . '_' . $className;
+ return $this->formatModuleName($moduleName) . '\\' . $className;
}
/**
View
6 library/Zend/Controller/Router/Rewrite.php
@@ -91,14 +91,14 @@ class Rewrite extends AbstractRouter
*/
public function addDefaultRoutes()
{
- if (!$this->hasRoute('default')) {
+ if (!$this->hasRoute('application')) {
$dispatcher = $this->getFrontController()->getDispatcher();
$request = $this->getFrontController()->getRequest();
require_once 'Zend/Controller/Router/Route/Module.php';
$compat = new Route\Module(array(), $dispatcher, $request);
- $this->_routes = array_merge(array('default' => $compat), $this->_routes);
+ $this->_routes = array_merge(array('application' => $compat), $this->_routes);
}
return $this;
@@ -456,7 +456,7 @@ public function assemble($userParams, $name = null, $reset = false, $encode = tr
try {
$name = $this->getCurrentRouteName();
} catch (Exception $e) {
- $name = 'default';
+ $name = 'application';
}
}
View
2  library/Zend/Db/Table/AbstractRow.php
@@ -834,7 +834,7 @@ protected function _postDelete()
*/
protected function _prepareReference(AbstractTable $dependentTable, AbstractTable $parentTable, $ruleKey)
{
- $parentTableName = (get_class($parentTable) === 'Zend_Db_Table') ? $parentTable->getDefinitionConfigName() : get_class($parentTable);
+ $parentTableName = (get_class($parentTable) === 'Zend\Db\Table') ? $parentTable->getDefinitionConfigName() : get_class($parentTable);
$map = $dependentTable->getReference($parentTableName, $ruleKey);
if (!isset($map[AbstractTable::REF_COLUMNS])) {
View
41 library/Zend/Feed/Writer/AbstractFeed.php
@@ -25,6 +25,7 @@
namespace Zend\Feed\Writer;
use Zend\Uri;
use Zend\Date;
+use Zend\Validator;
/**
* @uses \Zend\Date\Date
@@ -32,8 +33,9 @@
* @uses \Zend\Feed\Writer\Writer
* @uses \Zend\Feed\Writer\Entry
* @uses \Zend\Feed\Writer\Renderer\Feed\Atom\Atom
-* @uses \Zend\Feed\Writer\Renderer\Feed\RSS
-* @uses \Zend\Uri\Uri
+* @uses \Zend\Feed\Writer\Renderer\Feed\Rss
+* @uses \Zend\Uri\Url
+* @uses \Zend\Validator\EmailAddress
* @category Zend
* @package Zend_Feed_Writer
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
@@ -267,11 +269,44 @@ public function setGenerator($name, $version = null, $uri = null)
public function setId($id)
{
if ((empty($id) || !is_string($id) || !Uri\Url::validate($id)) &&
- !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $id)) {
+ !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $id)
+ && !$this->_validateTagUri($id)) {
throw new Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI');
}
$this->_data['id'] = $id;
}
+
+ /**
+ * Validate a URI using the tag scheme (RFC 4151)
+ *
+ * @param string $id
+ * @return bool
+ */
+ protected function _validateTagUri($id)
+ {
+ if (preg_match('/^tag:(?<name>.*),(?<date>\d{4}-?\d{0,2}-?\d{0,2}):(?<specific>.*)(.*:)*$/', $id, $matches)) {
+ $dvalid = false;
+ $nvalid = false;
+ $date = $matches['date'];
+ $d6 = strtotime($date);
+ if ((strlen($date) == 4) && $date <= date('Y')) {
+ $dvalid = true;
+ } elseif ((strlen($date) == 7) && ($d6 < strtotime("now"))) {
+ $dvalid = true;
+ } elseif ((strlen($date) == 10) && ($d6 < strtotime("now"))) {
+ $dvalid = true;
+ }
+ $validator = new Validator\EmailAddress;
+ if ($validator->isValid($matches['name'])) {
+ $nvalid = true;
+ } else {
+ $nvalid = $validator->isValid('info@' . $matches['name']);
+ }
+ return $dvalid && $nvalid;
+
+ }
+ return false;
+ }
/**
* Set a feed image (URI at minimum). Parameter is a single array with the
View
2  library/Zend/Feed/Writer/Feed.php
@@ -37,7 +37,7 @@
* @uses \Zend\Feed\Writer\Feed\FeedAbstract
* @uses \Zend\Feed\Writer\Renderer\Feed\Atom\Atom
* @uses \Zend\Feed\Writer\Renderer\Feed\RSS
-* @uses \Zend\Uri\Uri
+* @uses \Zend\Uri\Url
* @category Zend
* @package Zend_Feed_Writer
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
View
40 library/Zend/Feed/Writer/Renderer/Entry/Atom.php
@@ -27,6 +27,7 @@
use Zend\Feed\Writer;
use Zend\Date;
use Zend\URI;
+use Zend\Validator;
/**
* @uses DOMDocument
@@ -36,7 +37,8 @@
* @uses \Zend\Feed\Writer\Renderer\Feed\Atom\Source
* @uses \Zend\Feed\Writer\Renderer\RendererAbstract
* @uses \Zend\Feed\Writer\Renderer\RendererInterface
-* @uses \Zend\Uri\Uri
+* @uses \Zend\Uri\Url
+* @uses \Zend\Validator
* @uses tidy
* @category Zend
* @package Zend_Feed_Writer
@@ -292,7 +294,9 @@ protected function _setId(\DOMDocument $dom, \DOMElement $root)
$this->getDataContainer()->getLink());
}
if (!URI\URL::validate($this->getDataContainer()->getId()) &&
- !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $this->getDataContainer()->getId())) {
+ !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#",
+ $this->getDataContainer()->getId()
+ ) && !$this->_validateTagUri($this->getDataContainer()->getId())) {
throw new Exception('Atom 1.0 IDs must be a valid URI/IRI');
}
$id = $dom->createElement('id');
@@ -302,6 +306,38 @@ protected function _setId(\DOMDocument $dom, \DOMElement $root)
}
/**
+ * Validate a URI using the tag scheme (RFC 4151)
+ *
+ * @param string $id
+ * @return bool
+ */
+ protected function _validateTagUri($id)
+ {
+ if (preg_match('/^tag:(?<name>.*),(?<date>\d{4}-?\d{0,2}-?\d{0,2}):(?<specific>.*)(.*:)*$/', $id, $matches)) {
+ $dvalid = false;
+ $nvalid = false;
+ $date = $matches['date'];
+ $d6 = strtotime($date);
+ if ((strlen($date) == 4) && $date <= date('Y')) {
+ $dvalid = true;
+ } elseif ((strlen($date) == 7) && ($d6 < strtotime("now"))) {
+ $dvalid = true;
+ } elseif ((strlen($date) == 10) && ($d6 < strtotime("now"))) {
+ $dvalid = true;
+ }
+ $validator = new Validator\EmailAddress;
+ if ($validator->isValid($matches['name'])) {
+ $nvalid = true;
+ } else {
+ $nvalid = $validator->isValid('info@' . $matches['name']);
+ }
+ return $dvalid && $nvalid;
+
+ }
+ return false;
+ }
+
+ /**
* Set entry content
*
* @param \DOMDocument $dom
View
2  library/Zend/Loader/PluginLoader.php
@@ -389,7 +389,7 @@ public function load($name, $throwExceptions = true)
foreach ($registry as $prefix => $paths) {
$className = $prefix . $name;
- if (class_exists($className, true)) {
+ if (class_exists($className, false)) {
$found = true;
break;
}
View
8 library/Zend/Log/Filter/Priority.php
@@ -55,7 +55,7 @@ class Priority extends AbstractFilter
* @param string $operator Comparison operator
* @throws \Zend\Log\Exception
*/
- public function __construct($priority, $operator = \NULL)
+ public function __construct($priority, $operator = null)
{
if (! is_integer($priority)) {
throw new \Zend\Log\Exception('Priority must be an integer');
@@ -85,8 +85,12 @@ static public function factory($config = array())
$config['priority'] = constant($config['priority']);
}
+ if (!is_numeric($config['priority'])) {
+ throw new \Zend\Log\Exception('Priority must be an integer.');
+ }
+
return new self(
- $config['priority'],
+ (int) $config['priority'],
$config['operator']
);
}
View
2  library/Zend/Log/Writer/Db.php
@@ -101,7 +101,7 @@ static public function factory($config = array())
/**
* Formatting is not possible on this writer
*/
- public function setFormatter(Zend_Log_Formatter_Interface $formatter)
+ public function setFormatter(\Zend\Log\Formatter $formatter)
{
throw new Log\Exception(get_class() . ' does not support formatting');
}
View
28 library/Zend/Log/Writer/Firebug.php
@@ -33,7 +33,7 @@
* @uses \Zend\Log\Logger
* @uses \Zend\Log\Formatter\Firebug
* @uses \Zend\Log\Writer\AbstractWriter
- * @uses \Zend\Wildfire\Plugin\FirePhp\FirePhp
+ * @uses \Zend\Wildfire\Plugin\FirePhp
* @category Zend
* @package Zend_Log
* @subpackage Writer
@@ -47,20 +47,20 @@ class Firebug extends AbstractWriter
* Maps logging priorities to logging display styles
* @var array
*/
- protected $_priorityStyles = array(Log\Logger::EMERG => FirePhp\FirePhp::ERROR,
- Log\Logger::ALERT => FirePhp\FirePhp::ERROR,
- Log\Logger::CRIT => FirePhp\FirePhp::ERROR,
- Log\Logger::ERR => FirePhp\FirePhp::ERROR,
- Log\Logger::WARN => FirePhp\FirePhp::WARN,
- Log\Logger::NOTICE => FirePhp\FirePhp::INFO,
- Log\Logger::INFO => FirePhp\FirePhp::INFO,
- Log\Logger::DEBUG => FirePhp\FirePhp::LOG);
+ protected $_priorityStyles = array(Log\Logger::EMERG => FirePhp::ERROR,
+ Log\Logger::ALERT => FirePhp::ERROR,
+ Log\Logger::CRIT => FirePhp::ERROR,
+ Log\Logger::ERR => FirePhp::ERROR,
+ Log\Logger::WARN => FirePhp::WARN,
+ Log\Logger::NOTICE => FirePhp::INFO,
+ Log\Logger::INFO => FirePhp::INFO,
+ Log\Logger::DEBUG => FirePhp::LOG);
/**
* The default logging style for un-mapped priorities
* @var string
*/
- protected $_defaultPriorityStyle = FirePhp\FirePhp::LOG;
+ protected $_defaultPriorityStyle = FirePhp::LOG;
/**
* Flag indicating whether the log writer is enabled
@@ -191,9 +191,9 @@ protected function _write($event)
$label = isset($event['firebugLabel'])?$event['firebugLabel']:null;
- FirePhp\FirePhp::getInstance()->send($message,
- $label,
- $type,
- array('traceOffset'=>6));
+ FirePhp::getInstance()->send($message,
+ $label,
+ $type,
+ array('traceOffset'=>6));
}
}
View
2  library/Zend/Markup/Markup.php
@@ -122,7 +122,7 @@ public static function addRendererPath($prefix, $path)
* @param array $options
* @return \Zend\Markup\Renderer\AbstractRenderer
*/
- public static function factory($parser, $renderer = 'HTML', array $options = array())
+ public static function factory($parser, $renderer = 'Html', array $options = array())
{
$parserClass = self::getParserLoader()->load($parser);
$rendererClass = self::getRendererLoader()->load($renderer);
View
2  library/Zend/Markup/Parser/BBCode.php → library/Zend/Markup/Parser/Bbcode.php
@@ -39,7 +39,7 @@
* @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 BBCode implements Parser
+class Bbcode implements Parser
{
const NEWLINE = "[newline\0]";
View
24 library/Zend/Markup/Parser/Textile.php
@@ -561,4 +561,28 @@ protected function _extractAttributes(array $matches)
return $attributes;
}
+ /**
+ * Build a tree with a certain strategy
+ *
+ * @todo IMPLEMENT
+ * @param array $tokens
+ * @param string $strategy
+ *
+ * @return \Zend\Markup\TokenList
+ */
+ public function buildTree(array $tokens, $strategy = 'default')
+ {
+ }
+
+ /**
+ * Tokenize a string
+ *
+ * @param string $value
+ *
+ * @todo IMPLEMENT
+ * @return array
+ */
+ public function tokenize($value)
+ {
+ }
}
View
8 library/Zend/Markup/Renderer/HTML.php → library/Zend/Markup/Renderer/Html.php
@@ -43,7 +43,7 @@
* @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 HTML extends AbstractRenderer
+class Html extends AbstractRenderer
{
/**
@@ -95,7 +95,7 @@ public function __construct($options = array())
}
$this->_pluginLoader = new PluginLoader(array(
- 'Zend\Markup\Renderer\Markup\HTML' => 'Zend/Markup/Renderer/Markup/HTML/'
+ 'Zend\Markup\Renderer\Markup\Html' => 'Zend/Markup/Renderer/Markup/Html/'
));
if (!isset($options['useDefaultMarkups']) && isset($options['useDefaultTags'])) {
@@ -220,10 +220,6 @@ protected function _defineDefaultMarkups()
),
// callback tags
'url' => array(
- 'type' => 16, // self::TYPE_ALIAS
- 'name' => 'URL',
- ),
- 'URL' => array(
'type' => 6, // self::TYPE_CALLBACK | self::TAG_NORMAL
'callback' => null,
'group' => 'inline',
View
12 ...kup/Renderer/Markup/HTML/AbstractHTML.php → ...kup/Renderer/Markup/Html/AbstractHtml.php
@@ -22,7 +22,7 @@
/**
* @namespace
*/
-namespace Zend\Markup\Renderer\Markup\HTML;
+namespace Zend\Markup\Renderer\Markup\Html;
use Zend\Markup\Renderer\Markup\AbstractMarkup,
Zend\Markup;
@@ -34,11 +34,11 @@
* @uses \Zend\Markup\Renderer\AbstractRenderer
* @category Zend
* @package Zend_Markup
- * @subpackage Renderer_Markup_HTML
+ * @subpackage Renderer_Markup_Html
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-abstract class AbstractHTML extends AbstractMarkup
+abstract class AbstractHtml extends AbstractMarkup
{
/**
@@ -54,7 +54,7 @@
*
* @param array $attributes
*
- * @return \Zend\Markup\Renderer\Markup\HTML\AbstractHTML
+ * @return \Zend\Markup\Renderer\Markup\Html\AbstractHtml
*/
public function setAttributes(array $attributes)
{
@@ -69,7 +69,7 @@ public function setAttributes(array $attributes)
* @param string $name
* @param string $value
*
- * @return \Zend\Markup\Renderer\Markup\HTML\AbstractHTML
+ * @return \Zend\Markup\Renderer\Markup\Html\AbstractHtml
*/
public function addAttribute($name, $value)
{
@@ -83,7 +83,7 @@ public function addAttribute($name, $value)
*
* @param string $name
*
- * @return \Zend\Markup\Renderer\Markup\HTML\AbstractHTML
+ * @return \Zend\Markup\Renderer\Markup\Html\AbstractHtml
*/
public function removeAttribute($name)
{
View
6 ...Zend/Markup/Renderer/Markup/HTML/Code.php → ...Zend/Markup/Renderer/Markup/Html/Code.php
@@ -23,13 +23,13 @@
/**
* @namespace
*/
-namespace Zend\Markup\Renderer\Markup\HTML;
+namespace Zend\Markup\Renderer\Markup\Html;
use Zend\Markup;
/**
* Code markup for HTML
*
- * @uses \Zend\Markup\Renderer\Markup\HTML\AbstractHTML
+ * @uses \Zend\Markup\Renderer\Markup\Html\AbstractHtml
* @uses \Zend\Markup\Token
* @category Zend
* @package Zend_Markup
@@ -37,7 +37,7 @@
* @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 Code extends AbstractHTML
+class Code extends AbstractHtml
{
/**
View
10 .../Zend/Markup/Renderer/Markup/HTML/Img.php → .../Zend/Markup/Renderer/Markup/Html/Img.php
@@ -23,15 +23,15 @@
/**
* @namespace
*/
-namespace Zend\Markup\Renderer\Markup\HTML;
+namespace Zend\Markup\Renderer\Markup\Html;
use Zend\Markup\Renderer\Markup;
use Zend\Markup\Token;
/**
* Image markup for HTML
*
- * @uses \Zend\Markup\Renderer\HTML
- * @uses \Zend\Markup\Renderer\Markup\HTML\AbstractHTML
+ * @uses \Zend\Markup\Renderer\Html
+ * @uses \Zend\Markup\Renderer\Markup\Html\AbstractHtml
* @uses \Zend\Markup\Token
* @category Zend
* @package Zend_Markup
@@ -39,7 +39,7 @@
* @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 Img extends AbstractHTML
+class Img extends AbstractHtml
{
/**
@@ -60,7 +60,7 @@ public function __invoke(Token $token, $text)
// check if the URL is valid
// TODO: use \Zend\Uri for this
- if (!\Zend\Markup\Renderer\HTML::isValidUri($uri)) {
+ if (!\Zend\Markup\Renderer\Html::isValidUri($uri)) {
return $text;
}
View
6 .../Markup/Renderer/Markup/HTML/ListItem.php → .../Markup/Renderer/Markup/Html/ListItem.php
@@ -23,13 +23,13 @@
/**
* @namespace
*/
-namespace Zend\Markup\Renderer\Markup\HTML;
+namespace Zend\Markup\Renderer\Markup\Html;
use Zend\Markup;
/**
* List item markup
*
- * @uses \Zend\Markup\Renderer\Markup\HTML\AbstractHTML
+ * @uses \Zend\Markup\Renderer\Markup\Html\AbstractHtml
* @uses \Zend\Markup\Token
* @category Zend
* @package Zend_Markup
@@ -37,7 +37,7 @@
* @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 ListItem extends AbstractHTML
+class ListItem extends AbstractHtml
{
/**
View
6 ...d/Markup/Renderer/Markup/HTML/Replace.php → ...d/Markup/Renderer/Markup/Html/Replace.php
@@ -22,13 +22,13 @@
/**
* @namespace
*/
-namespace Zend\Markup\Renderer\Markup\HTML;
+namespace Zend\Markup\Renderer\Markup\Html;
use Zend\Markup;
/**
* Simple replace markup for HTML
*
- * @uses \Zend\Markup\Renderer\Markup\HTML\AbstractHTML
+ * @uses \Zend\Markup\Renderer\Markup\Html\AbstractHtml
* @uses \Zend\Markup\Token
* @category Zend
* @package Zend_Markup
@@ -36,7 +36,7 @@
* @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 Replace extends AbstractHTML
+class Replace extends AbstractHtml
{
/**
View
10 .../Zend/Markup/Renderer/Markup/HTML/URL.php → .../Zend/Markup/Renderer/Markup/Html/Url.php
@@ -23,14 +23,14 @@
/**
* @namespace
*/
-namespace Zend\Markup\Renderer\Markup\HTML;
+namespace Zend\Markup\Renderer\Markup\Html;
use Zend\Markup\Token;
/**
* URL markup for HTML
*
- * @uses \Zend\Markup\Renderer\HTML
- * @uses \Zend\Markup\Renderer\Markup\HTML\AbstractHTML
+ * @uses \Zend\Markup\Renderer\Html
+ * @uses \Zend\Markup\Renderer\Markup\Html\AbstractHtml
* @uses \Zend\Markup\Token
* @category Zend
* @package Zend_Markup
@@ -38,7 +38,7 @@
* @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 URL extends AbstractHTML
+class Url extends AbstractHtml
{
/**
@@ -63,7 +63,7 @@ public function __invoke(Token $token, $text)
// check if the URL is valid
// TODO: use the new Zend\Uri for this
- if (!\Zend\Markup\Renderer\HTML::isValidUri($uri)) {
+ if (!\Zend\Markup\Renderer\Html::isValidUri($uri)) {
return $text;
}
View
4 library/Zend/Navigation/Page/Mvc.php
@@ -177,7 +177,7 @@ public function getHref()
if (null === self::$_urlHelper) {
self::$_urlHelper =
- \Zend\Controller\Action\HelperBroker::getStaticHelper('URL');
+ \Zend\Controller\Action\HelperBroker::getStaticHelper('url');
}
$params = $this->getParams();
@@ -197,7 +197,7 @@ public function getHref()
$url = self::$_urlHelper->__invoke($params,
$this->getRoute(),
$this->getResetParams());
-//var_dump($url);
+
return $this->_hrefCache = $url;
}
View
2  library/Zend/Serializer/Serializer.php
@@ -49,7 +49,7 @@ class Serializer
*
* @var string|Zend\Serializer\Adapter
*/
- protected static $_defaultAdapter = 'PHPSerialize';
+ protected static $_defaultAdapter = 'PhpSerialize';
/**
* Create a serializer adapter instance.
View
82 library/Zend/Session/Container.php
@@ -184,14 +184,18 @@ protected function _createContainer()
* If not, it raises an exception; otherwise, it returns the Storage
* object.
*
- * @return Storage
+ * @param bool $createContainer Whether or not to create the container for the namespace
+ * @return Storage|null Returns null only if $createContainer is false
* @throws Exception
*/
- protected function _verifyNamespace()
+ protected function _verifyNamespace($createContainer = true)
{
$storage = $this->_getStorage();
$name = $this->getName();
if (!isset($storage[$name])) {
+ if (!$createContainer) {
+ return;
+ }
$storage[$name] = $this->_createContainer();
}
if (!is_array($storage[$name]) && !$storage[$name] instanceof ArrayObject) {
@@ -205,16 +209,16 @@ protected function _verifyNamespace()
*
* Returns true if the key has expired, false otherwise.
*
- * @param string $key
+ * @param null|string $key
* @return bool
*/
- protected function _expireKeys($key)
+ protected function _expireKeys($key = null)
{
$storage = $this->_verifyNamespace();
$name = $this->getName();
// Return early if key not found
- if (!isset($storage[$name][$key])) {
+ if ((null !== $key) && !isset($storage[$name][$key])) {
return true;
}
@@ -243,6 +247,8 @@ protected function _expireKeys($key)
protected function _expireByExpiryTime(Storage $storage, $name, $key)
{
$metadata = $storage->getMetadata($name);
+
+ // Global container expiry
if (is_array($metadata)
&& isset($metadata['EXPIRE'])
&& ($_SERVER['REQUEST_TIME'] > $metadata['EXPIRE'])
@@ -253,7 +259,9 @@ protected function _expireByExpiryTime(Storage $storage, $name, $key)
return true;
}
- if (is_array($metadata)
+ // Expire individual key
+ if ((null !== $key)
+ && is_array($metadata)
&& isset($metadata['EXPIRE_KEYS'])
&& isset($metadata['EXPIRE_KEYS'][$key])
&& ($_SERVER['REQUEST_TIME'] > $metadata['EXPIRE_KEYS'][$key])
@@ -264,6 +272,23 @@ protected function _expireByExpiryTime(Storage $storage, $name, $key)
return true;
}
+ // Find any keys that have expired
+ if ((null === $key)
+ && is_array($metadata)
+ && isset($metadata['EXPIRE_KEYS'])
+ ) {
+ foreach (array_keys($metadata['EXPIRE_KEYS']) as $key) {
+ if ($_SERVER['REQUEST_TIME'] > $metadata['EXPIRE_KEYS'][$key]) {
+ unset($metadata['EXPIRE_KEYS'][$key]);
+ if (isset($storage[$name][$key])) {
+ unset($storage[$name][$key]);
+ }
+ }
+ }
+ $storage->setMetadata($name, $metadata, true);
+ return true;
+ }
+
return false;
}
@@ -282,6 +307,8 @@ protected function _expireByHops(Storage $storage, $name, $key)
{
$ts = $storage->getRequestAccessTime();
$metadata = $storage->getMetadata($name);
+
+ // Global container expiry
if (is_array($metadata)
&& isset($metadata['EXPIRE_HOPS'])
&& ($ts > $metadata['EXPIRE_HOPS']['ts'])
@@ -298,7 +325,9 @@ protected function _expireByHops(Storage $storage, $name, $key)
return false;
}
- if (is_array($metadata)
+ // Single key expiry
+ if ((null !== $key)
+ && is_array($metadata)
&& isset($metadata['EXPIRE_HOPS_KEYS'])
&& isset($metadata['EXPIRE_HOPS_KEYS'][$key])
&& ($ts > $metadata['EXPIRE_HOPS_KEYS'][$key]['ts'])
@@ -315,6 +344,27 @@ protected function _expireByHops(Storage $storage, $name, $key)
return false;
}
+ // Find all expired keys
+ if ((null === $key)
+ && is_array($metadata)
+ && isset($metadata['EXPIRE_HOPS_KEYS'])
+ ) {
+ foreach (array_keys($metadata['EXPIRE_HOPS_KEYS']) as $key) {
+ if ($ts > $metadata['EXPIRE_HOPS_KEYS'][$key]['ts']) {
+ $metadata['EXPIRE_HOPS_KEYS'][$key]['hops']--;
+ if (-1 === $metadata['EXPIRE_HOPS_KEYS'][$key]['hops']) {
+ unset($metadata['EXPIRE_HOPS_KEYS'][$key]);
+ $storage->setMetadata($name, $metadata, true);
+ unset($storage[$name][$key]);
+ continue;
+ }
+ $metadata['EXPIRE_HOPS_KEYS'][$key]['ts'] = $ts;
+ }
+ }
+ $storage->setMetadata($name, $metadata, true);
+ return false;
+ }
+
return false;
}
@@ -341,7 +391,10 @@ public function offsetSet($key, $value)
*/
public function offsetExists($key)
{
- $storage = $this->_verifyNamespace();
+ // If no container exists, we can't inspect it
+ if (null === ($storage = $this->_verifyNamespace(false))) {
+ return false;
+ }
$name = $this->getName();
// Return early if the key isn't set
@@ -386,6 +439,19 @@ public function offsetUnset($key)
}
/**
+ * Iterate over session container
+ *
+ * @return Iterator
+ */
+ public function getIterator()
+ {
+ $this->_expireKeys();
+ $storage = $this->_getStorage();
+ $container = $storage[$this->getName()];
+ return $container->getIterator();
+ }
+
+ /**
* Set expiration TTL
*
* Set the TTL for the entire container, a single key, or a set of keys.
View
6 library/Zend/Session/SessionManager.php
@@ -105,8 +105,10 @@ public function start()
// Since session is starting, we need to potentially repopulate our
// session storage
- if ($storage instanceof Storage\SessionStorage) {
- $storage->exchangeArray($_SESSION);
+ if ($storage instanceof Storage\SessionStorage
+ && $_SESSION !== $storage
+ ) {
+ $storage->fromArray($_SESSION);
$_SESSION = $storage;
}
}
View
107 library/Zend/Stdlib/SplPriorityQueue.php
@@ -0,0 +1,107 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Stdlib
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/**
+ * @namespace
+ */
+namespace Zend\Stdlib;
+
+/**
+ * Serializable version of SplPriorityQueue
+ *
+ * @category Zend
+ * @package Zend_Stdlib
+ * @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 SplPriorityQueue extends \SplPriorityQueue
+{
+ /**
+ * @var array Used for serialization
+ */
+ private $_data = array();
+
+ /**
+ * Serialize to an array
+ *
+ * Array will be priority => data pairs
+ *
+ * @return array
+ */
+ public function toArray()
+ {
+ $this->setExtractFlags(self::EXTR_BOTH);
+ $array = array();
+ while ($this->valid()) {
+ $array[] = $this->current();
+ $this->next();
+ }
+ $this->setExtractFlags(self::EXTR_DATA);
+
+ // Iterating through a priority queue removes items
+ foreach ($array as $item) {
+ $this->insert($item['data'], $item['priority']);
+ }
+
+ // Return only the data
+ $return = array();
+ foreach ($array as $item) {
+ $return[$item['priority']] = $item['data'];
+ }
+
+ return $return;
+ }
+
+ /**
+ * Serialize
+ *
+ * @return array
+ */
+ public function __sleep()
+ {
+ $this->_data = array();
+ $this->setExtractFlags(self::EXTR_BOTH);
+ while ($this->valid()) {
+ $this->_data[] = $this->current();
+ $this->next();
+ }
+ $this->setExtractFlags(self::EXTR_DATA);
+
+ // Iterating through a priority queue removes items
+ foreach ($this->_data as $item) {
+ $this->insert($item['data'], $item['priority']);
+ }
+
+ return array('_data');
+ }
+
+ /**
+ * Deserialize
+ *
+ * @return void
+ */
+ public function __wakeup()
+ {
+ foreach ($this->_data as $item) {
+ $this->insert($item['data'], $item['priority']);
+ }
+ $this->_data = array();
+ }
+}
View
78 library/Zend/Stdlib/SplQueue.php
@@ -0,0 +1,78 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Stdlib
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/**
+ * @namespace
+ */
+namespace Zend\Stdlib;
+
+/**
+ * Serializable version of SplQueue
+ *
+ * @category Zend
+ * @package Zend_Stdlib
+ * @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 SplQueue extends \SplQueue
+{
+ /**
+ * @var array Used for serialization
+ */
+ private $_data = array();
+
+ /**
+ * Return an array representing the queue
+ *
+ * @return array
+ */
+ public function toArray()
+ {
+ $array = array();
+ foreach ($this as $item) {
+ $array[] = $item;
+ }
+ return $array;
+ }
+
+ /**
+ * Serialize
+ *
+ * @return array
+ */
+ public function __sleep()
+ {
+ $this->_data = $this->toArray();
+ return array('_data');
+ }
+
+ /**
+ * Unserialize
+ *
+ * @return void
+ */
+ public function __wakeup()
+ {
+ foreach ($this->_data as $item) {
+ $this->push($item);
+ }
+ $this->_data = array();
+ }
+}
View
78 library/Zend/Stdlib/SplStack.php
@@ -0,0 +1,78 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Stdlib
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/**
+ * @namespace
+ */
+namespace Zend\Stdlib;
+
+/**
+ * Serializable version of SplStack
+ *
+ * @category Zend
+ * @package Zend_Stdlib
+ * @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 SplStack extends \SplStack
+{
+ /**
+ * @var array Used in serialization
+ */
+ private $_data = array();
+
+ /**
+ * Serialize to an array representing the stack
+ *
+ * @return void
+ */
+ public function toArray()
+ {
+ $array = array();
+ foreach ($this as $item) {
+ $array[] = $item;
+ }
+ return $array;
+ }
+
+ /**
+ * Serialize
+ *
+ * @return array
+ */
+ public function __sleep()
+ {
+ $this->_data = $this->toArray();
+ return array('_data');
+ }
+
+ /**
+ * Unserialize
+ *
+ * @return void
+ */
+ public function __wakeup()
+ {
+ foreach ($this->_data as $item) {
+ $this->unshift($item);
+ }
+ $this->_data = array();
+ }
+}
View
4 library/Zend/Tool/Project/Context/Zf/ProjectProviderFile.php
@@ -139,10 +139,6 @@ public function getContents()
}
$codeGenFile = new \Zend\CodeGenerator\Php\PhpFile(array(
- 'requiredFiles' => array(
- 'Zend/Tool/Project/Provider/Abstract.php',
- 'Zend/Tool/Project/Provider/Exception.php'
- ),
'classes' => array($class)
));
View
3  library/Zend/Tool/Project/Provider/Module.php
@@ -70,7 +70,7 @@ public static function createResources(\Zend\Tool\Project\Profile $profile, $mod
$targetModuleResource,
array(
'denyNames' => array('ModulesDirectory', 'ViewControllerScriptsDirectory'),
- 'denyType' => 'Zend_Tool_Project_Context_Filesystem_File'
+ 'denyType' => 'Zend\Tool\Project\Context\Filesystem\File'
)
);
@@ -81,6 +81,7 @@ public static function createResources(\Zend\Tool\Project\Profile $profile, $mod
$currentDepth = 0;
$parentResources = array();
$currentResource = $moduleDirectory;
+ $currentChildResource = null;
// loop through the target module skeleton
foreach ($targetIterator as $targetSubResource) {
View
16 tests/Zend/Application/Module/BootstrapTest.php
@@ -77,7 +77,7 @@ public function tearDown()
public function testConstructorShouldInitializeModuleResourceLoaderWithModulePrefix()
{
- $bootstrap = new \ZfModule_Bootstrap($this->application);
+ $bootstrap = new \ZfModule\Bootstrap($this->application);
$module = $bootstrap->getModuleName();
$loader = $bootstrap->getResourceLoader();
$this->assertNotNull($loader, "resource loader is unexpectedly NULL");
@@ -92,13 +92,13 @@ public function testConstructorShouldAcceptResourceLoaderInOptions()
));
$this->application->setOptions(array('resourceLoader' => $loader));
- $bootstrap = new \ZfModule_Bootstrap($this->application);
+ $bootstrap = new \ZfModule\Bootstrap($this->application);
$this->assertSame($loader, $bootstrap->getResourceLoader(), var_export($bootstrap->getOptions(), 1));
}
public function testModuleNameShouldBeFirstSegmentOfClassName()
{
- $bootstrap = new \ZfModule_Bootstrap($this->application);
+ $bootstrap = new \ZfModule\Bootstrap($this->application);
$this->assertEquals('ZfModule', $bootstrap->getModuleName());
}
@@ -111,7 +111,7 @@ public function testShouldPullModuleNamespacedOptionsWhenPresent()
)
);
$this->application->setOptions($options);
- $bootstrap = new \ZfModule_Bootstrap($this->application);
+ $bootstrap = new \ZfModule\Bootstrap($this->application);
$this->assertEquals('baz', $bootstrap->foo);
}
@@ -120,7 +120,7 @@ public function testShouldPullModuleNamespacedOptionsWhenPresent()
*/
public function testFrontControllerPluginResourceShouldBeRegistered()
{
- $bootstrap = new \ZfModule_Bootstrap($this->application);
+ $bootstrap = new \ZfModule\Bootstrap($this->application);
$this->assertTrue($bootstrap->hasPluginResource('FrontController'));
}
@@ -149,12 +149,12 @@ public function testFrontControllerStateRemainsSameIfNoOptionsPassedToModuleBoot
$appBootstrap = $this->application->getBootstrap();
$appBootstrap->bootstrap('FrontController');
$front = $appBootstrap->getResource('FrontController');
- $bootstrap = new \ZfModule_Bootstrap($appBootstrap);
+ $bootstrap = new \ZfModule\Bootstrap($appBootstrap);
$bootstrap->bootstrap('FrontController');
$test = $bootstrap->getResource('FrontController');
$this->assertSame($front, $test);
$this->assertEquals('/foo', $test->getBaseUrl());
- $this->assertEquals(__DIR__, $test->getControllerDirectory('default'));
+ $this->assertEquals(__DIR__, $test->getControllerDirectory('application'));
}
/**
@@ -179,7 +179,7 @@ public function testModuleBootstrapsShouldNotAcceptModuleResourceInOrderToPreven
$appBootstrap->bootstrap('Modules');
$modules = $appBootstrap->getResource('Modules');
foreach ($modules as $module => $bootstrap) {
- if ($module == 'default') {
+ if ($module == 'application') {
// "default" module gets lumped in, and is not a Module_Bootstrap
continue;
}
View
6 tests/Zend/Application/Resource/FrontcontrollerTest.php
@@ -96,7 +96,7 @@ public function testShouldSetControllerDirectoryWhenStringOptionPresent()
));
$resource->init();
$front = $resource->getFrontController();
- $dir = $front->getControllerDirectory('default');
+ $dir = $front->getControllerDirectory('application');
$this->assertEquals(__DIR__, $dir);
}
@@ -157,9 +157,9 @@ public function testShouldSetModuleDirectoryWhenOptionPresent()
'bar' => __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR
. 'TestAsset' . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR
. 'bar' . DIRECTORY_SEPARATOR . 'controllers',
- 'default' => __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR
+ 'application' => __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR
. 'TestAsset' . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR
- . 'default' . DIRECTORY_SEPARATOR . 'controllers',
+ . 'application' . DIRECTORY_SEPARATOR . 'controllers',
'foo-bar' => __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR
. 'TestAsset' . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR
. 'foo-bar' . DIRECTORY_SEPARATOR . 'controllers',
View
6 tests/Zend/Application/Resource/ModulesTest.php
@@ -36,7 +36,7 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
* @group Zend_Application
*/
-class ModulesResourceTest extends \PHPUnit_Framework_TestCase
+class ModulesTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
@@ -133,7 +133,7 @@ public function testInitializationShouldSkipModulesWithoutBootstraps()
$this->assertArrayHasKey('bar', (array)$bootstraps);
$this->assertArrayHasKey('foo-bar', (array)$bootstraps);
$this->assertArrayHasKey('foo', (array)$bootstraps);
- $this->assertArrayHasKey('default', (array)$bootstraps);
+ $this->assertArrayHasKey('application', (array)$bootstraps);
}
/**
@@ -153,6 +153,6 @@ public function testShouldReturnExecutedBootstrapsWhenComplete()
$this->assertArrayHasKey('bar', (array)$bootstraps);
$this->assertArrayHasKey('foo-bar', (array)$bootstraps);
$this->assertArrayHasKey('foo', (array)$bootstraps);
- $this->assertArrayHasKey('default', (array)$bootstraps);
+ $this->assertArrayHasKey('application', (array)$bootstraps);
}
}
View
3  tests/Zend/Application/TestAsset/ZfModuleBootstrap.php
@@ -20,6 +20,7 @@
* @version $Id$
*/
+namespace ZfModule;
use Zend\Application\Module\Bootstrap as ModuleBootstrap;
/**
@@ -29,7 +30,7 @@
* @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 ZfModule_Bootstrap extends ModuleBootstrap
+class Bootstrap extends ModuleBootstrap
{
public function run()
{
View
0  ...n/TestAsset/modules/default/Bootstrap.php → ...stAsset/modules/application/Bootstrap.php
File renamed without changes
View
0  ...s/default/controllers/ErrorController.php → ...plication/controllers/ErrorController.php
File renamed without changes
View
3  tests/Zend/Application/TestAsset/modules/bar/Bootstrap.php
@@ -20,6 +20,7 @@
* @version $Id$
*/
+namespace Bar;
use Zend\Application\Module\Bootstrap as ModuleBootstrap;
/**
@@ -29,7 +30,7 @@
* @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 Bar_Bootstrap extends ModuleBootstrap
+class Bootstrap extends ModuleBootstrap
{
public $bootstrapped = false;
View
4 tests/Zend/Application/TestAsset/modules/foo-bar/Bootstrap.php
@@ -20,6 +20,8 @@
* @version $Id$
*/
+namespace FooBar;
+
use Zend\Application\Module\Bootstrap as ModuleBootstrap;
/**
@@ -29,7 +31,7 @@
* @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 FooBar_Bootstrap extends ModuleBootstrap
+class Bootstrap extends ModuleBootstrap
{
public $bootstrapped = false;
View
3  tests/Zend/Application/TestAsset/modules/foo/Bootstrap.php
@@ -20,6 +20,7 @@
* @version $Id$
*/
+namespace Foo;
use Zend\Application\Module\Bootstrap as ModuleBootstrap;
/**
@@ -29,7 +30,7 @@
* @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 Foo_Bootstrap extends ModuleBootstrap
+class Bootstrap extends ModuleBootstrap
{
public $bootstrapped = false;
View
3  tests/Zend/Application/TestAsset/modules/zfappbootstrap/controllers/IndexController.php
@@ -20,6 +20,7 @@
* @version $Id$
*/
+namespace Zfappbootstrap;
use Zend\Controller\Action as ActionController;
/**
@@ -29,7 +30,7 @@
* @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 Zfappbootstrap_IndexController extends ActionController
+class IndexController extends ActionController
{
public function indexAction()
{
View
4 tests/Zend/Controller/Action/Helper/RedirectorTest.php
@@ -237,7 +237,7 @@ public function testSetGotoWithActionControllerModuleAndParams()
public function testGotoDoesNotUtilizeDefaultSegments()
{
$request = $this->request;
- $request->setModuleName('default');
+ $request->setModuleName('application');
$this->redirector->setGoto('index', 'index');
$this->assertEquals('/', $this->redirector->getRedirectUrl());
@@ -451,7 +451,7 @@ public function testPassingDefaultModuleShouldNotRenderModuleNameInRedirectUrl()
$this->request->setModuleName('admin')
->setControllerName('class')
->setActionName('view');
- $this->redirector->gotoSimple('login', 'account', 'default');
+ $this->redirector->gotoSimple('login', 'account', 'application');
$test = $this->redirector->getRedirectUrl();
$this->assertEquals('/account/login', $test, $test);
}