Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Resolve conflicts

  • Loading branch information...
commit 2c48be785e3c2b80d032d19d144017f52cc72af5 2 parents 0abbba9 + 5b1496d
@bakura10 authored
Showing with 7,739 additions and 569 deletions.
  1. +4 −199 CHANGELOG.md
  2. +1 −1  library/Zend/Barcode/Barcode.php
  3. +1 −1  library/Zend/Cache/PatternFactory.php
  4. +1 −1  library/Zend/Cache/StorageFactory.php
  5. +36 −0 library/Zend/Code/Generator/ClassGenerator.php
  6. +49 −105 library/Zend/Code/Scanner/ClassScanner.php
  7. +1 −1  library/Zend/Code/Scanner/MethodScanner.php
  8. +284 −0 library/Zend/Code/Scanner/PropertyScanner.php
  9. +127 −0 library/Zend/Config/Factory.php
  10. +29 −0 library/Zend/Config/WriterPluginManager.php
  11. +0 −4 library/Zend/Crypt/Hmac.php
  12. +345 −0 library/Zend/Crypt/Key/Derivation/Scrypt.php
  13. +27 −1 library/Zend/Crypt/Password/Bcrypt.php
  14. +11 −1 library/Zend/Db/Sql/AbstractSql.php
  15. +1 −0  library/Zend/Filter/FilterPluginManager.php
  16. +150 −0 library/Zend/Filter/UriNormalize.php
  17. +2 −1  library/Zend/Filter/composer.json
  18. +43 −0 library/Zend/Form/Annotation/AbstractArrayOrStringAnnotation.php
  19. +2 −2 library/Zend/Form/Annotation/Hydrator.php
  20. +176 −0 library/Zend/Form/Element/DateSelect.php
  21. +313 −0 library/Zend/Form/Element/MonthSelect.php
  22. +21 −5 library/Zend/Form/Factory.php
  23. +28 −13 library/Zend/Form/View/Helper/FormCollection.php
  24. +109 −0 library/Zend/Form/View/Helper/FormDateSelect.php
  25. +10 −0 library/Zend/Form/View/Helper/FormElement.php
  26. +283 −0 library/Zend/Form/View/Helper/FormMonthSelect.php
  27. +2 −0  library/Zend/Form/View/HelperConfig.php
  28. +10 −7 library/Zend/I18n/View/Helper/DateFormat.php
  29. +84 −0 library/Zend/I18n/View/Helper/Plural.php
  30. +1 −0  library/Zend/I18n/View/HelperConfig.php
  31. +32 −2 library/Zend/Loader/ModuleAutoloader.php
  32. +51 −0 library/Zend/Log/Formatter/ChromePhp.php
  33. +105 −0 library/Zend/Log/Writer/ChromePhp.php
  34. +71 −0 library/Zend/Log/Writer/ChromePhp/ChromePhpBridge.php
  35. +54 −0 library/Zend/Log/Writer/ChromePhp/ChromePhpInterface.php
  36. +168 −0 library/Zend/Log/Writer/FingersCrossed.php
  37. +9 −8 library/Zend/Log/WriterPluginManager.php
  38. +21 −0 library/Zend/Mail/Message.php
  39. +1 −1  library/Zend/Math/BigInteger/BigInteger.php
  40. +27 −0 library/Zend/ModuleManager/Feature/FilterProviderInterface.php
  41. +27 −0 library/Zend/ModuleManager/Feature/ValidatorProviderInterface.php
  42. +6 −16 library/Zend/ModuleManager/Listener/ConfigListener.php
  43. +1 −3 library/Zend/ModuleManager/Listener/DefaultListenerAggregate.php
  44. +72 −4 library/Zend/ModuleManager/Listener/ListenerOptions.php
  45. +3 −3 library/Zend/ModuleManager/Listener/LocatorRegistrationListener.php
  46. +140 −0 library/Zend/ModuleManager/Listener/ModuleLoaderListener.php
  47. +5 −3 library/Zend/ModuleManager/Listener/ModuleResolverListener.php
  48. +64 −0 library/Zend/Mvc/Controller/Plugin/Identity.php
  49. +10 −1 library/Zend/Mvc/Controller/Plugin/Redirect.php
  50. +11 −0 library/Zend/Mvc/Controller/PluginManager.php
  51. +7 −10 library/Zend/Mvc/Service/AbstractPluginManagerFactory.php
  52. +1 −7 library/Zend/Mvc/Service/ControllerLoaderFactory.php
  53. +42 −0 library/Zend/Mvc/Service/DiAbstractServiceFactoryFactory.php
  54. +3 −11 library/Zend/Mvc/Service/DiFactory.php
  55. +42 −0 library/Zend/Mvc/Service/DiServiceInitializerFactory.php
  56. +44 −0 library/Zend/Mvc/Service/DiStrictAbstractServiceFactoryFactory.php
  57. +36 −0 library/Zend/Mvc/Service/FilterManagerFactory.php
  58. +12 −0 library/Zend/Mvc/Service/ModuleManagerFactory.php
  59. +25 −20 library/Zend/Mvc/Service/ServiceListenerFactory.php
  60. +36 −0 library/Zend/Mvc/Service/ValidatorManagerFactory.php
  61. +1 −1  library/Zend/Permissions/Acl/Acl.php
  62. +57 −0 library/Zend/Permissions/Acl/AclInterface.php
  63. +102 −0 library/Zend/Permissions/Rbac/AbstractIterator.php
  64. +124 −0 library/Zend/Permissions/Rbac/AbstractRole.php
  65. +27 −0 library/Zend/Permissions/Rbac/AssertionInterface.php
  66. +19 −0 library/Zend/Permissions/Rbac/Exception/ExceptionInterface.php
  67. +20 −0 library/Zend/Permissions/Rbac/Exception/InvalidArgumentException.php
  68. +159 −0 library/Zend/Permissions/Rbac/Rbac.php
  69. +27 −0 library/Zend/Permissions/Rbac/Role.php
  70. +91 −0 library/Zend/Serializer/Adapter/MsgPack.php
  71. +1 −0  library/Zend/Serializer/AdapterPluginManager.php
  72. +1 −1  library/Zend/Serializer/Serializer.php
  73. +0 −3  library/Zend/ServiceManager/AbstractPluginManager.php
  74. +201 −0 library/Zend/Session/SaveHandler/MongoDB.php
  75. +260 −0 library/Zend/Session/SaveHandler/MongoDBOptions.php
  76. +5 −5 library/Zend/Stdlib/AbstractOptions.php
  77. +16 −2 library/Zend/Stdlib/Hydrator/AbstractHydrator.php
  78. +42 −3 library/Zend/Stdlib/Hydrator/ClassMethods.php
  79. +25 −0 library/Zend/Stdlib/Hydrator/HydratorOptionsInterface.php
  80. +128 −0 library/Zend/Stdlib/Hydrator/Strategy/SerializableStrategy.php
  81. +1 −1  library/Zend/Tag/Cloud/DecoratorPluginManager.php
  82. +17 −0 library/Zend/Uri/UriFactory.php
  83. +112 −0 library/Zend/Validator/IsInstanceOf.php
  84. +1 −0  library/Zend/Validator/ValidatorPluginManager.php
  85. +1 −1  library/Zend/Version/Version.php
  86. +31 −1 library/Zend/View/Helper/HeadLink.php
  87. +65 −0 library/Zend/View/Helper/Identity.php
  88. +7 −7 library/Zend/View/Helper/Navigation/AbstractHelper.php
  89. +3 −3 library/Zend/View/Helper/Navigation/HelperInterface.php
  90. +2 −0  library/Zend/View/Helper/Placeholder/Container/AbstractContainer.php
  91. +11 −0 library/Zend/View/HelperPluginManager.php
  92. +6 −0 tests/ZendTest/Code/Annotation/TestAsset/EntityWithAnnotations.php
  93. +15 −0 tests/ZendTest/Code/Generator/ClassGeneratorTest.php
  94. +39 −3 tests/ZendTest/Code/Scanner/ClassScannerTest.php
  95. +47 −0 tests/ZendTest/Code/Scanner/PropertyScannerTest.php
  96. +8 −0 tests/ZendTest/Code/TestAsset/FooClass.php
  97. +91 −1 tests/ZendTest/Config/FactoryTest.php
  98. +22 −0 tests/ZendTest/Config/Writer/TestAssets/DummyWriter.php
  99. +0 −7 tests/ZendTest/Crypt/HmacTest.php
  100. +196 −0 tests/ZendTest/Crypt/Key/Derivation/ScryptTest.php
  101. +16 −0 tests/ZendTest/Crypt/Password/BcryptTest.php
  102. +46 −0 tests/ZendTest/Filter/FilterPluginManagerTest.php
  103. +70 −0 tests/ZendTest/Filter/UriNormalizeTest.php
  104. +11 −0 tests/ZendTest/Form/Annotation/AnnotationBuilderTest.php
  105. +53 −0 tests/ZendTest/Form/Element/DateSelectTest.php
  106. +84 −0 tests/ZendTest/Form/Element/MonthSelectTest.php
  107. +16 −0 tests/ZendTest/Form/FactoryTest.php
  108. +26 −0 tests/ZendTest/Form/TestAsset/Annotation/EntityWithHydratorArray.php
  109. +9 −0 tests/ZendTest/Form/View/Helper/FormCollectionTest.php
  110. +69 −0 tests/ZendTest/Form/View/Helper/FormDateSelectTest.php
  111. +69 −0 tests/ZendTest/Form/View/Helper/FormMonthSelectTest.php
  112. +1 −0  tests/ZendTest/I18n/Validator/FloatTest.php
  113. +58 −4 tests/ZendTest/I18n/View/Helper/DateFormatTest.php
  114. +68 −0 tests/ZendTest/I18n/View/Helper/PluralTest.php
  115. +13 −1 tests/ZendTest/Loader/ModuleAutoloaderTest.php
  116. +15 −0 tests/ZendTest/Loader/_files/BarModule/Module.php
  117. BIN  tests/ZendTest/Loader/_files/PharModuleMap.phar
  118. +1 −0  tests/ZendTest/Loader/_files/_buildPhars.php
  119. +46 −0 tests/ZendTest/Log/TestAsset/MockChromePhp.php
  120. +83 −0 tests/ZendTest/Log/Writer/ChromePhpTest.php
  121. +57 −0 tests/ZendTest/Log/Writer/FingersCrossedTest.php
  122. +103 −91 tests/ZendTest/Mail/MessageTest.php
  123. +27 −1 tests/ZendTest/ModuleManager/Listener/ListenerOptionsTest.php
  124. +96 −0 tests/ZendTest/ModuleManager/Listener/ModuleLoaderListenerTest.php
  125. +47 −0 tests/ZendTest/Mvc/Controller/Plugin/IdentityTest.php
  126. +25 −0 tests/ZendTest/Mvc/Controller/Plugin/RedirectTest.php
  127. +34 −0 tests/ZendTest/Mvc/Controller/Plugin/TestAsset/AuthenticationAdapter.php
  128. +61 −0 tests/ZendTest/Mvc/Controller/Plugin/TestAsset/IdentityObject.php
  129. +18 −1 tests/ZendTest/Mvc/Controller/PluginManagerTest.php
  130. +6 −0 tests/ZendTest/Mvc/Service/ControllerLoaderFactoryTest.php
  131. +27 −0 tests/ZendTest/Mvc/Service/DiFactoryTest.php
  132. +144 −0 tests/ZendTest/Permissions/Rbac/RbacTest.php
  133. +45 −0 tests/ZendTest/Permissions/Rbac/TestAsset/RoleMustMatchAssertion.php
  134. +34 −0 tests/ZendTest/Permissions/Rbac/TestAsset/SimpleFalseAssertion.php
  135. +34 −0 tests/ZendTest/Permissions/Rbac/TestAsset/SimpleTrueAssertion.php
  136. +154 −0 tests/ZendTest/Serializer/Adapter/MsgPackTest.php
  137. +146 −0 tests/ZendTest/Session/SaveHandler/MongoDBOptionsTest.php
  138. +158 −0 tests/ZendTest/Session/SaveHandler/MongoDBTest.php
  139. +45 −0 tests/ZendTest/Stdlib/HydratorTest.php
  140. +30 −1 tests/ZendTest/Stdlib/OptionsTest.php
  141. +53 −0 tests/ZendTest/Stdlib/Strategy/SerializableStrategyTest.php
  142. +108 −0 tests/ZendTest/Validator/IsInstanceOfTest.php
  143. +1 −0  tests/ZendTest/Validator/ValidatorChainTest.php
  144. +76 −0 tests/ZendTest/Validator/ValidatorPluginManagerTest.php
  145. +16 −0 tests/ZendTest/View/Helper/HeadLinkTest.php
  146. +51 −0 tests/ZendTest/View/Helper/IdentityTest.php
  147. +20 −0 tests/ZendTest/View/Helper/Placeholder/ContainerTest.php
  148. +34 −0 tests/ZendTest/View/Helper/TestAsset/AuthenticationAdapter.php
  149. +61 −0 tests/ZendTest/View/Helper/TestAsset/IdentityObject.php
  150. +16 −0 tests/ZendTest/View/HelperPluginManagerTest.php
