Skip to content

Commit c3f1470

Browse files
Merge branch '2.7' into 2.8
* 2.7: [travis] update to trusty Fix ArrayInput::toString() for VALUE_IS_ARRAY options/args [ExpressionLanguage] throws an exception on calling uncallable method
2 parents 5d2af1e + cf4f832 commit c3f1470

File tree

9 files changed

+43
-22
lines changed

9 files changed

+43
-22
lines changed

.travis.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: php
22

3-
dist: precise
3+
dist: trusty
44
sudo: false
55

66
git:
@@ -13,17 +13,14 @@ addons:
1313

1414
env:
1515
global:
16-
- MIN_PHP=5.3.9
16+
- MIN_PHP=5.4.9
1717
- SYMFONY_PROCESS_PHP_TEST_BINARY=~/.phpenv/versions/5.6/bin/php
1818

1919
matrix:
2020
include:
21-
# Use the newer stack for HHVM as HHVM does not support Precise anymore since a long time and so Precise has an outdated version
2221
- php: hhvm-3.18
2322
sudo: required
24-
dist: trusty
2523
group: edge
26-
- php: 5.3
2724
- php: 5.4
2825
- php: 5.5
2926
- php: 5.6
@@ -99,7 +96,6 @@ before_install:
9996
echo opcache.enable_cli = 1 >> $INI
10097
echo hhvm.jit = 0 >> $INI
10198
echo apc.enable_cli = 1 >> $INI
102-
echo extension = ldap.so >> $INI
10399
[[ $PHP = 5.* ]] && echo extension = memcache.so >> $INI
104100
if [[ $PHP = 5.* ]]; then
105101
echo extension = mongo.so >> $INI

appveyor.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ init:
1717
install:
1818
- mkdir c:\php && cd c:\php
1919
- appveyor DownloadFile https://raw.githubusercontent.com/symfony/binary-utils/master/cacert.pem
20-
- appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php-5.3.11-nts-Win32-VC9-x86.zip
21-
- 7z x php-5.3.11-nts-Win32-VC9-x86.zip -y >nul
20+
- appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php-5.3.9-nts-Win32-VC9-x86.zip
21+
- 7z x php-5.3.9-nts-Win32-VC9-x86.zip -y >nul
2222
- appveyor DownloadFile https://raw.githubusercontent.com/symfony/binary-utils/master/ICU-51.2-dlls.zip
2323
- 7z x ICU-51.2-dlls.zip -y >nul
2424
- appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php-7.1.3-Win32-VC14-x86.zip
@@ -62,7 +62,7 @@ test_script:
6262
- cd c:\php && 7z x php-7.1.3-Win32-VC14-x86.zip -y >nul && copy /Y php.ini-min php.ini
6363
- cd c:\projects\symfony
6464
- php phpunit src\Symfony --exclude-group benchmark,intl-data || SET X=!errorlevel!
65-
- cd c:\php && 7z x php-5.3.11-nts-Win32-VC9-x86.zip -y >nul && copy /Y php.ini-min php.ini
65+
- cd c:\php && 7z x php-5.3.9-nts-Win32-VC9-x86.zip -y >nul && copy /Y php.ini-min php.ini
6666
- cd c:\projects\symfony
6767
- SET SYMFONY_PHPUNIT_SKIPPED_TESTS=phpunit.skipped
6868
- php phpunit src\Symfony --exclude-group benchmark,intl-data || SET X=!errorlevel!

src/Symfony/Bundle/SecurityBundle/composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@
2424
"symfony/polyfill-php70": "~1.0"
2525
},
2626
"require-dev": {
27-
"symfony/browser-kit": "~2.4|~3.0.0",
27+
"symfony/browser-kit": "~2.7|~3.0.0",
2828
"symfony/console": "~2.7|~3.0.0",
29-
"symfony/css-selector": "^2.0.5|~3.0.0",
30-
"symfony/dom-crawler": "^2.0.5|~3.0.0",
29+
"symfony/css-selector": "^2.7|~3.0.0",
30+
"symfony/dom-crawler": "^2.7|~3.0.0",
3131
"symfony/form": "^2.8.18",
3232
"symfony/framework-bundle": "^2.8.18",
3333
"symfony/http-foundation": "~2.7|~3.0.0",
3434
"symfony/twig-bundle": "~2.7|~3.1.0",
3535
"symfony/twig-bridge": "^2.7.4|~3.1.0",
36-
"symfony/process": "^2.0.5|~3.0.0",
36+
"symfony/process": "^2.7|~3.0.0",
3737
"symfony/validator": "~2.7.25|^2.8.18|~3.2.5",
38-
"symfony/yaml": "^2.0.5|~3.0.0",
39-
"symfony/expression-language": "~2.6|~3.0.0",
38+
"symfony/yaml": "^2.7|~3.0.0",
39+
"symfony/expression-language": "~2.7|~3.0.0",
4040
"doctrine/doctrine-bundle": "~1.2",
4141
"twig/twig": "~1.34|~2.4"
4242
},

