diff --git a/.travis.yml b/.travis.yml index 4fda37d57..91ad92f18 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,11 @@ language: php php: - - 5.5 - - 5.6 - 7.0 - 7.1 - 7.2 + - 7.3 + - 7.4 - nightly # run build against nightly but allow them to fail @@ -20,6 +20,12 @@ matrix: - php: 5.4 dist: precise sudo: required + - php: 5.5 + dist: trusty + sudo: required + - php: 5.6 + dist: trusty + sudo: required # faster builds on new travis setup not using sudo sudo: false diff --git a/CHANGELOG.md b/CHANGELOG.md index 4613a05e0..022e5a39e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,17 @@ CHANGELOG ========= +17/03/2018: Version 1.5.11 +-------------------------- + +* Fix a bug in the lime unit-testing lib #168 +* Fix error 'A non well formed numeric value' on sfValidatorFile #181 +* Fix usage of octet in recent patch #182 +* Allow PATCH as an option in functional tests #185 +* Fix case for isSubclassOf method #189 +* Remove typehint from exception handler #188 +* Fix counting of non-countable var for PHP 7.2 #178 + 02/08/2017: Version 1.5.10 -------------------------- diff --git a/README.md b/README.md index 2dabd7472..06b00303d 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@ -[![Build Status](https://secure.travis-ci.org/LExpress/symfony1.png?branch=master)](http://travis-ci.org/LExpress/symfony1) +[![Build Status](https://secure.travis-ci.org/FriendsOfSymfony1/symfony1.png?branch=master)](http://travis-ci.org/FriendsOfSymfony1/symfony1) About this version ------------------ This is a community driven fork of symfony 1, as official support has been [interrupted in November 2012](http://symfony.com/blog/symfony-1-4-end-of-maintenance-what-does-it-mean). -**Do not use it for new projects: this version is great to improve existing symfony1 applications, but [Symfony4](http://symfony.com/) is the way to go today.** +**Do not use it for new projects: this version is great to improve existing symfony1 applications, but [Symfony5](http://symfony.com/) is the way to go today.** -All the enhancements and BC breaks are listed in the [WHATS_NEW](https://github.com/LExpress/symfony1/blob/master/WHATS_NEW.md) file, this include: +All the enhancements and BC breaks are listed in the [WHATS_NEW](https://github.com/FriendsOfSymfony1/symfony1/blob/master/WHATS_NEW.md) file, this include: -- [DIC](https://github.com/LExpress/symfony1/wiki/ServiceContainer) +- [DIC](https://github.com/FriendsOfSymfony1/symfony1/wiki/ServiceContainer) - Composer support -- PHP 7.0 support +- PHP 7.2 support - performance boost - new widgets & validators - some tickets fixed from the symfony trac @@ -51,7 +51,7 @@ Note: On windows, if your project is a few directories down from the drive root, Option 2: Using Git submodules: git init # your project - git submodule add https://github.com/LExpress/symfony1.git lib/vendor/symfony + git submodule add https://github.com/FriendsOfSymfony1/symfony1.git lib/vendor/symfony git submodule update --init --recursive Documentation diff --git a/lib/autoload/sfCoreAutoload.class.php b/lib/autoload/sfCoreAutoload.class.php index 8102ee311..f1bc5822f 100755 --- a/lib/autoload/sfCoreAutoload.class.php +++ b/lib/autoload/sfCoreAutoload.class.php @@ -11,7 +11,7 @@ /** * The current symfony version. */ -define('SYMFONY_VERSION', '1.5.11-dev'); +define('SYMFONY_VERSION', '1.5.13-dev'); /** * sfCoreAutoload class. diff --git a/lib/form/sfFormField.class.php b/lib/form/sfFormField.class.php index 076ccaa1f..81b378fde 100644 --- a/lib/form/sfFormField.class.php +++ b/lib/form/sfFormField.class.php @@ -324,6 +324,10 @@ public function getError() */ public function hasError() { - return null !== $this->error && count($this->error); + if ($this->error instanceof sfValidatorErrorSchema) { + return $this->error->count() > 0; + } + + return $this->error !== null; } } diff --git a/lib/i18n/sfDateFormat.class.php b/lib/i18n/sfDateFormat.class.php index 064bc65a1..27974a1bd 100644 --- a/lib/i18n/sfDateFormat.class.php +++ b/lib/i18n/sfDateFormat.class.php @@ -229,7 +229,7 @@ public function format($time, $pattern = 'F', $inputPattern = null, $charset = ' for ($i = 0, $max = count($tokens); $i < $max; $i++) { $pattern = $tokens[$i]; - if ($pattern{0} == "'" && $pattern{strlen($pattern) - 1} == "'") + if ($pattern[0] == "'" && $pattern{strlen($pattern) - 1} == "'") { $tokens[$i] = str_replace('``````', '\'', preg_replace('/(^\')|(\'$)/', '', $pattern)); } @@ -266,9 +266,9 @@ public function format($time, $pattern = 'F', $inputPattern = null, $charset = ' */ protected function getFunctionName($token) { - if (isset($this->tokens[$token{0}])) + if (isset($this->tokens[$token[0]])) { - return $this->tokens[$token{0}]; + return $this->tokens[$token[0]]; } } diff --git a/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineFormGenerator.class.php b/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineFormGenerator.class.php index ab372889b..10690bb95 100644 --- a/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineFormGenerator.class.php +++ b/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineFormGenerator.class.php @@ -164,7 +164,7 @@ public function getPluginModels() { $parent = new ReflectionClass('Doctrine_Record'); $reflection = new ReflectionClass($modelName); - if ($reflection->isSubClassOf($parent)) + if ($reflection->isSubclassOf($parent)) { $this->pluginModels[$modelName] = $pluginName; diff --git a/lib/request/sfRequest.class.php b/lib/request/sfRequest.class.php index e2594e2d1..b7249728b 100644 --- a/lib/request/sfRequest.class.php +++ b/lib/request/sfRequest.class.php @@ -171,7 +171,7 @@ public function setMethod($method) * * @param string $name The name of the request parameter * - * @return Boolean true if the request parameter exists, false otherwise + * @return bool true if the request parameter exists, false otherwise */ public function offsetExists($name) { @@ -308,7 +308,7 @@ public function setParameter($name, $value) /** * Returns the content of the current request. * - * @return string|Boolean The content or false if none is available + * @return string|false The content or false if none is available */ public function getContent() { diff --git a/lib/request/sfWebRequest.class.php b/lib/request/sfWebRequest.class.php index 52c766f0f..bf35cbcb4 100644 --- a/lib/request/sfWebRequest.class.php +++ b/lib/request/sfWebRequest.class.php @@ -75,7 +75,14 @@ public function initialize(sfEventDispatcher $dispatcher, $parameters = array(), parent::initialize($dispatcher, $parameters, $attributes, $options); // GET parameters - $this->getParameters = get_magic_quotes_gpc() ? sfToolkit::stripslashesDeep($_GET) : $_GET; + if (version_compare(PHP_VERSION, '5.4.0-dev', '<') && get_magic_quotes_gpc()) + { + $this->getParameters = sfToolkit::stripslashesDeep($_GET); + } + else + { + $this->getParameters = $_GET; + } $this->parameterHolder->add($this->getParameters); $postParameters = $_POST; @@ -148,7 +155,15 @@ public function initialize(sfEventDispatcher $dispatcher, $parameters = array(), $this->setMethod(self::GET); } - $this->postParameters = get_magic_quotes_gpc() ? sfToolkit::stripslashesDeep($postParameters) : $postParameters; + if (version_compare(PHP_VERSION, '5.4.0-dev', '<') && get_magic_quotes_gpc()) + { + $this->postParameters = sfToolkit::stripslashesDeep($postParameters); + } + else + { + $this->postParameters = $postParameters; + } + $this->parameterHolder->add($this->postParameters); if ($formats = $this->getOption('formats')) @@ -600,7 +615,14 @@ public function getCookie($name, $defaultValue = null) if (isset($_COOKIE[$name])) { - $retval = get_magic_quotes_gpc() ? sfToolkit::stripslashesDeep($_COOKIE[$name]) : $_COOKIE[$name]; + if (version_compare(PHP_VERSION, '5.4.0-dev', '<') && get_magic_quotes_gpc()) + { + $retval = sfToolkit::stripslashesDeep($_COOKIE[$name]); + } + else + { + $retval = $_COOKIE[$name]; + } } return $retval; diff --git a/lib/response/sfWebResponse.class.php b/lib/response/sfWebResponse.class.php index 343c88fee..4a9a6585a 100644 --- a/lib/response/sfWebResponse.class.php +++ b/lib/response/sfWebResponse.class.php @@ -11,7 +11,7 @@ /** * sfWebResponse class. * - * This class manages web reponses. It supports cookies and headers management. + * This class manages web responses. It supports cookies and headers management. * * @package symfony * @subpackage response diff --git a/lib/test/sfTestFunctionalBase.class.php b/lib/test/sfTestFunctionalBase.class.php index 47d032a0c..2f3da782c 100644 --- a/lib/test/sfTestFunctionalBase.class.php +++ b/lib/test/sfTestFunctionalBase.class.php @@ -480,7 +480,7 @@ static public function handlePhpError($errno, $errstr, $errfile, $errline) * * @param Exception $exception The exception */ - function handleException(Exception $exception) + function handleException($exception) { $this->test()->error(sprintf('%s: %s', get_class($exception), $exception->getMessage())); diff --git a/lib/util/sfBrowserBase.class.php b/lib/util/sfBrowserBase.class.php index 21c5cbc1d..21d3de7da 100755 --- a/lib/util/sfBrowserBase.class.php +++ b/lib/util/sfBrowserBase.class.php @@ -272,7 +272,7 @@ public function call($uri, $method = 'get', $parameters = array(), $changeStack // request parameters $_GET = $_POST = array(); - if (in_array(strtoupper($method), array('POST', 'DELETE', 'PUT'))) + if (in_array(strtoupper($method), array('POST', 'DELETE', 'PUT', 'PATCH'))) { if (isset($parameters['_with_csrf']) && $parameters['_with_csrf']) { diff --git a/lib/util/sfFinder.class.php b/lib/util/sfFinder.class.php index 879dd54eb..be56137a3 100644 --- a/lib/util/sfFinder.class.php +++ b/lib/util/sfFinder.class.php @@ -580,10 +580,10 @@ protected function exec_ok($dir, $entry) public static function isPathAbsolute($path) { - if ($path{0} === '/' || $path{0} === '\\' || - (strlen($path) > 3 && ctype_alpha($path{0}) && - $path{1} === ':' && - ($path{2} === '\\' || $path{2} === '/') + if ($path[0] === '/' || $path[0] === '\\' || + (strlen($path) > 3 && ctype_alpha($path[0]) && + $path[1] === ':' && + ($path[2] === '\\' || $path[2] === '/') ) ) { diff --git a/lib/validator/sfValidatorFile.class.php b/lib/validator/sfValidatorFile.class.php index ec9bab22b..294dea8c0 100644 --- a/lib/validator/sfValidatorFile.class.php +++ b/lib/validator/sfValidatorFile.class.php @@ -263,7 +263,9 @@ protected function guessFromFileBinary($file) { ob_start(); //need to use --mime instead of -i. see #6641 - passthru(sprintf('file -b --mime %s 2>/dev/null', escapeshellarg($file)), $return); + $cmd = 'file -b --mime -- %s 2>/dev/null'; + $file = (0 === strpos($file, '-') ? './' : '').$file; + passthru(sprintf($cmd, escapeshellarg($file)), $return); if ($return > 0) { ob_end_clean(); diff --git a/test/unit/validator/sfValidatorFileTest.php b/test/unit/validator/sfValidatorFileTest.php index 407f0e316..43412cffc 100755 --- a/test/unit/validator/sfValidatorFileTest.php +++ b/test/unit/validator/sfValidatorFileTest.php @@ -10,7 +10,7 @@ require_once(__DIR__.'/../../bootstrap/unit.php'); -$t = new lime_test(69); +$t = new lime_test(70); $tmpDir = sys_get_temp_dir(); $content = 'This is an ASCII file.'; @@ -106,6 +106,7 @@ public function getMimeTypesFromCategory($category) $t->is($v->guessFromFileBinary($tmpDir.'/test.txt'), 'text/plain', '->guessFromFileBinary() guesses the type of a given file'); $t->is($v->guessFromFileBinary($tmpDir.'/foo.txt'), null, '->guessFromFileBinary() returns null if the file type is not guessable'); $t->is($v->guessFromFileBinary('/bin/ls'), (PHP_OS != 'Darwin') ? 'application/x-executable' : 'application/octet-stream', '->guessFromFileBinary() returns correct type if file is guessable'); +$t->is($v->guessFromFileBinary('-test'), null, '->guessFromFileBinary() returns null if file path has leading dash'); // ->getMimeType() $t->diag('->getMimeType()');