View
203 CHANGELOG.md
@@ -1,205 +1,10 @@
# CHANGELOG
-## 2.0.3:
+## 2.1.0:
-- 2244: Fix for issue ZF2-503 (https://github.com/zendframework/zf2/issues/2244)
-- 2318: Allow to remove decimals in CurrencyFormat
- (https://github.com/zendframework/zf2/issues/2318)
-- 2363: Hotfix db features with eventfeature
- (https://github.com/zendframework/zf2/issues/2363)
-- 2380: ZF2-482 Attempt to fix the buffer. Also added extra unit tests.
- (https://github.com/zendframework/zf2/issues/2380)
-- 2392: Update library/Zend/Db/Adapter/Platform/Mysql.php
- (https://github.com/zendframework/zf2/issues/2392)
-- 2395: Fix for http://framework.zend.com/issues/browse/ZF2-571
- (https://github.com/zendframework/zf2/issues/2395)
-- 2397: Memcached option merge issuse
- (https://github.com/zendframework/zf2/issues/2397)
-- 2402: Adding missing dependencies
- (https://github.com/zendframework/zf2/issues/2402)
-- 2404: Fix to comments (https://github.com/zendframework/zf2/issues/2404)
-- 2416: Fix expressionParamIndex for AbstractSql
- (https://github.com/zendframework/zf2/issues/2416)
-- 2420: Zend\Db\Sql\Select: Fixed issue with join expression named parameters
- overlapping. (https://github.com/zendframework/zf2/issues/2420)
-- 2421: Update library/Zend/Http/Header/SetCookie.php
- (https://github.com/zendframework/zf2/issues/2421)
-- 2422: fix add 2 space after @param in Zend\Loader
- (https://github.com/zendframework/zf2/issues/2422)
-- 2423: ManagerInterface must be interface, remove 'interface' description
- (https://github.com/zendframework/zf2/issues/2423)
-- 2425: Use built-in Travis composer
- (https://github.com/zendframework/zf2/issues/2425)
-- 2426: Remove need of setter in ClassMethods hydrator
- (https://github.com/zendframework/zf2/issues/2426)
-- 2432: Prevent space before end of tag with HTML5 doctype
- (https://github.com/zendframework/zf2/issues/2432)
-- 2433: fix for setJsonpCallback not called when recieved JsonModel + test
- (https://github.com/zendframework/zf2/issues/2433)
-- 2434: added phpdoc in Zend\Db
- (https://github.com/zendframework/zf2/issues/2434)
-- 2437: Hotfix/console 404 reporting
- (https://github.com/zendframework/zf2/issues/2437)
-- 2438: Improved previous fix for ZF2-558.
- (https://github.com/zendframework/zf2/issues/2438)
-- 2440: Turkish Translations for Captcha and Validate
- (https://github.com/zendframework/zf2/issues/2440)
-- 2441: Allow form collection to have any helper
- (https://github.com/zendframework/zf2/issues/2441)
-- 2516: limit(20) -> generates LIMIT '20' and throws an IllegalQueryException
- (https://github.com/zendframework/zf2/issues/2516)
-- 2545: getSqlStringForSqlObject() returns an invalid SQL statement with LIMIT
- and OFFSET clauses (https://github.com/zendframework/zf2/issues/2545)
-- 2595: Pgsql adapater has codes related to MySQL
- (https://github.com/zendframework/zf2/issues/2595)
-- 2613: Prevent password to be rendered if form validation fails
- (https://github.com/zendframework/zf2/issues/2613)
-- 2617: Fixed Zend\Validator\Iban class name
- (https://github.com/zendframework/zf2/issues/2617)
-- 2619: Form enctype fix when File elements are within a collection
- (https://github.com/zendframework/zf2/issues/2619)
-- 2620: InputFilter/Input when merging was not using raw value
- (https://github.com/zendframework/zf2/issues/2620)
-- 2622: Added ability to specify port
- (https://github.com/zendframework/zf2/issues/2622)
-- 2624: Form's default input filters added multiple times
- (https://github.com/zendframework/zf2/issues/2624)
-- 2630: fix relative link ( remove the relative links ) in README.md
- (https://github.com/zendframework/zf2/issues/2630)
-- 2631: Update library/Zend/Loader/AutoloaderFactory.php
- (https://github.com/zendframework/zf2/issues/2631)
-- 2633: fix redundance errors "The input does not appear to be a valid date"
- show twice (https://github.com/zendframework/zf2/issues/2633)
-- 2635: Fix potential issue with Sitemap test
- (https://github.com/zendframework/zf2/issues/2635)
-- 2636: add isset checks around timeout and maxredirects
- (https://github.com/zendframework/zf2/issues/2636)
-- 2641: hotfix : formRow() element error multi-checkbox and radio renderError
- not shown (https://github.com/zendframework/zf2/issues/2641)
-- 2642: Fix Travis build for CS issue
- (https://github.com/zendframework/zf2/issues/2642)
-- 2643: fix for setJsonpCallback not called when recieved JsonModel + test
- (https://github.com/zendframework/zf2/issues/2643)
-- 2644: Add fluidity to the prepare() function for a form
- (https://github.com/zendframework/zf2/issues/2644)
-- 2652: Zucchi/filter tweaks (https://github.com/zendframework/zf2/issues/2652)
-- 2665: pdftest fix (https://github.com/zendframework/zf2/issues/2665)
-- 2666: fixed url change (https://github.com/zendframework/zf2/issues/2666)
-- 2667: Possible fix for rartests
- (https://github.com/zendframework/zf2/issues/2667)
-- 2669: skip whem gmp is loaded
- (https://github.com/zendframework/zf2/issues/2669)
-- 2673: Input fallback value option
- (https://github.com/zendframework/zf2/issues/2673)
-- 2676: mysqli::close() never called
- (https://github.com/zendframework/zf2/issues/2676)
-- 2677: added phpdoc to Zend\Stdlib
- (https://github.com/zendframework/zf2/issues/2677)
-- 2678: Zend\Db\Adapter\Sqlsrv\Sqlsrv never calls Statement\initialize() (fix
- within) (https://github.com/zendframework/zf2/issues/2678)
-- 2679: Zend/Log/Logger.php using incorrect php errorLevel
- (https://github.com/zendframework/zf2/issues/2679)
-- 2680: Cache: fixed bug on getTotalSpace of filesystem and dba adapter
- (https://github.com/zendframework/zf2/issues/2680)
-- 2681: Cache/Dba: fixed notices on tearDown db4 tests
- (https://github.com/zendframework/zf2/issues/2681)
-- 2682: Replace 'Configuration' with 'Config' when retrieving configuration
- (https://github.com/zendframework/zf2/issues/2682)
-- 2683: Hotfix: Allow items from Abstract Factories to have setShared() called
- (https://github.com/zendframework/zf2/issues/2683)
-- 2685: Remove unused Uses (https://github.com/zendframework/zf2/issues/2685)
-- 2686: Adding code to allow EventManager trigger listeners using wildcard
- identifier (https://github.com/zendframework/zf2/issues/2686)
-- 2687: Hotfix/db sql nested expressions
- (https://github.com/zendframework/zf2/issues/2687)
-- 2688: Hotfix/tablegateway event feature
- (https://github.com/zendframework/zf2/issues/2688)
-- 2689: Hotfix/composer phpunit
- (https://github.com/zendframework/zf2/issues/2689)
-- 2690: Use RFC-3339 full-date format (Y-m-d) in Date element
- (https://github.com/zendframework/zf2/issues/2690)
-- 2691: join on conditions don't accept alternatives to columns
- (https://github.com/zendframework/zf2/issues/2691)
-- 2693: Update library/Zend/Db/Adapter/Driver/Mysqli/Connection.php
- (https://github.com/zendframework/zf2/issues/2693)
-- 2694: Bring fluid interface to Feed Writer
- (https://github.com/zendframework/zf2/issues/2694)
-- 2698: fix typo in # should be :: in exception
- (https://github.com/zendframework/zf2/issues/2698)
-- 2699: fix elseif in javascript Upload Demo
- (https://github.com/zendframework/zf2/issues/2699)
-- 2700: fix cs in casting variable
- (https://github.com/zendframework/zf2/issues/2700)
-- 2705: Fix french translation
- (https://github.com/zendframework/zf2/issues/2705)
-- 2707: Improved error message when ServiceManager does not find an invokable
- class (https://github.com/zendframework/zf2/issues/2707)
-- 2710: #2461 - correcting the url encoding of path segments
- (https://github.com/zendframework/zf2/issues/2710)
-- 2711: Fix/demos ProgressBar/ZendForm.php : Object of class Zend\Form\Form
- could not be converted to string
- (https://github.com/zendframework/zf2/issues/2711)
-- 2712: fix cs casting variable for (array)
- (https://github.com/zendframework/zf2/issues/2712)
-- 2713: Update library/Zend/Mvc/Service/ViewHelperManagerFactory.php
- (https://github.com/zendframework/zf2/issues/2713)
-- 2714: Don't add separator if not prefixing columns
- (https://github.com/zendframework/zf2/issues/2714)
-- 2717: Extends when it can : Validator\DateStep extends Validator\Date to
- reduce code redundancy (https://github.com/zendframework/zf2/issues/2717)
-- 2719: Fixing the Cache Storage Factory Adapter Factory
- (https://github.com/zendframework/zf2/issues/2719)
-- 2728: Bad Regex for Content Type header
- (https://github.com/zendframework/zf2/issues/2728)
-- 2731: Reset the Order part when resetting Select
- (https://github.com/zendframework/zf2/issues/2731)
-- 2732: Removed references to Mysqli in Zend\Db\Adapter\Driver\Pgsql
- (https://github.com/zendframework/zf2/issues/2732)
-- 2733: fix @package Zend_Validate should be Zend_Validator
- (https://github.com/zendframework/zf2/issues/2733)
-- 2734: fix i18n @package and @subpackage value
- (https://github.com/zendframework/zf2/issues/2734)
-- 2736: fix captcha helper test.
- (https://github.com/zendframework/zf2/issues/2736)
-- 2737: Issue #2728 - Bad Regex for Content Type header
- (https://github.com/zendframework/zf2/issues/2737)
-- 2738: fix link 'quickstart' to version 2.0
- (https://github.com/zendframework/zf2/issues/2738)
-- 2739: remove '@subpackage' because Zend\Math is not in subpackage
- (https://github.com/zendframework/zf2/issues/2739)
-- 2742: remove () in echo-ing (https://github.com/zendframework/zf2/issues/2742)
-- 2749: Fix for #2678 (Zend\Db's Sqlsrv Driver)
- (https://github.com/zendframework/zf2/issues/2749)
-- 2750: Adds the ability to instanciate by factory to AbstractPluginManager
- (https://github.com/zendframework/zf2/issues/2750)
-- 2754: add the support to register module paths over namespace
- (https://github.com/zendframework/zf2/issues/2754)
-- 2755: remove Zend\Mvc\Controller\PluginBroker from aliases in
- "$defaultServiceConfig" (https://github.com/zendframework/zf2/issues/2755)
-- 2759: Fix Zend\Code\Scanner\TokenArrayScanner
- (https://github.com/zendframework/zf2/issues/2759)
-- 2764: Fixed Zend\Math\Rand::getString() to pass the parameter $strong to
- ::getBytes() (https://github.com/zendframework/zf2/issues/2764)
-- 2765: Csrf: always use dedicated setter
- (https://github.com/zendframework/zf2/issues/2765)
-- 2766: Session\Storage: always preserve REQUEST_ACCESS_TIME
- (https://github.com/zendframework/zf2/issues/2766)
-- 2768: Zend\Validator dependency is missed in Zend\Cache composer.json
- (https://github.com/zendframework/zf2/issues/2768)
-- 2769: change valueToLDAP to valueToLdap and valueFromLDAP to valueFromLdap
- (https://github.com/zendframework/zf2/issues/2769)
-- 2770: Memcached (https://github.com/zendframework/zf2/issues/2770)
-- 2775: Zend\Db\Sql: Fix for Mysql quoting during limit and offset
- (https://github.com/zendframework/zf2/issues/2775)
-- 2776: Allow whitespace in Iban
- (https://github.com/zendframework/zf2/issues/2776)
-- 2777: Fix issue when PREG_BAD_UTF8_OFFSET_ERROR is defined but Unicode support
- is not enabled on PCRE (https://github.com/zendframework/zf2/issues/2777)
-- 2778: Undefined Index fix in ViewHelperManagerFactory
- (https://github.com/zendframework/zf2/issues/2778)
-- 2779: Allow forms that have been added as fieldsets to bind values to bound
- ob... (https://github.com/zendframework/zf2/issues/2779)
-- 2782: Issue 2781 (https://github.com/zendframework/zf2/issues/2782)
+- The initializer for ServiceManagerAwareInterface was removed to prevent
+ confusion between ServiceManagerAwareInterface and
+ ServiceLocatorAwareInterface, and to promote using the latter interface.
## 2.0.2:
View
2  library/Zend/Barcode/Barcode.php
@@ -20,7 +20,7 @@
* @category Zend
* @package Zend_Barcode
*/
-class Barcode
+abstract class Barcode
{
const OBJECT = 'OBJECT';
const RENDERER = 'RENDERER';
View
2  library/Zend/Cache/PatternFactory.php
@@ -17,7 +17,7 @@
* @category Zend
* @package Zend_Cache
*/
-class PatternFactory
+abstract class PatternFactory
{
/**
* The pattern manager
View
2  library/Zend/Cache/StorageFactory.php
@@ -18,7 +18,7 @@
* @package Zend_Cache
* @subpackage Storage
*/
-class StorageFactory
+abstract class StorageFactory
{
/**
* Plugin manager for loading adapters
View
36 library/Zend/Code/Generator/ClassGenerator.php
@@ -68,6 +68,11 @@ class ClassGenerator extends AbstractGenerator
protected $methods = array();
/**
+ * @var array Array of string names
+ */
+ protected $uses = array();
+
+ /**
* fromReflection() - build a Code Generation Php Object from a Class Reflection
*
* @param ClassReflection $classReflection
@@ -480,6 +485,19 @@ public function addPropertyFromGenerator(PropertyGenerator $property)
}
/**
+ * Add a class to "use" classes
+ *
+ * @param string $useClass
+ */
+ public function addUse($use, $useAlias = null)
+ {
+ if (!empty($useAlias)) {
+ $use .= ' as ' . $useAlias;
+ }
+ $this->uses[] = $use;
+ }
+
+ /**
* getProperties()
*
* @return PropertyGenerator[]
@@ -506,6 +524,16 @@ public function getProperty($propertyName)
}
/**
+ * Returns the "use" classes
+ *
+ * @return array
+ */
+ public function getUses()
+ {
+ return $this->uses;
+ }
+
+ /**
* hasProperty()
*
* @param string $propertyName
@@ -664,6 +692,14 @@ public function generate()
$output .= 'namespace ' . $namespace . ';' . self::LINE_FEED . self::LINE_FEED;
}
+ $uses = $this->getUses();
+ if (!empty($uses)) {
+ foreach ($uses as $use) {
+ $output .= 'use ' . $use . ';' . self::LINE_FEED;
+ }
+ $output .= self::LINE_FEED;
+ }
+
if (null !== ($docBlock = $this->getDocBlock())) {
$docBlock->setIndentation('');
$output .= $docBlock->generate();
View
154 library/Zend/Code/Scanner/ClassScanner.php
@@ -10,6 +10,7 @@
namespace Zend\Code\Scanner;
+use Zend\Code\Annotation;
use Zend\Code\Exception;
use Zend\Code\NameInformation;
@@ -96,8 +97,6 @@ class ClassScanner implements ScannerInterface
protected $infos = array();
/**
- * Constructor
- *
* @param array $classTokens
* @param NameInformation|null $nameInformation
* @return ClassScanner
@@ -109,31 +108,24 @@ public function __construct(array $classTokens, NameInformation $nameInformation
}
/**
- * Get annotations
- *
- * @return array
+ * @param Annotation\AnnotationManager $annotationManager
+ * @return Annotation\AnnotationCollection
*/
- public function getAnnotations()
+ public function getAnnotations(Annotation\AnnotationManager $annotationManager)
{
- return array();
+ if (($docComment = $this->getDocComment()) == '') {
+ return false;
+ }
+
+ return new AnnotationScanner($annotationManager, $docComment, $this->nameInformation);
}
- /**
- * Get doc comment
- *
- * @return null|string
- */
public function getDocComment()
{
$this->scan();
return $this->docComment;
}
- /**
- * Get doc block
- *
- * @return false|DocBlockScanner
- */
public function getDocBlock()
{
if (!$docComment = $this->getDocComment()) {
@@ -142,132 +134,72 @@ public function getDocBlock()
return new DocBlockScanner($docComment);
}
- /**
- * Get name
- *
- * @return null|string
- */
public function getName()
{
$this->scan();
return $this->name;
}
- /**
- * Get short name
- *
- * @return null|string
- */
public function getShortName()
{
$this->scan();
return $this->shortName;
}
- /**
- * Get line start
- *
- * @return int|null
- */
public function getLineStart()
{
$this->scan();
return $this->lineStart;
}
- /**
- * Get line end
- *
- * @return int|null
- */
public function getLineEnd()
{
$this->scan();
return $this->lineEnd;
}
- /**
- * Check for final
- *
- * @return bool
- */
public function isFinal()
{
$this->scan();
return $this->isFinal;
}
- /**
- * Check for instantiable
- *
- * @return bool
- */
public function isInstantiable()
{
$this->scan();
return (!$this->isAbstract && !$this->isInterface);
}
- /**
- * Check for abstract
- *
- * @return bool
- */
public function isAbstract()
{
$this->scan();
return $this->isAbstract;
}
- /**
- * Check for interface
- *
- * @return bool
- */
public function isInterface()
{
$this->scan();
return $this->isInterface;
}
- /**
- * Has parent class
- *
- * @return bool
- */
public function hasParentClass()
{
$this->scan();
return ($this->parentClass != null);
}
- /**
- * Get parent class
- *
- * @return null|string
- */
public function getParentClass()
{
$this->scan();
return $this->parentClass;
}
- /**
- * Get interfaces
- *
- * @return string[]
- */
public function getInterfaces()
{
$this->scan();
return $this->interfaces;
}
- /**
- * Get constants
- *
- * @return array
- */
public function getConstants()
{
$this->scan();
@@ -284,7 +216,7 @@ public function getConstants()
}
/**
- * Get property names
+ * Returns a list of property names
*
* @return array
*/
@@ -305,7 +237,7 @@ public function getPropertyNames()
}
/**
- * Get properties
+ * Returns a list of properties
*
* @return array
*/
@@ -325,11 +257,41 @@ public function getProperties()
return $return;
}
- /**
- * Get method names
- *
- * @return array
- */
+ public function getProperty($propertyNameOrInfoIndex)
+ {
+ $this->scan();
+
+ if (is_int($propertyNameOrInfoIndex)) {
+ $info = $this->infos[$propertyNameOrInfoIndex];
+ if ($info['type'] != 'property') {
+ throw new Exception\InvalidArgumentException('Index of info offset is not about a property');
+ }
+ } elseif (is_string($propertyNameOrInfoIndex)) {
+ $propertyFound = false;
+ foreach ($this->infos as $info) {
+ if ($info['type'] === 'property' && $info['name'] === $propertyNameOrInfoIndex) {
+ $propertyFound = true;
+ break;
+ }
+ }
+ if (!$propertyFound) {
+ return false;
+ }
+ } else {
+ throw new Exception\InvalidArgumentException('Invalid property name of info index type. Must be of type int or string');
+ }
+ if (!isset($info)) {
+ return false;
+ }
+ $p = new PropertyScanner(
+ array_slice($this->tokens, $info['tokenStart'], $info['tokenEnd'] - $info['tokenStart'] + 1),
+ $this->nameInformation
+ );
+ $p->setClass($this->name);
+ $p->setScannerClass($this);
+ return $p;
+ }
+
public function getMethodNames()
{
$this->scan();
@@ -348,8 +310,6 @@ public function getMethodNames()
}
/**
- * Get methods
- *
* @return MethodScanner[]
*/
public function getMethods()
@@ -369,10 +329,8 @@ public function getMethods()
}
/**
- * Get method
- *
* @param string|int $methodNameOrInfoIndex
- * @throws Exception\InvalidArgumentException
+ * @throws \Zend\Code\Exception\InvalidArgumentException
* @return MethodScanner
*/
public function getMethod($methodNameOrInfoIndex)
@@ -409,12 +367,6 @@ public function getMethod($methodNameOrInfoIndex)
return $m;
}
- /**
- * Has method
- *
- * @param string $name
- * @return bool
- */
public function hasMethod($name)
{
$this->scan();
@@ -427,9 +379,6 @@ public function hasMethod($name)
return false;
}
- /**
- * Export
- */
public static function export()
{
// @todo
@@ -440,12 +389,6 @@ public function __toString()
// @todo
}
- /**
- * Scan
- *
- * @return void
- * @throws Exception\RuntimeException
- */
protected function scan()
{
if ($this->isScanned) {
@@ -489,7 +432,7 @@ protected function scan()
$tokenType = null;
$tokenContent = $token;
$tokenLine = $tokenLine + substr_count($lastTokenArray[1],
- "\n"); // adjust token line by last known newline count
+ "\n"); // adjust token line by last known newline count
} else {
$lastTokenArray = $token;
list($tokenType, $tokenContent, $tokenLine) = $token;
@@ -789,3 +732,4 @@ protected function scan()
}
}
+
View
2  library/Zend/Code/Scanner/MethodScanner.php
@@ -84,7 +84,7 @@ public function getDocComment()
/**
* @param Annotation\AnnotationManager $annotationManager
- * @return Annotation\AnnotationCollection
+ * @return AnnotationScanner
*/
public function getAnnotations(Annotation\AnnotationManager $annotationManager)
{
View
284 library/Zend/Code/Scanner/PropertyScanner.php
@@ -1 +1,285 @@
<?php
+/**
+ * Zend Framework (http://framework.zend.com/)
+ *
+ * @link http://github.com/zendframework/zf2 for the canonical source repository
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @package Zend_Code
+ */
+
+namespace Zend\Code\Scanner;
+
+use Zend\Code\Annotation;
+use Zend\Code\Exception;
+use Zend\Code\NameInformation;
+
+class PropertyScanner implements ScannerInterface
+{
+ /**
+ * @var bool
+ */
+ protected $isScanned = false;
+
+ /**
+ * @var array
+ */
+ protected $tokens;
+
+ /**
+ * @var NameInformation
+ */
+ protected $nameInformation;
+
+ /**
+ * @var string
+ */
+ protected $class;
+
+ /**
+ * @var ClassScanner
+ */
+ protected $scannerClass;
+
+ /**
+ * @var int
+ */
+ protected $lineStart;
+
+ /**
+ * @var bool
+ */
+ protected $isProtected = false;
+
+ /**
+ * @var bool
+ */
+ protected $isPublic = true;
+
+ /**
+ * @var bool
+ */
+ protected $isPrivate = false;
+
+ /**
+ * @var bool
+ */
+ protected $isStatic = false;
+
+ /**
+ * @var string
+ */
+ protected $docComment;
+
+ /**
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * @var string
+ */
+ protected $value;
+
+ /**
+ * Constructor
+ *
+ * @param array $propertyTokens
+ * @param NameInformation $nameInformation
+ */
+ public function __construct(array $propertyTokens, NameInformation $nameInformation = null)
+ {
+ $this->tokens = $propertyTokens;
+ $this->nameInformation = $nameInformation;
+ }
+
+ /**
+ * @param string $class
+ */
+ public function setClass($class)
+ {
+ $this->class = $class;
+ }
+
+ /**
+ * @param ClassScanner $scannerClass
+ */
+ public function setScannerClass(ClassScanner $scannerClass)
+ {
+ $this->scannerClass = $scannerClass;
+ }
+
+ /**
+ * @return ClassScanner
+ */
+ public function getClassScanner()
+ {
+ return $this->scannerClass;
+ }
+
+ /**
+ * @return string
+ */
+ public function getName()
+ {
+ $this->scan();
+ return $this->name;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isPublic()
+ {
+ $this->scan();
+ return $this->isPublic;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isPrivate()
+ {
+ $this->scan();
+ return $this->isPrivate;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isProtected()
+ {
+ $this->scan();
+ return $this->isProtected;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isStatic()
+ {
+ $this->scan();
+ return $this->isStatic;
+ }
+
+ /**
+ * @return string
+ */
+ public function getValue()
+ {
+ $this->scan();
+ return $this->value;
+ }
+
+ /**
+ * @return string
+ */
+ public function getDocComment()
+ {
+ $this->scan();
+ return $this->docComment;
+ }
+
+ /**
+ * @param Annotation\AnnotationManager $annotationManager
+ * @return AnnotationScanner
+ */
+ public function getAnnotations(Annotation\AnnotationManager $annotationManager)
+ {
+ if (($docComment = $this->getDocComment()) == '') {
+ return false;
+ }
+
+ return new AnnotationScanner($annotationManager, $docComment, $this->nameInformation);
+ }
+
+ /**
+ * @return string
+ */
+ public function __toString()
+ {
+ $this->scan();
+ return var_export($this, true);
+ }
+
+ /**
+ * Scan tokens
+ *
+ * @throws \Zend\Code\Exception\RuntimeException
+ */
+ protected function scan()
+ {
+ if ($this->isScanned) {
+ return;
+ }
+
+ if (!$this->tokens) {
+ throw new Exception\RuntimeException('No tokens were provided');
+ }
+
+ /**
+ * Variables & Setup
+ */
+ $tokens = &$this->tokens;
+
+ reset($tokens);
+
+ SCANNER_TOP:
+
+ $token = current($tokens);
+
+ if (!is_string($token)) {
+ list($tokenType, $tokenContent, $tokenLine) = $token;
+
+ switch ($tokenType) {
+ case T_DOC_COMMENT:
+ if ($this->docComment === null && $this->name === null) {
+ $this->docComment = $tokenContent;
+ }
+ goto SCANNER_CONTINUE;
+
+ case T_VARIABLE:
+ $this->name = ltrim($tokenContent, '$');
+ goto SCANNER_CONTINUE;
+
+ case T_PUBLIC:
+ // use defaults
+ goto SCANNER_CONTINUE;
+
+ case T_PROTECTED:
+ $this->isProtected = true;
+ $this->isPublic = false;
+ goto SCANNER_CONTINUE;
+
+ case T_PRIVATE:
+ $this->isPrivate = true;
+ $this->isPublic = false;
+ goto SCANNER_CONTINUE;
+
+ case T_STATIC:
+ $this->isStatic = true;
+ goto SCANNER_CONTINUE;
+
+ default:
+ if ($this->name !== null && trim($tokenContent) !== '') {
+ $this->value .= (is_string($token)) ? $token : $tokenContent;
+ if (substr($this->value, 0, 1) === '"' || substr($this->value, 0, 1) === "'") {
+ $this->value = substr($this->value, 1, -1); // Remove quotes
+ }
+ }
+ goto SCANNER_CONTINUE;
+ }
+ }
+
+ SCANNER_CONTINUE:
+
+ if (next($this->tokens) === false) {
+ goto SCANNER_END;
+ }
+ goto SCANNER_TOP;
+
+ SCANNER_END:
+
+ $this->isScanned = true;
+ }
+}
View
127 library/Zend/Config/Factory.php
@@ -26,6 +26,13 @@ class Factory
public static $readers = null;
/**
+ * Plugin manager for loading writers
+ *
+ * @var null|WriterPluginManager
+ */
+ public static $writers = null;
+
+ /**
* Registered config file extensions.
* key is extension, value is reader instance or plugin name
*
@@ -38,6 +45,19 @@ class Factory
'yaml' => 'yaml',
);
+ /**
+ * Register config file extensions for writing
+ * key is extension, value is writer instance or plugin name
+ *
+ * @var array
+ */
+ protected static $writerExtensions = array(
+ 'php' => 'php',
+ 'ini' => 'ini',
+ 'json' => 'json',
+ 'xml' => 'xml',
+ 'yaml' => 'yaml',
+ );
/**
* Read a config from a file.
@@ -108,9 +128,66 @@ public static function fromFiles(array $files, $returnConfigObject = false)
}
/**
+ * Writes a config to a file
+ *
+ * @param string $filename
+ * @param array|Config $config
+ * @return boolean TRUE on success | FALSE on failure
+ * @throws Exception\RuntimeException
+ * @throws Exception\InvalidArgumentException
+ */
+ public static function toFile($filename, $config)
+ {
+ if (
+ (is_object($config) && !($config instanceOf Config)) ||
+ (!is_object($config) && !is_array($config))
+ ) {
+ throw new Exception\InvalidArgumentException(
+ __METHOD__." \$config should be an array or instance of Zend\\Config\\Config"
+ );
+ }
+
+ $extension = substr(strrchr($filename, '.'), 1);
+ $directory = dirname($filename);
+
+ if (!is_dir($directory)) {
+ throw new Exception\RuntimeException(
+ "Directory '{$directory}' does not exists!"
+ );
+ }
+
+ if (!is_writable($directory)) {
+ throw new Exception\RuntimeException(
+ "Cannot write in directory '{$directory}'"
+ );
+ }
+
+ if(!isset(self::$writerExtensions[$extension])) {
+ throw new Exception\RuntimeException(
+ "Unsupported config file extension: '.{$extension}' for writing."
+ );
+ }
+
+ $writer = self::$writerExtensions[$extension];
+ if (($writer instanceOf Writer\AbstractWriter) === false) {
+ $writer = self::getWriterPluginManager()->get($writer);
+ self::$writerExtensions[$extension] = $writer;
+ }
+
+ if (is_object($config)) {
+ $config = $config->toArray();
+ }
+
+ $content = $writer->processConfig($config);
+
+ return (bool) (file_put_contents($filename, $content) !== false);
+ }
+
+ /**
* Set reader plugin manager
*
* @param ReaderPluginManager $readers
+ * @return void
*/
public static function setReaderPluginManager(ReaderPluginManager $readers)
{
@@ -131,11 +208,37 @@ public static function getReaderPluginManager()
}
/**
+ * Set writer plugin manager
+ *
+ * @param WriterPluginManager $writers
+ * @return void
+ */
+ public static function setWriterPluginManager(WriterPluginManager $writers)
+ {
+ self::$writers = $writers;
+ }
+
+ /**
+ * Get the writer plugin manager
+ *
+ * @return WriterPluginManager
+ */
+ public static function getWriterPluginManager()
+ {
+ if (static::$writers === null) {
+ static::$writers = new WriterPluginManager();
+ }
+
+ return static::$writers;
+ }
+
+ /**
* Set config reader for file extension
*
* @param string $extension
* @param string|Reader\ReaderInterface $reader
* @throws Exception\InvalidArgumentException
+ * @return void
*/
public static function registerReader($extension, $reader)
{
@@ -152,4 +255,28 @@ public static function registerReader($extension, $reader)
self::$extensions[$extension] = $reader;
}
+
+ /**
+ * Set config writer for file extension
+ *
+ * @param string $extension
+ * @param string|Writer\AbstractWriter $writer
+ * @throw Exception\InvalidArgumentException
+ * @return void
+ */
+ public static function registerWriter($extension, $writer)
+ {
+ $extension = strtolower($extension);
+
+ if (!is_string($writer) && !$writer instanceof Writer\AbstractWriter) {
+ throw new Exception\InvalidArgumentException(sprintf(
+ 'Writer should be plugin name, class name or ' .
+ 'instance of %s\Writer\AbstractWriter; received "%s"',
+ __NAMESPACE__,
+ (is_object($writer) ? get_class($writer) : gettype($writer))
+ ));
+ }
+
+ self::$writerExtensions[$extension] = $writer;
+ }
}
View
29 library/Zend/Config/WriterPluginManager.php
@@ -0,0 +1,29 @@
+<?php
+namespace Zend\Config;
+
+use Zend\ServiceManager\AbstractPluginManager;
+
+class WriterPluginManager extends AbstractPluginManager
+{
+ protected $invokableClasses = array(
+ 'php' => 'Zend\Config\Writer\PhpArray',
+ 'ini' => 'Zend\Config\Writer\Ini',
+ 'json' => 'Zend\Config\Writer\Json',
+ 'yaml' => 'Zend\Config\Writer\Yaml',
+ 'xml' => 'Zend\Config\Writer\Xml',
+ );
+
+ public function validatePlugin($plugin)
+ {
+ if ($plugin instanceOf Writer\AbstractWriter) {
+ return;
+ }
+
+ $type = is_object($plugin) ? get_class($plugin) : gettype($plugin);
+
+ throw new Exception\InvalidArgumentException(
+ "Plugin of type {$type} is invalid. Plugin must extend ".
+ __NAMESPACE__.'\Writer\AbstractWriter'
+ );
+ }
+}
View
4 library/Zend/Crypt/Hmac.php
@@ -42,10 +42,6 @@ class Hmac
*/
public static function compute($key, $hash, $data, $output = self::OUTPUT_STRING)
{
- if (!isset($key) || empty($key)) {
- throw new Exception\InvalidArgumentException('Provided key is null or empty');
- }
-
$hash = strtolower($hash);
if (!self::isSupported($hash)) {
throw new Exception\InvalidArgumentException(
View
345 library/Zend/Crypt/Key/Derivation/Scrypt.php
@@ -0,0 +1,345 @@
+<?php
+/**
+ * Zend Framework (http://framework.zend.com/)
+ *
+ * @link http://github.com/zendframework/zf2 for the canonical source repository
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @package Zend_Crypt
+ */
+
+namespace Zend\Crypt\Key\Derivation;
+
+use Zend\Crypt\Key\Derivation\Pbkdf2;
+
+/**
+ * Scrypt key derivation function
+ *
+ * @category Zend
+ * @package Zend_Crypt
+ * @see http://www.tarsnap.com/scrypt.html
+ * @see https://tools.ietf.org/html/draft-josefsson-scrypt-kdf-01
+ */
+abstract class Scrypt
+{
+ /**
+ * Execute the scrypt algorithm
+ *
+ * @param string $password
+ * @param string $salt
+ * @param integer $n CPU cost
+ * @param integer $r Memory cost
+ * @param integer $p parallelization cost
+ * @param integer $length size of the output key
+ * @return string
+ */
+ public static function calc($password, $salt, $n, $r, $p, $length)
+ {
+ if ($n == 0 || ($n & ($n - 1)) != 0) {
+ throw new Exception\InvalidArgumentException("N must be > 0 and a power of 2");
+ }
+ if ($n > PHP_INT_MAX / 128 / $r) {
+ throw new Exception\InvalidArgumentException("Parameter n is too large");
+ }
+ if ($r > PHP_INT_MAX / 128 / $p) {
+ throw new Exception\InvalidArgumentException("Parameter r is too large");
+ }
+
+ if (extension_loaded('Scrypt')) {
+ if ($length < 16) {
+ throw new Exception\InvalidArgumentException("Key length is too low, must be greater or equal to 16");
+ }
+ return self::hex2bin(scrypt($password, $salt, $n, $r, $p, $length));
+ }
+
+ $b = Pbkdf2::calc('sha256', $password, $salt, 1, $p * 128 * $r);
+
+ $s = '';
+ for ($i = 0; $i < $p; $i++) {
+ $s .= self::scryptROMix(substr($b, $i * 128 * $r, 128 * $r), $n, $r);
+ }
+
+ return Pbkdf2::calc('sha256', $password, $s, 1, $length);
+ }
+
+ /**
+ * scryptROMix
+ *
+ * @param string $b
+ * @param integer $n
+ * @param integer $r
+ * @return string
+ * @see https://tools.ietf.org/html/draft-josefsson-scrypt-kdf-01#section-4
+ */
+ protected static function scryptROMix($b, $n, $r)
+ {
+ $x = $b;
+ $v = array();
+ for ($i = 0; $i < $n; $i++) {
+ $v[$i] = $x;
+ $x = self::scryptBlockMix($x, $r);
+ }
+ for ($i = 0; $i < $n; $i++) {
+ $j = self::integerify($x) % $n;
+ $t = $x ^ $v[$j];
+ $x = self::scryptBlockMix($t, $r);
+ }
+ return $x;
+ }
+
+ /**
+ * scryptBlockMix
+ *
+ * @param string $b
+ * @param integer $r
+ * @return string
+ * @see https://tools.ietf.org/html/draft-josefsson-scrypt-kdf-01#section-3
+ */
+ protected static function scryptBlockMix($b, $r)
+ {
+ $x = substr($b, -64);
+ $even = '';
+ $odd = '';
+ $len = 2 * $r;
+
+ for ($i = 0; $i < $len; $i++) {
+ if (PHP_INT_SIZE === 4) {
+ $x = self::salsa208Core32($x ^ substr($b, 64 * $i, 64));
+ } else {
+ $x = self::salsa208Core64($x ^ substr($b, 64 * $i, 64));
+ }
+ if ($i % 2 == 0) {
+ $even .= $x;
+ } else {
+ $odd .= $x;
+ }
+ }
+ return $even . $odd;
+ }
+
+ /**
+ * Salsa 20/8 core (32 bit version)
+ *
+ * @param string $b
+ * @return string
+ * @see https://tools.ietf.org/html/draft-josefsson-scrypt-kdf-01#section-2
+ * @see http://cr.yp.to/salsa20.html
+ */
+ protected static function salsa208Core32($b)
+ {
+ $b32 = array();
+ for ($i = 0; $i < 16; $i++) {
+ list(, $b32[$i]) = unpack("V", substr($b, $i * 4, 4));
+ }
+
+ $x = $b32;
+ for ($i = 0; $i < 8; $i += 2) {
+ $a = ($x[ 0] + $x[12]);
+ $x[ 4] ^= ($a << 7) | ($a >> 25) & 0x7f;
+ $a = ($x[ 4] + $x[ 0]);
+ $x[ 8] ^= ($a << 9) | ($a >> 23) & 0x1ff;
+ $a = ($x[ 8] + $x[ 4]);
+ $x[12] ^= ($a << 13) | ($a >> 19) & 0x1fff;
+ $a = ($x[12] + $x[ 8]);
+ $x[ 0] ^= ($a << 18) | ($a >> 14) & 0x3ffff;
+ $a = ($x[ 5] + $x[ 1]);
+ $x[ 9] ^= ($a << 7) | ($a >> 25) & 0x7f;
+ $a = ($x[ 9] + $x[ 5]);
+ $x[13] ^= ($a << 9) | ($a >> 23) & 0x1ff;
+ $a = ($x[13] + $x[ 9]);
+ $x[ 1] ^= ($a << 13) | ($a >> 19) & 0x1fff;
+ $a = ($x[ 1] + $x[13]);
+ $x[ 5] ^= ($a << 18) | ($a >> 14) & 0x3ffff;
+ $a = ($x[10] + $x[ 6]);
+ $x[14] ^= ($a << 7) | ($a >> 25) & 0x7f;
+ $a = ($x[14] + $x[10]);
+ $x[ 2] ^= ($a << 9) | ($a >> 23) & 0x1ff;
+ $a = ($x[ 2] + $x[14]);
+ $x[ 6] ^= ($a << 13) | ($a >> 19) & 0x1fff;
+ $a = ($x[ 6] + $x[ 2]);
+ $x[10] ^= ($a << 18) | ($a >> 14) & 0x3ffff;
+ $a = ($x[15] + $x[11]);
+ $x[ 3] ^= ($a << 7) | ($a >> 25) & 0x7f;
+ $a = ($x[ 3] + $x[15]);
+ $x[ 7] ^= ($a << 9) | ($a >> 23) & 0x1ff;
+ $a = ($x[ 7] + $x[ 3]);
+ $x[11] ^= ($a << 13) | ($a >> 19) & 0x1fff;
+ $a = ($x[11] + $x[ 7]);
+ $x[15] ^= ($a << 18) | ($a >> 14) & 0x3ffff;
+ $a = ($x[ 0] + $x[ 3]);
+ $x[ 1] ^= ($a << 7) | ($a >> 25) & 0x7f;
+ $a = ($x[ 1] + $x[ 0]);
+ $x[ 2] ^= ($a << 9) | ($a >> 23) & 0x1ff;
+ $a = ($x[ 2] + $x[ 1]);
+ $x[ 3] ^= ($a << 13) | ($a >> 19) & 0x1fff;
+ $a = ($x[ 3] + $x[ 2]);
+ $x[ 0] ^= ($a << 18) | ($a >> 14) & 0x3ffff;
+ $a = ($x[ 5] + $x[ 4]);
+ $x[ 6] ^= ($a << 7) | ($a >> 25) & 0x7f;
+ $a = ($x[ 6] + $x[ 5]);
+ $x[ 7] ^= ($a << 9) | ($a >> 23) & 0x1ff;
+ $a = ($x[ 7] + $x[ 6]);
+ $x[ 4] ^= ($a << 13) | ($a >> 19) & 0x1fff;
+ $a = ($x[ 4] + $x[ 7]);
+ $x[ 5] ^= ($a << 18) | ($a >> 14) & 0x3ffff;
+ $a = ($x[10] + $x[ 9]);
+ $x[11] ^= ($a << 7) | ($a >> 25) & 0x7f;
+ $a = ($x[11] + $x[10]);
+ $x[ 8] ^= ($a << 9) | ($a >> 23) & 0x1ff;
+ $a = ($x[ 8] + $x[11]);
+ $x[ 9] ^= ($a << 13) | ($a >> 19) & 0x1fff;
+ $a = ($x[ 9] + $x[ 8]);
+ $x[10] ^= ($a << 18) | ($a >> 14) & 0x3ffff;
+ $a = ($x[15] + $x[14]);
+ $x[12] ^= ($a << 7) | ($a >> 25) & 0x7f;
+ $a = ($x[12] + $x[15]);
+ $x[13] ^= ($a << 9) | ($a >> 23) & 0x1ff;
+ $a = ($x[13] + $x[12]);
+ $x[14] ^= ($a << 13) | ($a >> 19) & 0x1fff;
+ $a = ($x[14] + $x[13]);
+ $x[15] ^= ($a << 18) | ($a >> 14) & 0x3ffff;
+ }
+ for ($i = 0; $i < 16; $i++) {
+ $b32[$i] = $b32[$i] + $x[$i];
+ }
+ $result = '';
+ for ($i = 0; $i < 16; $i++) {
+ $result .= pack("V", $b32[$i]);
+ }
+
+ return $result;
+ }
+
+ /**
+ * Salsa 20/8 core (64 bit version)
+ *
+ * @param string $b
+ * @return string
+ * @see https://tools.ietf.org/html/draft-josefsson-scrypt-kdf-01#section-2
+ * @see http://cr.yp.to/salsa20.html
+ */
+ protected static function salsa208Core64($b)
+ {
+ $b32 = array();
+ for ($i = 0; $i < 16; $i++) {
+ list(, $b32[$i]) = unpack("V", substr($b, $i * 4, 4));
+ }
+
+ $x = $b32;
+ for ($i = 0; $i < 8; $i += 2) {
+ $a = ($x[ 0] + $x[12]) & 0xffffffff;
+ $x[ 4] ^= ($a << 7) | ($a >> 25);
+ $a = ($x[ 4] + $x[ 0]) & 0xffffffff;
+ $x[ 8] ^= ($a << 9) | ($a >> 23);
+ $a = ($x[ 8] + $x[ 4]) & 0xffffffff;
+ $x[12] ^= ($a << 13) | ($a >> 19);
+ $a = ($x[12] + $x[ 8]) & 0xffffffff;
+ $x[ 0] ^= ($a << 18) | ($a >> 14);
+ $a = ($x[ 5] + $x[ 1]) & 0xffffffff;
+ $x[ 9] ^= ($a << 7) | ($a >> 25);
+ $a = ($x[ 9] + $x[ 5]) & 0xffffffff;
+ $x[13] ^= ($a << 9) | ($a >> 23);
+ $a = ($x[13] + $x[ 9]) & 0xffffffff;
+ $x[ 1] ^= ($a << 13) | ($a >> 19);
+ $a = ($x[ 1] + $x[13]) & 0xffffffff;
+ $x[ 5] ^= ($a << 18) | ($a >> 14);
+ $a = ($x[10] + $x[ 6]) & 0xffffffff;
+ $x[14] ^= ($a << 7) | ($a >> 25);
+ $a = ($x[14] + $x[10]) & 0xffffffff;
+ $x[ 2] ^= ($a << 9) | ($a >> 23);
+ $a = ($x[ 2] + $x[14]) & 0xffffffff;
+ $x[ 6] ^= ($a << 13) | ($a >> 19);
+ $a = ($x[ 6] + $x[ 2]) & 0xffffffff;
+ $x[10] ^= ($a << 18) | ($a >> 14);
+ $a = ($x[15] + $x[11]) & 0xffffffff;
+ $x[ 3] ^= ($a << 7) | ($a >> 25);
+ $a = ($x[ 3] + $x[15]) & 0xffffffff;
+ $x[ 7] ^= ($a << 9) | ($a >> 23);
+ $a = ($x[ 7] + $x[ 3]) & 0xffffffff;
+ $x[11] ^= ($a << 13) | ($a >> 19);
+ $a = ($x[11] + $x[ 7]) & 0xffffffff;
+ $x[15] ^= ($a << 18) | ($a >> 14);
+ $a = ($x[ 0] + $x[ 3]) & 0xffffffff;
+ $x[ 1] ^= ($a << 7) | ($a >> 25);
+ $a = ($x[ 1] + $x[ 0]) & 0xffffffff;
+ $x[ 2] ^= ($a << 9) | ($a >> 23);
+ $a = ($x[ 2] + $x[ 1]) & 0xffffffff;
+ $x[ 3] ^= ($a << 13) | ($a >> 19);
+ $a = ($x[ 3] + $x[ 2]) & 0xffffffff;
+ $x[ 0] ^= ($a << 18) | ($a >> 14);
+ $a = ($x[ 5] + $x[ 4]) & 0xffffffff;
+ $x[ 6] ^= ($a << 7) | ($a >> 25);
+ $a = ($x[ 6] + $x[ 5]) & 0xffffffff;
+ $x[ 7] ^= ($a << 9) | ($a >> 23);
+ $a = ($x[ 7] + $x[ 6]) & 0xffffffff;
+ $x[ 4] ^= ($a << 13) | ($a >> 19);
+ $a = ($x[ 4] + $x[ 7]) & 0xffffffff;
+ $x[ 5] ^= ($a << 18) | ($a >> 14);
+ $a = ($x[10] + $x[ 9]) & 0xffffffff;
+ $x[11] ^= ($a << 7) | ($a >> 25);
+ $a = ($x[11] + $x[10]) & 0xffffffff;
+ $x[ 8] ^= ($a << 9) | ($a >> 23);
+ $a = ($x[ 8] + $x[11]) & 0xffffffff;
+ $x[ 9] ^= ($a << 13) | ($a >> 19);
+ $a = ($x[ 9] + $x[ 8]) & 0xffffffff;
+ $x[10] ^= ($a << 18) | ($a >> 14);
+ $a = ($x[15] + $x[14]) & 0xffffffff;
+ $x[12] ^= ($a << 7) | ($a >> 25);
+ $a = ($x[12] + $x[15]) & 0xffffffff;
+ $x[13] ^= ($a << 9) | ($a >> 23);
+ $a = ($x[13] + $x[12]) & 0xffffffff;
+ $x[14] ^= ($a << 13) | ($a >> 19);
+ $a = ($x[14] + $x[13]) & 0xffffffff;
+ $x[15] ^= ($a << 18) | ($a >> 14);
+ }
+ for ($i = 0; $i < 16; $i++) {
+ $b32[$i] = ($b32[$i] + $x[$i]) & 0xffffffff;
+ }
+ $result = '';
+ for ($i = 0; $i < 16; $i++) {
+ $result .= pack("V", $b32[$i]);
+ }
+
+ return $result;
+ }
+
+ /**
+ * Integerify
+ *
+ * Integerify (B[0] ... B[2 * r - 1]) is defined as the result
+ * of interpreting B[2 * r - 1] as a little-endian integer.
+ * Each block B is a string of 64 bytes.
+ *
+ * @param string $b
+ * @return integer
+ * @see https://tools.ietf.org/html/draft-josefsson-scrypt-kdf-01#section-4
+ */
+ protected static function integerify($b)
+ {
+ $v = 'v';
+ if (PHP_INT_SIZE === 8) {
+ $v = 'V';
+ }
+ list(,$n) = unpack($v, substr($b, -64));
+ return $n;
+ }
+
+ /**
+ * Convert hex string in a binary string
+ *
+ * @param string $hex
+ * @return string
+ */
+ protected static function hex2bin($hex)
+ {
+ if (version_compare(PHP_VERSION, '5.4') >= 0) {
+ return hex2bin($hex);
+ }
+ $len = strlen($hex);
+ $result = '';
+ for ($i = 0; $i < $len; $i+=2) {
+ $result .= chr(hexdec($hex[$i] . $hex[$i+1]));
+ }
+ return $result;
+ }
+}
View
28 library/Zend/Crypt/Password/Bcrypt.php
@@ -35,6 +35,11 @@ class Bcrypt implements PasswordInterface
protected $salt;
/**
+ * @var boolean
+ */
+ protected $backwardCompatibility = false;
+
+ /**
* Constructor
*
* @param array|Traversable $options
@@ -82,7 +87,7 @@ public function create($password)
* Check for security flaw in the bcrypt implementation used by crypt()
* @see http://php.net/security/crypt_blowfish.php
*/
- if (version_compare(PHP_VERSION, '5.3.7') >= 0) {
+ if ((version_compare(PHP_VERSION, '5.3.7') >= 0) && !$this->backwardCompatibility) {
$prefix = '$2y$';
} else {
$prefix = '$2a$';
@@ -172,4 +177,25 @@ public function getSalt()
{
return $this->salt;
}
+
+ /**
+ * Set the backward compatibility $2a$ instead of $2y$ for PHP 5.3.7+
+ *
+ * @param boolean $value
+ */
+ public function setBackwardCompatibility($value)
+ {
+ $this->backwardCompatibility = (boolean) $value;
+ return $this;
+ }
+
+ /**
+ * Get the backward compatibility
+ *
+ * @return boolean
+ */
+ public function getBackwardCompatibility()
+ {
+ return $this->backwardCompatibility;
+ }
}
View
12 library/Zend/Db/Sql/AbstractSql.php
@@ -27,6 +27,11 @@
*/
protected $processInfo = array('paramPrefix' => '', 'subselectCount' => 0);
+ /**
+ * @var array
+ */
+ protected $instanceParameterIndex = array();
+
protected function processExpression(ExpressionInterface $expression, PlatformInterface $platform, Adapter $adapter = null, $namedParameterPrefix = null)
{
// static counter for the number of times this method was invoked across the PHP runtime
@@ -42,7 +47,12 @@ protected function processExpression(ExpressionInterface $expression, PlatformIn
// initialize variables
$parts = $expression->getExpressionData();
- $expressionParamIndex = 1;
+
+ if(!isset($this->instanceParameterIndex[$namedParameterPrefix])) {
+ $this->instanceParameterIndex[$namedParameterPrefix] = 1;
+ }
+
+ $expressionParamIndex = &$this->instanceParameterIndex[$namedParameterPrefix];
foreach ($parts as $part) {
View
1  library/Zend/Filter/FilterPluginManager.php
@@ -68,6 +68,7 @@ class FilterPluginManager extends AbstractPluginManager
'stringtrim' => 'Zend\Filter\StringTrim',
'stripnewlines' => 'Zend\Filter\StripNewlines',
'striptags' => 'Zend\Filter\StripTags',
+ 'urinormalize' => 'Zend\Filter\UriNormalize',
'wordcamelcasetodash' => 'Zend\Filter\Word\CamelCaseToDash',
'wordcamelcasetoseparator' => 'Zend\Filter\Word\CamelCaseToSeparator',
'wordcamelcasetounderscore' => 'Zend\Filter\Word\CamelCaseToUnderscore',
View
150 library/Zend/Filter/UriNormalize.php
@@ -0,0 +1,150 @@
+<?php
+/**
+ * Zend Framework (http://framework.zend.com/)
+ *
+ * @link http://github.com/zendframework/zf2 for the canonical source repository
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @package Zend_Filter
+ */
+
+namespace Zend\Filter;
+
+use Zend\Filter\AbstractFilter;
+use Zend\Filter\Exception\InvalidArgumentException;
+use Zend\Uri\UriFactory;
+use Zend\Uri\Uri;
+use Zend\Uri\Exception\ExceptionInterface as UriException;
+
+/**
+ * @category Zend
+ * @package Zend_Filter
+ */
+class UriNormalize extends AbstractFilter
+{
+ /**
+ * The default scheme to use when parsing scheme-less URIs
+ *
+ * @var string
+ */
+ protected $defaultScheme = null;
+
+ /**
+ * Enforced scheme for scheme-less URIs. See setEnforcedScheme docs for info
+ *
+ * @var string
+ */
+ protected $enforcedScheme = null;
+
+ /**
+ * Sets filter options
+ *
+ * @param string|array|\Zend\Config\Config $options
+ * @return void
+ */
+ public function __construct($options = null)
+ {
+ if ($options) {
+ $this->setOptions($options);
+ }
+ }
+
+ /**
+ * Set the default scheme to use when parsing scheme-less URIs
+ *
+ * The scheme used when parsing URIs may affect the specific object used to
+ * normalize the URI and thus may affect the resulting normalize URI.
+ *
+ * @param string $defaultScheme
+ * @return \Zend\Filter\UriNormalize
+ */
+ public function setDefaultScheme($defaultScheme)
+ {
+ $this->defaultScheme = $defaultScheme;
+ return $this;
+ }
+
+ /**
+ * Set a URI scheme to enforce on schemeless URIs
+ *
+ * This allows forcing input values such as 'www.example.com/foo' into
+ * 'http://www.example.com/foo'.
+ *
+ * This should be used with caution, as a standard-compliant URI parser
+ * would regard 'www.example.com' in the above input URI to be the path and
+ * not host part of the URI. While this option can assist in solving
+ * real-world user mishaps, it may yield unexpected results at times.
+ *
+ * @param string $enforcedScheme
+ * @return \Zend\Filter\UriNormalize
+ */
+ public function setEnforcedScheme($enforcedScheme)
+ {
+ $this->enforcedScheme = $enforcedScheme;
+ return $this;
+ }
+
+ /**
+ * Filter the URL by normalizing it and applying a default scheme if set
+ *
+ * @param string $value
+ * @return string
+ */
+ public function filter($value)
+ {
+ $defaultScheme = $this->defaultScheme ?: $this->enforcedScheme;
+
+ // Reset default scheme if it is not a known scheme
+ if (!UriFactory::getRegisteredSchemeClass($defaultScheme)) {
+ $defaultScheme = null;
+ }
+
+ try {
+ $uri = UriFactory::factory($value, $defaultScheme);
+ if ($this->enforcedScheme && (!$uri->getScheme())) {
+ $this->enforceScheme($uri);
+ }
+
+ } catch (UriException $ex) {
+ // We are unable to parse / enfore scheme with the given config and input
+ return $value;
+ }
+
+ $uri->normalize();
+
+ if (!$uri->isValid()) {
+ return $value;
+ }
+
+ return $uri->toString();
+ }
+
+ /**
+ * Enforce the defined scheme on the URI
+ *
+ * This will also adjust the host and path parts of the URI as expected in
+ * the case of scheme-less network URIs
+ *
+ * @param Uri $uri
+ */
+ protected function enforceScheme(Uri $uri)
+ {
+ $path = $uri->getPath();
+ if (strpos($path, '/') !== false) {
+ list($host, $path) = explode('/', $path, 2);
+ $path = '/' . $path;
+ } else {
+ $host = $path;
+ $path = '';
+ }
+
+ // We have nothing to do if we have no host
+ if (!$host) {
+ return;
+ }
+
+ $uri->setScheme($this->enforcedScheme)
+ ->setHost($host)
+ ->setPath($path);
+ }
+}
View
3  library/Zend/Filter/composer.json
@@ -20,7 +20,8 @@
},
"suggest": {
"zendframework/zend-i18n": "Zend\\I18n component",
+ "zendframework/zend-uri": "Zend\\Uri component for UriNormalize filter",
"zendframework/zend-validator": "Zend\\Validator component",
"zendframework/zend-crypt": "Zend\\Crypt component"
}
-}
+}
View
43 library/Zend/Form/Annotation/AbstractArrayOrStringAnnotation.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Zend Framework (http://framework.zend.com/)
+ *
+ * @link http://github.com/zendframework/zf2 for the canonical source repository
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @package Zend_Form
+ */
+
+namespace Zend\Form\Annotation;
+
+use Zend\Form\Exception;
+
+/**
+ * @package Zend_Form
+ * @subpackage Annotation
+ */
+abstract class AbstractArrayOrStringAnnotation
+{
+ /**
+ * @var array|string
+ */
+ protected $value;
+
+ /**
+ * Receive and process the contents of an annotation
+ *
+ * @param array $data
+ * @throws Exception\DomainException if a 'value' key is missing, or its value is not an array or string
+ */
+ public function __construct(array $data)
+ {
+ if (!isset($data['value']) || (!is_array($data['value']) && !is_string($data['value']))) {
+ throw new Exception\DomainException(sprintf(
+ '%s expects the annotation to define an array or string; received "%s"',
+ get_class($this),
+ isset($data['value']) ? gettype($data['value']) : 'null'
+ ));
+ }
+ $this->value = $data['value'];
+ }
+}
View
4 library/Zend/Form/Annotation/Hydrator.php
@@ -21,12 +21,12 @@
* @package Zend_Form
* @subpackage Annotation
*/
-class Hydrator extends AbstractStringAnnotation
+class Hydrator extends AbstractArrayOrStringAnnotation
{
/**
* Retrieve the hydrator class
*
- * @return null|string
+ * @return null|string|array
*/
public function getHydrator()
{
View
176 library/Zend/Form/Element/DateSelect.php
@@ -0,0 +1,176 @@
+<?php
+/**
+ * Zend Framework (http://framework.zend.com/)
+ *
+ * @link http://github.com/zendframework/zf2 for the canonical source repository
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @package Zend_Form
+ */
+
+namespace Zend\Form\Element;
+
+use DateTime;
+use Zend\Form\Form;
+use Zend\Validator\ValidatorInterface;
+use Zend\Validator\Date as DateValidator;
+
+class DateSelect extends MonthSelect
+{
+ /**
+ * Select form element that contains values for day
+ *
+ * @var Select
+ */
+ protected $dayElement;
+
+ /**
+ * Constructor. Add the day select element
+ *
+ * @param null|int|string $name Optional name for the element
+ * @param array $options Optional options for the element
+ */
+ public function __construct($name = null, $options = array())
+ {
+ parent::__construct($name, $options);
+
+ $this->dayElement = new Select('day');
+ }
+
+ /**
+ * Accepted options for DateSelect (plus the ones from MonthSelect) :
+ * - day_attributes: HTML attributes to be rendered with the day element
+ *
+ * @param array|\Traversable $options
+ * @return DateSelect
+ */
+ public function setOptions($options)
+ {
+ parent::setOptions($options);
+
+ if (isset($options['day_attributes'])) {
+ $this->setDayAttributes($options['day_attributes']);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @return Select
+ */
+ public function getDayElement()
+ {
+ return $this->dayElement;
+ }
+
+ /**
+ * Set the day attributes
+ *
+ * @param array $dayAttributes
+ * @return DateSelect
+ */
+ public function setDayAttributes(array $dayAttributes)
+ {
+ $this->dayElement->setAttributes($dayAttributes);
+ return $this;
+ }
+
+ /**
+ * Get the day attributes
+ *
+ * @return array
+ */
+ public function getDayAttributes()
+ {
+ return $this->dayElement->getAttributes();
+ }
+
+ /**
+ * @param mixed $value
+ * @return void|\Zend\Form\Element
+ */
+ public function setValue($value)
+ {
+ if ($value instanceof DateTime) {
+ $value = array(
+ 'year' => $value->format('Y'),
+ 'month' => $value->format('m'),
+ 'day' => $value->format('d')
+ );
+ }
+
+ $this->yearElement->setValue($value['year']);
+ $this->monthElement->setValue($value['month']);
+ $this->dayElement->setValue($value['day']);
+ }
+
+ /**
+ * Prepare the form element (mostly used for rendering purposes)
+ *
+ * @param Form $form
+ * @return mixed
+ */
+ public function prepareElement(Form $form)
+ {
+ parent::prepareElement($form);
+
+ $name = $this->getName();
+ $this->dayElement->setName($name . '[day]');
+ }
+
+ /**
+ * Get validator
+ *
+ * @return ValidatorInterface
+ */
+ protected function getValidator()
+ {
+ if (null === $this->validator) {
+ $this->validator = new DateValidator(array('format' => 'Y-m-d'));
+ }
+
+ return $this->validator;
+ }
+
+ /**
+ * Should return an array specification compatible with
+ * {@link Zend\InputFilter\Factory::createInput()}.
+ *
+ * @return array
+ */
+ public function getInputSpecification()
+ {
+ return array(
+ 'name' => $this->getName(),
+ 'required' => false,
+ 'filters' => array(
+ array(
+ 'name' => 'Callback',
+ 'options' => array(
+ 'callback' => function($date) {
+ // Convert the date to a specific format
+ if (is_array($date)) {
+ $date = $date['year'] . '-' . $date['month'] . '-' . $date['day'];
+ }
+
+ return $date;
+ }
+ )
+ )
+ ),
+ 'validators' => array(
+ $this->getValidator(),
+ )
+ );
+ }
+
+ /**
+ * Clone the element (this is needed by Collection element, as it needs different copies of the elements)
+ */
+ public function __clone()
+ {
+ $this->dayElement = clone $this->dayElement;
+ $this->monthElement = clone $this->monthElement;
+ $this->yearElement = clone $this->yearElement;
+ }
+}
View
313 library/Zend/Form/Element/MonthSelect.php
@@ -0,0 +1,313 @@
+<?php
+/**
+ * Zend Framework (http://framework.zend.com/)
+ *
+ * @link http://github.com/zendframework/zf2 for the canonical source repository
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @package Zend_Form