Skip to content

Commit

Permalink
Merge pull request #4 from stefanotorresi/cleanup/zendframework#7095-…
Browse files Browse the repository at this point in the history
…php-5.3-support-end

Cleanup/zendframework#7095 php 5.3 support end
  • Loading branch information
Ocramius committed Jan 12, 2015
2 parents d1c5d9f + 778b507 commit 3c0484b
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 56 deletions.
38 changes: 25 additions & 13 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
2 changes: 2 additions & 0 deletions library/Zend/Config/Writer/PhpArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Crypt/Key/Derivation/Scrypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
14 changes: 5 additions & 9 deletions library/Zend/Escaper/Escaper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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');
Expand Down
40 changes: 9 additions & 31 deletions library/Zend/Stdlib/CallbackHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
}
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit 3c0484b

Please sign in to comment.