diff --git a/.travis.yml b/.travis.yml index b7ce58bd8f..e01ab63ab3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: php -dist: precise +dist: trusty sudo: false git: @@ -13,17 +13,14 @@ addons: env: global: - - MIN_PHP=5.3.9 + - MIN_PHP=5.4.9 - SYMFONY_PROCESS_PHP_TEST_BINARY=~/.phpenv/versions/5.6/bin/php matrix: include: - # Use the newer stack for HHVM as HHVM does not support Precise anymore since a long time and so Precise has an outdated version - php: hhvm-3.18 sudo: required - dist: trusty group: edge - - php: 5.3 - php: 5.4 - php: 5.5 - php: 5.6 @@ -99,7 +96,6 @@ before_install: echo opcache.enable_cli = 1 >> $INI echo hhvm.jit = 0 >> $INI echo apc.enable_cli = 1 >> $INI - echo extension = ldap.so >> $INI [[ $PHP = 5.* ]] && echo extension = memcache.so >> $INI if [[ $PHP = 5.* ]]; then echo extension = mongo.so >> $INI diff --git a/appveyor.yml b/appveyor.yml index 6141b988ce..3f7d1202c4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,8 +17,8 @@ init: install: - mkdir c:\php && cd c:\php - appveyor DownloadFile https://raw.githubusercontent.com/symfony/binary-utils/master/cacert.pem - - appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php-5.3.11-nts-Win32-VC9-x86.zip - - 7z x php-5.3.11-nts-Win32-VC9-x86.zip -y >nul + - appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php-5.3.9-nts-Win32-VC9-x86.zip + - 7z x php-5.3.9-nts-Win32-VC9-x86.zip -y >nul - appveyor DownloadFile https://raw.githubusercontent.com/symfony/binary-utils/master/ICU-51.2-dlls.zip - 7z x ICU-51.2-dlls.zip -y >nul - 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: - cd c:\php && 7z x php-7.1.3-Win32-VC14-x86.zip -y >nul && copy /Y php.ini-min php.ini - cd c:\projects\symfony - php phpunit src\Symfony --exclude-group benchmark,intl-data || SET X=!errorlevel! - - cd c:\php && 7z x php-5.3.11-nts-Win32-VC9-x86.zip -y >nul && copy /Y php.ini-min php.ini + - cd c:\php && 7z x php-5.3.9-nts-Win32-VC9-x86.zip -y >nul && copy /Y php.ini-min php.ini - cd c:\projects\symfony - SET SYMFONY_PHPUNIT_SKIPPED_TESTS=phpunit.skipped - php phpunit src\Symfony --exclude-group benchmark,intl-data || SET X=!errorlevel! diff --git a/src/Symfony/Bundle/SecurityBundle/composer.json b/src/Symfony/Bundle/SecurityBundle/composer.json index 04fd647305..e847709765 100644 --- a/src/Symfony/Bundle/SecurityBundle/composer.json +++ b/src/Symfony/Bundle/SecurityBundle/composer.json @@ -24,19 +24,19 @@ "symfony/polyfill-php70": "~1.0" }, "require-dev": { - "symfony/browser-kit": "~2.4|~3.0.0", + "symfony/browser-kit": "~2.7|~3.0.0", "symfony/console": "~2.7|~3.0.0", - "symfony/css-selector": "^2.0.5|~3.0.0", - "symfony/dom-crawler": "^2.0.5|~3.0.0", + "symfony/css-selector": "^2.7|~3.0.0", + "symfony/dom-crawler": "^2.7|~3.0.0", "symfony/form": "^2.8.18", "symfony/framework-bundle": "^2.8.18", "symfony/http-foundation": "~2.7|~3.0.0", "symfony/twig-bundle": "~2.7|~3.1.0", "symfony/twig-bridge": "^2.7.4|~3.1.0", - "symfony/process": "^2.0.5|~3.0.0", + "symfony/process": "^2.7|~3.0.0", "symfony/validator": "~2.7.25|^2.8.18|~3.2.5", - "symfony/yaml": "^2.0.5|~3.0.0", - "symfony/expression-language": "~2.6|~3.0.0", + "symfony/yaml": "^2.7|~3.0.0", + "symfony/expression-language": "~2.7|~3.0.0", "doctrine/doctrine-bundle": "~1.2", "twig/twig": "~1.34|~2.4" }, diff --git a/src/Symfony/Component/Console/Input/ArrayInput.php b/src/Symfony/Component/Console/Input/ArrayInput.php index af4c204bba..0bff15e229 100644 --- a/src/Symfony/Component/Console/Input/ArrayInput.php +++ b/src/Symfony/Component/Console/Input/ArrayInput.php @@ -104,9 +104,15 @@ class ArrayInput extends Input $params = array(); foreach ($this->parameters as $param => $val) { if ($param && '-' === $param[0]) { - $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : ''); + if (is_array($val)) { + foreach ($val as $v) { + $params[] = $param.('' != $v ? '='.$this->escapeToken($v) : ''); + } + } else { + $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : ''); + } } else { - $params[] = $this->escapeToken($val); + $params[] = is_array($val) ? array_map(array($this, 'escapeToken'), $val) : $this->escapeToken($val); } } diff --git a/src/Symfony/Component/Console/Tests/Input/ArrayInputTest.php b/src/Symfony/Component/Console/Tests/Input/ArrayInputTest.php index 06e65f7398..608020a5ca 100644 --- a/src/Symfony/Component/Console/Tests/Input/ArrayInputTest.php +++ b/src/Symfony/Component/Console/Tests/Input/ArrayInputTest.php @@ -140,5 +140,8 @@ class ArrayInputTest extends TestCase { $input = new ArrayInput(array('-f' => null, '-b' => 'bar', '--foo' => 'b a z', '--lala' => null, 'test' => 'Foo', 'test2' => "A\nB'C")); $this->assertEquals('-f -b=bar --foo='.escapeshellarg('b a z').' --lala Foo '.escapeshellarg("A\nB'C"), (string) $input); + + $input = new ArrayInput(array('-b' => array('bval_1', 'bval_2'), '--f' => array('fval_1', 'fval_2'))); + $this->assertSame('-b=bval_1 -b=bval_2 --f=fval_1 --f=fval_2', (string) $input); } } diff --git a/src/Symfony/Component/ExpressionLanguage/Node/GetAttrNode.php b/src/Symfony/Component/ExpressionLanguage/Node/GetAttrNode.php index ae22deb8a0..ec5987645b 100644 --- a/src/Symfony/Component/ExpressionLanguage/Node/GetAttrNode.php +++ b/src/Symfony/Component/ExpressionLanguage/Node/GetAttrNode.php @@ -82,8 +82,11 @@ class GetAttrNode extends Node if (!is_object($obj)) { throw new \RuntimeException('Unable to get a property on a non-object.'); } + if (!is_callable($toCall = array($obj, $this->nodes['attribute']->attributes['value']))) { + throw new \RuntimeException(sprintf('Unable to call method "%s" of object "%s".', $this->nodes['attribute']->attributes['value'], get_class($obj))); + } - return call_user_func_array(array($obj, $this->nodes['attribute']->attributes['value']), $this->nodes['arguments']->evaluate($functions, $values)); + return call_user_func_array($toCall, $this->nodes['arguments']->evaluate($functions, $values)); case self::ARRAY_CALL: $array = $this->nodes['node']->evaluate($functions, $values); diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php index 07f4b1e8a0..0ef278c901 100644 --- a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php +++ b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php @@ -163,6 +163,16 @@ class ExpressionLanguageTest extends TestCase $registerCallback($el); } + /** + * @expectedException \RuntimeException + * @expectedExceptionMessageRegExp /Unable to call method "\w+" of object "\w+"./ + */ + public function testCallBadCallable() + { + $el = new ExpressionLanguage(); + $el->evaluate('foo.myfunction()', array('foo' => new \stdClass())); + } + /** * @dataProvider getRegisterCallbacks * @expectedException \LogicException diff --git a/src/Symfony/Component/HttpFoundation/JsonResponse.php b/src/Symfony/Component/HttpFoundation/JsonResponse.php index a83d0077a8..89f6e07f3a 100644 --- a/src/Symfony/Component/HttpFoundation/JsonResponse.php +++ b/src/Symfony/Component/HttpFoundation/JsonResponse.php @@ -121,7 +121,7 @@ class JsonResponse extends Response $data = json_encode($data, $this->encodingOptions); } else { try { - if (\PHP_VERSION_ID < 50400) { + if (!interface_exists('JsonSerializable', false)) { // PHP 5.3 triggers annoying warnings for some // types that can't be serialized as JSON (INF, resources, etc.) // but doesn't provide the JsonSerializable interface. @@ -153,7 +153,7 @@ class JsonResponse extends Response if (\PHP_VERSION_ID < 50500) { restore_error_handler(); } - if (\PHP_VERSION_ID >= 50400 && 'Exception' === get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) { + if (interface_exists('JsonSerializable', false) && 'Exception' === get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) { throw $e->getPrevious() ?: $e; } throw $e; diff --git a/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php index 8156da0693..e15505cc69 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php @@ -206,10 +206,13 @@ class JsonResponseTest extends TestCase /** * @expectedException \Exception * @expectedExceptionMessage This error is expected - * @requires PHP 5.4 */ public function testSetContentJsonSerializeError() { + if (!interface_exists('JsonSerializable', false)) { + $this->markTestSkipped('JsonSerializable is required.'); + } + $serializable = new JsonSerializableObject(); JsonResponse::create($serializable); @@ -224,7 +227,7 @@ class JsonResponseTest extends TestCase } } -if (interface_exists('JsonSerializable')) { +if (interface_exists('JsonSerializable', false)) { class JsonSerializableObject implements \JsonSerializable { public function jsonSerialize()