8000 Merge branch '3.0' · symfony/symfony@28e0f7b · GitHub
[go: up one dir, main page]

Skip to content

Commit 28e0f7b

Browse files
Merge branch '3.0'
* 3.0: prefer phpunit 5.x on hhvm Reflected the change of the choice_value option in the Upgrade information [FrameworkBundle][HttpKernel] the finder is required to discover bundle commands [travis] Auto-conf deps=high matrix line [FrameworkBundle] fixes outdated phpdoc on Controller::createForm() method. fix error level for deprecation Fix the logout path when not using the router Fix the logout path when not using the router [Form] cast IDs to match deprecated behaviour of EntityChoiceList [FrameworkBundle] minor: fix property_info service name in composer.json [HttpFoundation] Added the ability of mapping stream wrapper protocols when using X-Sendfile [HttpFoundation] Add a test case for using BinaryFileResponse with stream wrappers CSS min-height and min-width should not be "auto"
2 parents 2a99121 + f6f8819 commit 28e0f7b

File tree

14 files changed

+301
-61
lines changed

14 files changed

+301
-61
lines changed

.travis.yml

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,60 +7,58 @@ addons:
77
- parallel
88
- language-pack-fr-base
99

10-
cache:
11-
directories:
12-
- .phpunit
13-
- php-5.5.9
10+
env:
11+
global:
12+
- MIN_PHP=5.5.9
1413

1514
matrix:
1615
include:
1716
- php: hhvm
1817
- php: 5.5
1918
- php: 5.6
20-
- php: 5.6
21-
env: deps=2.8
19+
env: deps=high
2220
- php: 7.0
2321
env: deps=low
2422
fast_finish: true
2523

26-
services: mongodb
24+
cache:
25+
directories:
26+
- .phpunit
27+
- php-$MIN_PHP
2728

28-
env:
29-
global:
30-
- deps=no
31-
- SYMFONY_DEPRECATIONS_HELPER=weak
29+
services: mongodb
3230

3331
before_install:
34-
- if [[ "$deps" = "no" ]] && [[ "$TRAVIS_PHP_VERSION" = 5.6 ]] && [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then export deps=skip; fi;
35-
- if [[ $deps = no && $TRAVIS_PHP_VERSION = 5.5 && ! -d php-5.5.9/sapi ]]; then wget http://museum.php.net/php5/php-5.5.9.tar.bz2; tar -xjf php-5.5.9.tar.bz2; (cd php-5.5.9; ./configure --enable-sigchild --enable-pcntl; make -j2); fi;
36-
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then INI_FILE=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; else INI_FILE=/etc/hhvm/php.ini; fi;
37-
- echo "memory_limit = -1" >> $INI_FILE
38-
- echo "session.gc_probability = 0" >> $INI_FILE
39-
- if [ "$deps" != "skip" ]; then composer self-update; fi;
40-
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then phpenv config-rm xdebug.ini; fi;
41-
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then echo "extension = mongo.so" >> $INI_FILE; fi;
42-
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then echo "extension = memcache.so" >> $INI_FILE; fi;
43-
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.8 && echo "apc.enable_cli = 1" >> $INI_FILE) || echo "Let's continue without apcu extension"; fi;
44-
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then pecl install -f memcached-2.1.0 || echo "Let's continue without memcached extension"; fi;
45-
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]] && [ "$deps" = "no" ]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo "extension = $(pwd)/modules/symfony_debug.so" >> $INI_FILE); fi;
46-
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "extension = ldap.so" >> $INI_FILE; fi;
47-
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi;
48-
- if [ "$deps" != "skip" ]; then ./phpunit install; fi;
49-
- export PHPUNIT="$(readlink -f ./phpunit)"
32+
- if [[ ! $deps && ! $TRAVIS_PHP_VERSION = ${MIN_PHP%.*} && $TRAVIS_PHP_VERSION != hhvm && $TRAVIS_PULL_REQUEST != false ]]; then deps=skip; fi;
33+
- if [[ ! $deps && ! -d php-$MIN_PHP/sapi ]]; then wget http://museum.php.net/php5/php-$MIN_PHP.tar.bz2 -O - | tar -xj; (cd php-$MIN_PHP; ./configure --enable-sigchild --enable-pcntl; make -j2); fi;
34+
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then INI_FILE=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; else INI_FILE=/etc/hhvm/php.ini; fi;
35+
- echo memory_limit = -1 >> $INI_FILE
36+
- echo session.gc_probability = 0 >> $INI_FILE
37+
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then echo extension = mongo.so >> $INI_FILE; fi;
38+
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then echo extension = memcache.so >> $INI_FILE; fi;
39+
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.10 && echo apc.enable_cli = 1 >> $INI_FILE) || echo "Let's continue without apcu extension"; fi;
40+
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then pecl install -f memcached-2.1.0 || echo "Let's continue without memcached extension"; fi;
41+
- if [[ $TRAVIS_PHP_VERSION = 5.* && ! $deps ]]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> $INI_FILE); fi;
42+
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then echo extension = ldap.so >> $INI_FILE; fi;
43+
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then phpenv config-rm xdebug.ini; fi;
44+
- if [[ $deps != skip ]]; then composer self-update; fi;
45+
- if [[ $deps != skip ]]; then ./phpunit install; fi;
46+
- export PHPUNIT=$(readlink -f ./phpunit)
5047

