diff --git a/INSTALL.md b/INSTALL.md index 3f6de26a0dc..86d6c1bb9ec 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,14 +1,13 @@ # 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`. +Although Zend Framework requires no special installation steps, +we highly recommend using [Composer][composer]. +However, you can 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`. - -## SYSTEM REQUIREMENTS -------------------- - -Zend Framework 2 requires PHP 5.3.23 or later. +Please refer to the [installation instructions][installation] in the [manual] + for more details. ## DEVELOPMENT VERSIONS @@ -37,11 +36,19 @@ 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: +need to access the framework classes. + +If you're using [Composer][composer], you just need to add `require +"vendor/autoload.php"` at the very beginning of your application main entry +point (i.e. `index.php`). +Please not that this has already been done for you if you're using the +default [ZendSkeletonApplication][ZendSkeletonApplication]. + +However, if you're not using [Composer][composer], there are several other +ways to achieve this: one is to set your PHP `include_path` so that it +contains 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 @@ -61,3 +68,8 @@ 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. + +[manual]: http://framework.zend.com/manual +[installation]: http://framework.zend.com/manual/current/en/ref/installation.html +[composer]: http://getcomposer.org +[ZendSkeletonApplication]: https://github.com/zendframework/ZendSkeletonApplication diff --git a/README.md b/README.md index 5cf4ee9417f..f4bcffe90aa 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@ DD MMM YYY ### UPDATES IN 2.4.0 +- [#7095](https://github.com/zendframework/zf2/issues/7095) drops support for + PHP 5.3 - [#6154](https://github.com/zendframework/zf2/pull/6154) updates `Zend\InputFilter\BaseInputFilter::isValid()` to accept an optional `$context` parameter; if used, this value will be passed to all composed inputs as @@ -30,8 +32,10 @@ Please see [CHANGELOG.md](CHANGELOG.md). ### SYSTEM REQUIREMENTS -Zend Framework 2 requires PHP 5.3.23 or later; we recommend using the -latest PHP version whenever possible. +Zend Framework 2 requires PHP 5.4 or later. +Please be wary that the minimum PHP version may be bumped in subsequent +framework releases; we hence encourage to use [Composer][composer] to ensure +that your application environment satisfies the requirements. ### INSTALLATION diff --git a/library/Zend/Config/Writer/PhpArray.php b/library/Zend/Config/Writer/PhpArray.php index f7d72edc8e3..e2cd538b522 100644 --- a/library/Zend/Config/Writer/PhpArray.php +++ b/library/Zend/Config/Writer/PhpArray.php @@ -20,6 +20,8 @@ class PhpArray extends AbstractWriter /** * @var bool + * + * @todo set default to `true` as soon as https://github.com/zendframework/zf2/issues/5480 is merged */ protected $useBracketArraySyntax = false; diff --git a/library/Zend/Crypt/Key/Derivation/Scrypt.php b/library/Zend/Crypt/Key/Derivation/Scrypt.php index 1841d39f8b6..d59280de296 100644 --- a/library/Zend/Crypt/Key/Derivation/Scrypt.php +++ b/library/Zend/Crypt/Key/Derivation/Scrypt.php @@ -325,7 +325,7 @@ protected static function integerify($b) * @param string $hex * @return string * - * @deprecated since PHP 5.4, hex2bin is available + * @deprecated since 2.4, PHP 5.4 provides hex2bin */ protected static function hex2bin($hex) { diff --git a/library/Zend/Escaper/Escaper.php b/library/Zend/Escaper/Escaper.php index 072d543f711..9c4f711f6ab 100644 --- a/library/Zend/Escaper/Escaper.php +++ b/library/Zend/Escaper/Escaper.php @@ -41,13 +41,11 @@ class Escaper /** * Holds the value of the special flags passed as second parameter to - * htmlspecialchars(). We modify these for PHP 5.4 to take advantage - * of the new ENT_SUBSTITUTE flag for correctly dealing with invalid - * UTF-8 sequences. + * htmlspecialchars(). * * @var string */ - protected $htmlSpecialCharsFlags = ENT_QUOTES; + protected $htmlSpecialCharsFlags; /** * Static Matcher which escapes characters for HTML Attribute contexts @@ -89,8 +87,7 @@ class Escaper /** * Constructor: Single parameter allows setting of global encoding for use by - * the current object. If PHP 5.4 is detected, additional ENT_SUBSTITUTE flag - * is set for htmlspecialchars() calls. + * the current object. * * @param string $encoding * @throws Exception\InvalidArgumentException @@ -116,9 +113,8 @@ public function __construct($encoding = null) $this->encoding = $encoding; } - if (defined('ENT_SUBSTITUTE')) { - $this->htmlSpecialCharsFlags|= ENT_SUBSTITUTE; - } + // We take advantage of ENT_SUBSTITUTE flag to correctly deal with invalid UTF-8 sequences. + $this->htmlSpecialCharsFlags = ENT_QUOTES | ENT_SUBSTITUTE; // set matcher callbacks $this->htmlAttrMatcher = array($this, 'htmlAttrMatcher'); diff --git a/library/Zend/Stdlib/CallbackHandler.php b/library/Zend/Stdlib/CallbackHandler.php index 158b0c7d647..69c61676e62 100644 --- a/library/Zend/Stdlib/CallbackHandler.php +++ b/library/Zend/Stdlib/CallbackHandler.php @@ -34,8 +34,10 @@ class CallbackHandler /** * PHP version is greater as 5.4rc1? * @var bool + * + * @deprecated since 2.4 */ - protected static $isPhp54; + protected static $isPhp54 = true; /** * Constructor @@ -85,14 +87,9 @@ public function call(array $args = array()) { $callback = $this->getCallback(); - // Minor performance tweak, if the callback gets called more than once - if (!isset(static::$isPhp54)) { - static::$isPhp54 = version_compare(PHP_VERSION, '5.4.0rc1', '>='); - } - $argCount = count($args); - if (static::$isPhp54 && is_string($callback)) { + if (is_string($callback)) { $result = $this->validateStringCallbackFor54($callback); if ($result !== true && $argCount <= 3) { @@ -103,34 +100,17 @@ public function call(array $args = array()) } } - // Minor performance tweak; use call_user_func() until > 3 arguments + // Minor performance tweak; use call_user_func_array() with > 3 arguments // reached switch ($argCount) { case 0: - if (static::$isPhp54) { - return $callback(); - } - return call_user_func($callback); + return $callback(); case 1: - if (static::$isPhp54) { - return $callback(array_shift($args)); - } - return call_user_func($callback, array_shift($args)); + return $callback($args[0]); case 2: - $arg1 = array_shift($args); - $arg2 = array_shift($args); - if (static::$isPhp54) { - return $callback($arg1, $arg2); - } - return call_user_func($callback, $arg1, $arg2); + return $callback($args[0], $args[1]); case 3: - $arg1 = array_shift($args); - $arg2 = array_shift($args); - $arg3 = array_shift($args); - if (static::$isPhp54) { - return $callback($arg1, $arg2, $arg3); - } - return call_user_func($callback, $arg1, $arg2, $arg3); + return $callback($args[0], $args[1], $args[2]); default: return call_user_func_array($callback, $args); } @@ -173,8 +153,6 @@ public function getMetadatum($name) /** * Validate a static method call * - * Validates that a static method call in PHP 5.4 will actually work - * * @param string $callback * @return true|array * @throws Exception\InvalidCallbackException if invalid diff --git a/library/Zend/Stdlib/JsonSerializable/PhpLegacyCompatibility.php b/library/Zend/Stdlib/JsonSerializable/PhpLegacyCompatibility.php index ecc7525d4cd..6f67cfb7f58 100644 --- a/library/Zend/Stdlib/JsonSerializable/PhpLegacyCompatibility.php +++ b/library/Zend/Stdlib/JsonSerializable/PhpLegacyCompatibility.php @@ -15,6 +15,8 @@ * JsonSerializable was introduced in PHP 5.4.0. * * @see http://php.net/manual/class.jsonserializable.php + * + * @deprecated since 2.4 */ interface PhpLegacyCompatibility {