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..ff1d95810 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![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 ------------------ @@ -7,11 +7,11 @@ This is a community driven fork of symfony 1, as official support has been [inte **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.** -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..d16a0310b 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.12-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/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/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/validator/sfValidatorDate.class.php b/lib/validator/sfValidatorDate.class.php index 1b03cb6f8..ee9343c17 100644 --- a/lib/validator/sfValidatorDate.class.php +++ b/lib/validator/sfValidatorDate.class.php @@ -117,6 +117,7 @@ protected function doClean($value) else { $dateMax = new DateTime($max); + $dateMax->setTimezone(new DateTimeZone(date_default_timezone_get())); $max = $dateMax->format('YmdHis'); $maxError = $dateMax->format($this->getOption('date_format_range_error')); } @@ -140,6 +141,7 @@ protected function doClean($value) else { $dateMin = new DateTime($min); + $dateMin->setTimezone(new DateTimeZone(date_default_timezone_get())); $min = $dateMin->format('YmdHis'); $minError = $dateMin->format($this->getOption('date_format_range_error')); } diff --git a/test/unit/validator/sfValidatorDateTest.php b/test/unit/validator/sfValidatorDateTest.php index e695bb792..37626bd38 100644 --- a/test/unit/validator/sfValidatorDateTest.php +++ b/test/unit/validator/sfValidatorDateTest.php @@ -10,7 +10,7 @@ require_once(__DIR__.'/../../bootstrap/unit.php'); -$t = new lime_test(52); +$t = new lime_test(56); $v = new sfValidatorDate(); @@ -244,3 +244,35 @@ // did it convert from the other timezone to the default timezone? $date->setTimezone($defaultTimezone); $t->is($clean, $date->format('Y-m-d H:i:s'), '->clean() respects incoming and default timezones'); + +// 'min' and 'max' options should be normalized to the default timezone +$v = new sfValidatorDateTime(array( + 'min' => '2018-12-06T09:00:00Z' +), array( + 'min' => 'min', +)); +try +{ + $v->clean('2018-12-06T09:59:59+01:00'); + $t->fail('->clean() throws an exception if the normalized date is before normalized min-option'); +} +catch (sfValidatorError $e) +{ + $t->pass('->clean() throws an exception if the normalized date is before normalized min-option'); + $t->is($e->getMessage(), 'min', '->clean() adds correct min-message'); +} +$v = new sfValidatorDateTime(array( + 'max' => '2018-12-06T09:00:00Z' +), array( + 'max' => 'max', +)); +try +{ + $v->clean('2018-12-06T10:00:01+01:00'); + $t->fail('->clean() throws an exception if the normalized date is after normalized max-option'); +} +catch (sfValidatorError $e) +{ + $t->pass('->clean() throws an exception if the normalized date is after normalized max-option'); + $t->is($e->getMessage(), 'max', '->clean() adds correct max-message'); +}