5148
install:
52-
- if [ "$TRAVIS_BRANCH" = "master" ]; then export COMPOSER_ROOT_VERSION=dev-master; else export COMPOSER_ROOT_VERSION="$TRAVIS_BRANCH".x-dev; fi;
53-
- if [ "$deps" = "no" ]; then export SYMFONY_DEPRECATIONS_HELPER=strict; fi;
54-
- if [ "$deps" = "no" ]; then composer --prefer-source install; fi;
55-
- if [ "$deps" != "skip" ]; then COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi;
56-
- if [ "$deps" != "skip" ] && [ "$deps" != "no" ]; then php .travis.php $TRAVIS_COMMIT_RANGE $TRAVIS_BRANCH $COMPONENTS; fi;
57-
- if [ "$deps" = "2.8" ]; then git fetch origin 2.8; git checkout -m FETCH_HEAD; export COMPOSER_ROOT_VERSION=2.8.x-dev; fi;
49+
- if [[ $deps != skip ]]; then COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi;
50+
- if [[ $deps != skip && $deps ]]; then php .travis.php $TRAVIS_COMMIT_RANGE $TRAVIS_BRANCH $COMPONENTS; fi;
51+
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then SYMFONY_VERSION=$(git branch -r | grep -o '/[1-9].*' | tail -n 1 | sed s/.//); else SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*'); fi;
52+
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then git fetch origin $SYMFONY_VERSION; git checkout -m FETCH_HEAD; fi;
53+
- if [[ $deps = high && ${SYMFONY_VERSION%.*} != $(git show $(git branch -r | grep -FA1 /$SYMFONY_VERSION | tail -n 1):composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9]*' | head -n 1) ]]; then LEGACY=,legacy; fi;
54+
- export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev;
55+
- if [[ ! $deps ]]; then composer --prefer-source install; else export SYMFONY_DEPRECATIONS_HELPER=weak; fi;
56+
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi;
5857

5958
script:
60-
- if [ "$deps" = "no" ]; then echo "$COMPONENTS" | parallel --gnu '$PHPUNIT --exclude-group tty,benchmark,intl-data {}'; fi;
61-
- if [ "$deps" = "no" ]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty; fi;
62-
- if [[ $deps = no && $TRAVIS_PHP_VERSION = 5.5 ]]; then echo -e "1\\n0" | parallel --gnu 'echo -e "\\nPHP --enable-sigchild enhanced={}" && ENHANCE_SIGCHLD={} php-5.5.9/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/'; fi;
63-
- if [ "$deps" = "high" ]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer --prefer-source update; $PHPUNIT --exclude-group tty,benchmark,intl-data'; fi;
64-
- if [ "$deps" = "low" ]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer --prefer-source --prefer-lowest --prefer-stable update; $PHPUNIT --exclude-group tty,benchmark,intl-data'; fi;
65-
- if [ "$deps" = "2.8" ]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer --prefer-source update; $PHPUNIT --exclude-group tty,benchmark,intl-data,legacy'; fi;
66-
- if [ "$deps" = "skip" ]; then echo 'This matrix line is skipped for pull requests.'; fi;
59+
- if [[ ! $deps ]]; then echo "$COMPONENTS" | parallel --gnu '$PHPUNIT --exclude-group tty,benchmark,intl-data {}'; fi;
60+
- if [[ ! $deps ]]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty; fi;
61+
- if [[ ! $deps && $TRAVIS_PHP_VERSION = ${MIN_PHP%.*} ]]; then echo -e "1\\n0" | parallel --gnu 'echo -e "\\nPHP --enable-sigchild enhanced={}" && ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/'; fi;
62+
- if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer --prefer-source update; $PHPUNIT --exclude-group tty,benchmark,intl-data'$LEGACY; fi;
63+
- if [[ $deps = low ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer --prefer-source --prefer-lowest --prefer-stable update; $PHPUNIT --exclude-group tty,benchmark,intl-data'; fi;
64+
- if [[ $deps = skip ]]; then echo This matrix line is skipped for pull requests.; fi;

UPGRADE-3.0.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,42 @@ UPGRADE FROM 2.x to 3.0
395395
}
396396
}
397397
```
398+
399+
* In Symfony 2.7 a small BC break was introduced with the new choices_as_values
400+
option. In order to have the choice values populated to the html value attribute
401+
you had to define the choice_value option. This is now not any more needed.
402+
403+
Before:
404+
405+
```php
406+
$form->add('status', 'choice', array(
407+
'choices' => array(
408+
'Enabled' => Status::ENABLED,
409+
'Disabled' => Status::DISABLED,
410+
'Ignored' => Status::IGNORED,
411+
),
412+
// choices_as_values defaults to true in Symfony 3.0
413+
// and setting it to anything else is deprecated as of 3.0
414+
'choices_as_values' => true,
415+
// important if you rely on your option value attribute (e.g. for JavaScript)
416+
// this will keep the same functionality as before
417+
'choice_value' => function ($choice) {
418+
return $choice;
419+
},
420+
));
421+
```
422+
423+
After:
424+
425+
```php
426+
$form->add('status', ChoiceType::class, array(
427+
'choices' => array(
428+
'Enabled' => Status::ENABLED,
429+
'Disabled' => Status::DISABLED,
430+
'Ignored' => Status::IGNORED,
431+
)
432+
));
433+
```
398434

399435
* The `request` service was removed. You must inject the `request_stack`
400436
service instead.

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ install:
2222
- IF %PHP%==1 7z x php-5.5.9-nts-Win32-VC11-x86.zip -y >nul
2323
- IF %PHP%==1 del /Q *.zip
2424
- IF %PHP%==1 cd ext
25-
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/apcu/4.0.8/php_apcu-4.0.8-5.5-nts-vc11-x86.zip
26-
- IF %PHP%==1 7z x php_apcu-4.0.8-5.5-nts-vc11-x86.zip -y >nul
25+
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/apcu/4.0.10/php_apcu-4.0.10-5.5-nts-vc11-x86.zip
26+
- IF %PHP%==1 7z x php_apcu-4.0.10-5.5-nts-vc11-x86.zip -y >nul
2727
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/pecl/releases/memcache/3.0.8/php_memcache-3.0.8-5.5-nts-vc11-x86.zip
2828
- IF %PHP%==1 7z x php_memcache-3.0.8-5.5-nts-vc11-x86.zip -y >nul
2929
- IF %PHP%==1 del /Q *.zip

phpunit

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ use Symfony\Component\Process\ProcessUtils;
1818
error_reporting(-1);
1919
require __DIR__.'/src/Symfony/Component/Process/ProcessUtils.php';
2020

21-
// PHPUnit 4.8 does not support PHP 7, while 5.0 requires PHP 5.6+
22-
$PHPUNIT_VERSION = PHP_VERSION_ID >= 70000 ? '5.0' : '4.8';
21+
// PHPUnit 4.8 does not support PHP 7, while 5.1 requires PHP 5.6+
22+
$PHPUNIT_VERSION = PHP_VERSION_ID >= 50600 ? '5.1' : '4.8';
2323
$PHPUNIT_DIR = __DIR__.'/.phpunit';
2424
$PHP = defined('PHP_BINARY') ? PHP_BINARY : 'php';
2525
$PHP = ProcessUtils::escapeArgument($PHP);
@@ -64,10 +64,6 @@ Symfony\Bridge\PhpUnit\TextUI\Command::main();
6464
EOPHP
6565
);
6666
chdir('..');
67-
if (file_exists('../src/Symfony/Bridge/PhpUnit') && `git diff --name-only HEAD^ -- ../src/Symfony/Bridge/PhpUnit`) {
68-
passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? '(del /S /F /Q %s & rmdir %1$s) >nul': 'rm -rf %s', str_replace('/', DIRECTORY_SEPARATOR, "phpunit-$PHPUNIT_VERSION/vendor/symfony/phpunit-bridge")));
69-
symlink(realpath('../src/Symfony/Bridge/PhpUnit'), "phpunit-$PHPUNIT_VERSION/vendor/symfony/phpunit-bridge");
70-
}
7167
file_put_contents(".$PHPUNIT_VERSION.md5", md5_file(__FILE__));
7268
chdir($oldPwd);
7369

src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public function loadChoicesForValues(array $values, $value = null)
156156
// "INDEX BY" clause to the Doctrine query in the loader,
157157
// but I'm not sure whether that's doable in a generic fashion.
158158
foreach ($unorderedObjects as $object) {
159-
$objectsById[$this->idReader->getIdValue($object)] = $object;
159+
$objectsById[(string) $this->idReader->getIdValue($object)] = $object;
160160
}
161161

162162
foreach ($values as $i => $id) {
Lines changed: 57 additions & 0 deletions
< 2851 /tr>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bridge\Doctrine\Tests\Fixtures;
13+
14+
use Doctrine\ORM\Mapping\Column;
15+
use Doctrine\ORM\Mapping\Entity;
16+
use Doctrine\ORM\Mapping\GeneratedValue;
17+
use Doctrine\ORM\Mapping\Id;
18+
19+
/** @Entity */
20+
class SingleStringCastableIdEntity
21+
{
22+
/**
23+
* @Id
24+
* @Column(type="string")
25+
* @GeneratedValue(strategy="NONE")
26+
*/
27+
protected $id;
28+
29+
/** @Column(type="string", nullable=true) */
30+
public $name;
31+
32+
public function __construct($id, $name)
33+
{
34+
$this->id = new StringCastableObjectIdentity($id);
35+
$this->name = $name;
36+
}
37+
38+
public function __toString()
39+
{
40+
return (string) $this->name;
41+
}
42+
}
43+
44+
class StringCastableObjectIdentity
45+
{
46+
protected $id;
47+
48+
public function __construct($id)
49+
{
50+
$this->id = $id;
51+
}
52+
53+
public function __toString()
54+
{
55+
return (string) $this->id;
56+
}
57+
}

0 commit comments

Comments
 (0)
0