8000 [3.0] Update required PHP to 5.5.9 by nicolas-grekas · Pull Request #12522 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[3.0] Update required PHP to 5.5.9 #12522

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 30, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[3.0] Removed some old hacks
  • Loading branch information
GrahamCampbell authored and nicolas-grekas committed Dec 30, 2014
commit 35e0845f237df0ab065c43a7621ce2e5946a08c6
21 changes: 1 addition & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,13 @@ README
What is Symfony?
-----------------

Symfony is a PHP 5.3 full-stack web framework. It is written with speed and
Symfony is a PHP full-stack web framework. It is written with speed and
flexibility in mind. It allows developers to build better and easy to maintain
websites with PHP.

Symfony can be used to develop all kind of websites, from your personal blog
to high traffic ones like Dailymotion or Yahoo! Answers.

Requirements
------------

Symfony is only supported on PHP 5.3.3 and up.

Be warned that PHP versions before 5.3.8 are known to be buggy and might not
work for you:

* before PHP 5.3.4, if you get "Notice: Trying to get property of
non-object", you've hit a known PHP bug (see
https://bugs.php.net/bug.php?id=52083 and
https://bugs.php.net/bug.php?id=50027);

* before PHP 5.3.8, if you get an error involving annotations, you've hit a
known PHP bug (see https://bugs.php.net/bug.php?id=55156).

* PHP 5.3.16 has a major bug in the Reflection subsystem and is not suitable to
run Symfony (https://bugs.php.net/bug.php?id=62715)

Installation
------------

Expand Down
6 changes: 3 additions & 3 deletions autoload.php.dist
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

if (PHP_VERSION_ID >= 50400 && gc_enabled()) {
// Disabling Zend Garbage Collection to prevent segfaults with PHP5.4+
// https://bugs.php.net/bug.php?id=53976
// Disabling Zend Garbage Collection to prevent segfaults
// https://bugs.php.net/bug.php?id=53976
if (gc_enabled()) {
gc_disable();
}

Expand Down

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions src/Symfony/Bridge/Twig/Command/LintCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@

namespace Symfony\Bridge\Twig\Command;

if (!defined('JSON_PRETTY_PRINT')) {
define('JSON_PRETTY_PRINT', 128);
}

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand Down
6 changes: 1 addition & 5 deletions src/Symfony/Bridge/Twig/Extension/CodeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,7 @@ public function formatFile($file, $line, $text = null)
$text = "$text at line $line";

if (false !== $link = $this->getFileLink($file, $line)) {
if (PHP_VERSION_ID >= 50400) {
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
} else {
$flags = ENT_QUOTES;
}
$flags = ENT_QUOTES | ENT_SUBSTITUTE;

return sprintf('<a href="%s" title="Click to open this file" class="file_link">%s</a>', htmlspecialchars($link, $flags, $this->charset), $text);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/Tests/Node/DumpNodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function testOneVar()
}

EOTXT;
$expected = preg_replace('/%(.*?)%/', version_compare(PHP_VERSION, '5.4.0') >= 0 ? '(isset($context["$1"]) ? $context["$1"] : null)' : '$this->getContext($context, "$1")', $expected);
$expected = preg_replace('/%(.*?)%/', '(isset($context["$1"]) ? $context["$1"] : null)', $expected);

$this->assertSame($expected, $compiler->compile($node)->getSource());
}
Expand All @@ -82,7 +82,7 @@ public function testMultiVars()
}

EOTXT;
$expected = preg_replace('/%(.*?)%/', version_compare(PHP_VERSION, '5.4.0') >= 0 ? '(isset($context["$1"]) ? $context["$1"] : null)' : '$this->getContext($context, "$1")', $expected);
$expected = preg_replace('/%(.*?)%/', '(isset($context["$1"]) ? $context["$1"] : null)', $expected);

$this->assertSame($expected, $compiler->compile($node)->getSource());
}
Expand Down
6 changes: 1 addition & 5 deletions src/Symfony/Bridge/Twig/Tests/Node/FormThemeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ public function testCompile()