src/Symfony/Component/Console/Input/ArrayInput.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,15 @@ public function __toString()
104104
$params = array();
105105
foreach ($this->parameters as $param => $val) {
106106
if ($param && '-' === $param[0]) {
107-
$params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
107+
if (is_array($val)) {
108+
foreach ($val as $v) {
109+
$params[] = $param.('' != $v ? '='.$this->escapeToken($v) : '');
110+
}
111+
} else {
112+
$params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
113+
}
108114
} else {
109-
$params[] = $this->escapeToken($val);
115+
$params[] = is_array($val) ? array_map(array($this, 'escapeToken'), $val) : $this->escapeToken($val);
110116
}
111117
}
112118

src/Symfony/Component/Console/Tests/Input/ArrayInputTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,5 +140,8 @@ public function testToString()
140140
{
141141
$input = new ArrayInput(array('-f' => null, '-b' => 'bar', '--foo' => 'b a z', '--lala' => null, 'test' => 'Foo', 'test2' => "A\nB'C"));
142142
$this->assertEquals('-f -b=bar --foo='.escapeshellarg('b a z').' --lala Foo '.escapeshellarg("A\nB'C"), (string) $input);
143+
144+
$input = new ArrayInput(array('-b' => array('bval_1', 'bval_2'), '--f' => array('fval_1', 'fval_2')));
145+
$this->assertSame('-b=bval_1 -b=bval_2 --f=fval_1 --f=fval_2', (string) $input);
143146
}
144147
}

src/Symfony/Component/ExpressionLanguage/Node/GetAttrNode.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,11 @@ public function evaluate($functions, $values)
8282
if (!is_object($obj)) {
8383
throw new \RuntimeException('Unable to get a property on a non-object.');
8484
}
85+
if (!is_callable($toCall = array($obj, $this->nodes['attribute']->attributes['value']))) {
86+
throw new \RuntimeException(sprintf('Unable to call method "%s" of object "%s".', $this->nodes['attribute']->attributes['value'], get_class($obj)));
87+
}
8588

86-
return call_user_func_array(array($obj, $this->nodes['attribute']->attributes['value']), $this->nodes['arguments']->evaluate($functions, $values));
89+
return call_user_func_array($toCall, $this->nodes['arguments']->evaluate($functions, $values));
8790

8891
case self::ARRAY_CALL:
8992
$array = $this->nodes['node']->evaluate($functions, $values);

src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,16 @@ public function testRegisterAfterEval($registerCallback)
163163
$registerCallback($el);
164164
}
165165

166+
/**
167+
* @expectedException \RuntimeException
168+
* @expectedExceptionMessageRegExp /Unable to call method "\w+" of object "\w+"./
169+
*/
170+
public function testCallBadCallable()
171+
{
172+
$el = new ExpressionLanguage();
173+
$el->evaluate('foo.myfunction()', array('foo' => new \stdClass()));
174+
}
175+
166176
/**
167177
* @dataProvider getRegisterCallbacks
168178
* @expectedException \LogicException

src/Symfony/Component/HttpFoundation/JsonResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function setData($data = array())
121121
$data = json_encode($data, $this->encodingOptions);
122122
} else {
123123
try {
124-
if (\PHP_VERSION_ID < 50400) {
124+
if (!interface_exists('JsonSerializable', false)) {
125125
// PHP 5.3 triggers annoying warnings for some
126126
// types that can't be serialized as JSON (INF, resources, etc.)
127127
// but doesn't provide the JsonSerializable interface.
@@ -153,7 +153,7 @@ public function setData($data = array())
153153
if (\PHP_VERSION_ID < 50500) {
154154
restore_error_handler();
155155
}
156-
if (\PHP_VERSION_ID >= 50400 && 'Exception' === get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) {
156+
if (interface_exists('JsonSerializable', false) && 'Exception' === get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) {
157157
throw $e->getPrevious() ?: $e;
158158
}
159159
throw $e;

src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,13 @@ public function testSetContent()
206206
/**
207207
* @expectedException \Exception
208208
* @expectedExceptionMessage This error is expected
209-
* @requires PHP 5.4
210209
*/
211210
public function testSetContentJsonSerializeError()
212211
{
212+
if (!interface_exists('JsonSerializable', false)) {
213+
$this->markTestSkipped('JsonSerializable is required.');
214+
}
215+
213216
$serializable = new JsonSerializableObject();
214217

215218
JsonResponse::create($serializable);
@@ -224,7 +227,7 @@ public function testSetComplexCallback()
224227
}
225228
}
226229

227-
if (interface_exists('JsonSerializable')) {
230+
if (interface_exists('JsonSerializable', false)) {
228231
class JsonSerializableObject implements \JsonSerializable
229232
{
230233
public function jsonSerialize()

0 commit comments

Comments
 (0)