protected function getVariableGetter($name)
{
if (PHP_VERSION_ID >= 50400) {
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
}

return sprintf('$this->getContext($context, "%s")', $name);
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,6 @@ public function testCompileLabelWithLabelThatEvaluatesToNullAndAttributes()

protected function getVariableGetter($name)
{
if (PHP_VERSION_ID >= 50400) {
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
}

return sprintf('$this->getContext($context, "%s")', $name);
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
}
}
12 changes: 2 additions & 10 deletions src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,11 @@ public function testCompileStrict()
}
protected function getVariableGetterWithoutStrictCheck($name)
{
if (PHP_VERSION_ID >= 50400) {
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
}

return sprintf('$this->getContext($context, "%s", true)', $name);
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
}

protected function getVariableGetterWithStrictCheck($name)
{
if (PHP_VERSION_ID >= 50400) {
return sprintf('(isset($context["%s"]) ? $context["%s"] : $this->getContext($context, "%s"))', $name, $name, $name);
}

return sprintf('$this->getContext($context, "%s")', $name);
return sprintf('(isset($context["%s"]) ? $context["%s"] : $this->getContext($context, "%s"))', $name, $name, $name);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ abstract class ServerCommand extends ContainerAwareCommand
*/
public function isEnabled()
{
if (version_compare(phpversion(), '5.4.0', '<') || defined('HHVM_VERSION')) {
if (defined('HHVM_VERSION')) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ServerRunCommand extends ContainerAwareCommand
*/
public function isEnabled()
{
if (PHP_VERSION_ID < 50400 || defined('HHVM_VERSION')) {
if (defined('HHVM_VERSION')) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@

namespace Symfony\Bundle\FrameworkBundle\Command;

if (!defined('JSON_PRETTY_PRINT')) {
define('JSON_PRETTY_PRINT', 128);
}

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@

namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor;

if (!defined('JSON_PRETTY_PRINT')) {
define('JSON_PRETTY_PRINT', 128);
}

use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,14 +498,7 @@ private function addValidationSection(ArrayNodeDefinition $rootNode)
->validate()
->ifTrue(function ($v) { return !isset($v['validation']['api']) || 'auto' === $v['validation']['api']; })
->then(function ($v) {
// This condition is duplicated in ValidatorBuilder. This
// duplication is necessary in order to know the desired
// API version already during container configuration
// (to adjust service classes etc.)
// See https://github.com/symfony/symfony/issues/11580
$v['validation']['api'] = PHP_VERSION_ID < 50309
? '2.4'
: '2.5-bc';
$v['validation']['api'] = '2.5-bc';

return $v;
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,7 @@ public function formatFile($file, $line, $text = null)
}

if (false !== $link = $this->getFileLink($file, $line)) {
if (PHP_VERSION_ID >= 50400) {
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
} else {
$flags = ENT_QUOTES;
}
$flags = ENT_QUOTES | ENT_SUBSTITUTE;

return sprintf('<a href="%s" title="Click to open this file" class="file_link">%s</a>', htmlspecialchars($link, $flags, $this->charset), $text);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@

class JsonDescriptorTest extends AbstractDescriptorTest
{
protected function setUp()
{
if (PHP_VERSION_ID < 50400) {
$this->markTestSkipped('Test skipped on PHP 5.3 as JSON_PRETTY_PRINT does not exist.');
}
}

protected function getDescriptor()
{
return new JsonDescriptor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ protected static function getBundleDefaultConfig()
'static_method' => array('loadValidatorMetadata'),
'translation_domain' => 'validators',
'strict_email' => false,
'api' => PHP_VERSION_ID < 50309 ? '2.4' : '2.5-bc',
'api' => '2.5-bc',
),
'annotations' => array(
'cache' => 'file',
Expand Down
B41A
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,7 @@ public function testValidation()
$this->assertEquals(array(new Reference('validator.mapping.cache.apc')), $calls[5][1]);
$this->assertSame('setApiVersion', $calls[6][0]);

if (PHP_VERSION_ID < 50309) {
$this->assertEquals(array(Validation::API_VERSION_2_4), $calls[6][1]);
} else {
$this->assertEquals(array(Validation::API_VERSION_2_5_BC), $calls[6][1]);
}
$this->assertEquals(array(Validation::API_VERSION_2_5_BC), $calls[6][1]);
}

public function testFullyConfiguredValidationService()
Expand Down Expand Up @@ -448,11 +444,7 @@ public function testValidationImplicitApi()
$this->assertSame('setApiVersion', $calls[5][0]);
// no cache, no annotations

if (PHP_VERSION_ID < 50309) {
$this->assertSame(array(Validation::API_VERSION_2_4), $calls[5][1]);
} else {
$this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]);
}
$this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]);
}

/**
Expand All @@ -472,11 +464,7 @@ public function testValidationAutoApi()
$this->assertSame('setApiVersion', $calls[5][0]);
// no cache, no annotations

if (PHP_VERSION_ID < 50309) {
$this->assertSame(array(Validation::API_VERSION_2_4), $calls[5][1]);
} else {
$this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]);
}
$this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]);
}

public function testFormsCanBeEnabledWithoutCsrfProtection()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ public function testRoutingErrorIsNotExposedForProtectedResourceWhenAnonymous($c
*/
public function testRoutingErrorIsExposedWhenNotProtected($config)
{
if (defined('PHP_WINDOWS_VERSION_BUILD') && PHP_VERSION_ID < 50309) {
$this->markTestSkipped('Test hangs on Windows & PHP due to https://bugs.php.net/bug.php?id=60120 fixed in http://svn.php.net/viewvc?view=revision&revision=318366');
}

$client = $this->createClient(array('test_case' => 'StandardFormLogin', 'root_config' => $config));
$client->insulate();
$client->request('GET', '/unprotected_resource');
Expand All @@ -46,10 +42,6 @@ public function testRoutingErrorIsExposedWhenNotProtected($config)
*/
public function testRoutingErrorIsNotExposedForProtectedResourceWhenLoggedInWithInsufficientRights($config)
{
if (defined('PHP_WINDOWS_VERSION_BUILD') && PHP_VERSION_ID < 50309) {
$this->markTestSkipped('Test hangs on Windows & PHP due to https://bugs.php.net/bug.php?id=60120 fixed in http://svn.php.net/viewvc?view=revision&revision=318366');
}

$client = $this->createClient(array('test_case' => 'StandardFormLogin', 'root_config' => $config));
$client->insulate();

Expand Down
5 changes: 1 addition & 4 deletions src/Symfony/Component/ClassLoader/ClassCollectionLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ public static function load($classes, $cacheDir, $name, $autoReload, $adaptive =

self::$loaded[$name] = true;

$declared = array_merge(get_declared_classes(), get_declared_interfaces());
if (function_exists('get_declared_traits')) {
$declared = array_merge($declared, get_declared_traits());
}
$declared = array_merge(get_declared_classes(), get_declared_interfaces(), get_declared_traits());

if ($adaptive) {
// don't include already declared classes
Expand Down
10 changes: 1 addition & 9 deletions src/Symfony/Component/ClassLoader/ClassMapGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@

namespace Symfony\Component\ClassLoader;

if (!defined('SYMFONY_TRAIT')) {
if (PHP_VERSION_ID >= 50400) {
define('SYMFONY_TRAIT', T_TRAIT);
} else {
define('SYMFONY_TRAIT', 0);
}
}

/**
* ClassMapGenerator.
*
Expand Down Expand Up @@ -117,7 +109,7 @@ private static function findClasses($path)
break;
case T_CLASS:
case T_INTERFACE:
case SYMFONY_TRAIT:
case T_TRAIT:
// Find the classname
while (($t = $tokens[++$i]) && is_array($t)) {
if (T_STRING === $t[0]) {
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/ClassLoader/DebugClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function loadClass($class)
if ($file = $this->classFinder->findFile($class)) {
require $file;

if (!class_exists($class, false) && !interface_exists($class, false) && (!function_exists('trait_exists') || !trait_exists($class, false))) {
if (!class_exists($class, false) && !interface_exists($class, false) && !trait_exists($class, false)) {
if (false !== strpos($class, '/')) {
throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function loadClass($class)
if ($file = $this->findFile($class)) {
require $file;

if (!class_exists($class, false) && !interface_exists($class, false) && (!function_exists('trait_exists') || !trait_exists($class, false))) {
if (!class_exists($class, false) && !interface_exists($class, false) && !trait_exists($class, false)) {
throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file));
}
}
Expand Down
Loading
0