From 573d5790cb007ff8a4447a148497a5516673fcea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Benoist?= Date: Mon, 29 Oct 2018 16:34:55 +0100 Subject: [PATCH 01/34] Moved to FriendsOfSymfony1 --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8077e2a64..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,9 +7,9 @@ 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.2 support - performance boost @@ -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 From dd75bc4415d25ae0b36963437f12fbae59c26913 Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Thu, 15 Aug 2019 16:13:25 +0100 Subject: [PATCH 02/34] Update PHPDoc - don't return "Boolean" use bool or false instead Helps e.g. psalm static analysis. --- lib/request/sfRequest.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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() { From daebc947d1870643b316c556462b80a60b644680 Mon Sep 17 00:00:00 2001 From: callmebob2016 <38659523+callmebob2016@users.noreply.github.com> Date: Tue, 26 Nov 2019 11:30:34 +0100 Subject: [PATCH 03/34] Update README.md Change mentioned current Symfony version from 4 to 5 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ff1d95810..06b00303d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ 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/FriendsOfSymfony1/symfony1/blob/master/WHATS_NEW.md) file, this include: From 113be3dfe0157292f2731d6ebf366a5eaebb9d18 Mon Sep 17 00:00:00 2001 From: adrienperonnet Date: Wed, 27 Nov 2019 15:01:46 +1300 Subject: [PATCH 04/34] [HttpFoundation] fix guessing mime-types of files with leading dash Backport fix https://github.com/symfony/symfony/commit/691486e43ce0e4893cd703e221bafc10a871f365 --- lib/validator/sfValidatorFile.class.php | 4 +++- test/unit/validator/sfValidatorFileTest.php | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/validator/sfValidatorFile.class.php b/lib/validator/sfValidatorFile.class.php index ec9bab22b..dd6b18181 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..c5b140557 100755 --- a/test/unit/validator/sfValidatorFileTest.php +++ b/test/unit/validator/sfValidatorFileTest.php @@ -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()'); From dbe7d74569fa6623ef16cda54112db3f1fa91c01 Mon Sep 17 00:00:00 2001 From: adrienperonnet Date: Wed, 27 Nov 2019 16:30:01 +1300 Subject: [PATCH 05/34] path need to be placed after the double dash --- lib/validator/sfValidatorFile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/validator/sfValidatorFile.class.php b/lib/validator/sfValidatorFile.class.php index dd6b18181..294dea8c0 100644 --- a/lib/validator/sfValidatorFile.class.php +++ b/lib/validator/sfValidatorFile.class.php @@ -263,7 +263,7 @@ protected function guessFromFileBinary($file) { ob_start(); //need to use --mime instead of -i. see #6641 - $cmd = 'file -b --mime %s -- 2>/dev/null'; + $cmd = 'file -b --mime -- %s 2>/dev/null'; $file = (0 === strpos($file, '-') ? './' : '').$file; passthru(sprintf($cmd, escapeshellarg($file)), $return); if ($return > 0) From 1d8ba1d8eef3c163e444b9e182b4e98a26600e61 Mon Sep 17 00:00:00 2001 From: Dieter Date: Sun, 22 Mar 2020 19:38:55 +0100 Subject: [PATCH 06/34] Test PHP 7.3 and 7.4 --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 4fda37d57..462a8b11f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,8 @@ php: - 7.0 - 7.1 - 7.2 + - 7.3 + - 7.4 - nightly # run build against nightly but allow them to fail From 89421abf6d095c77b164005472259fba88f77887 Mon Sep 17 00:00:00 2001 From: Dieter Date: Sun, 22 Mar 2020 19:57:04 +0100 Subject: [PATCH 07/34] Fix array and string offset access using curly braces (deprecated since PHP 7.4) --- lib/i18n/sfDateFormat.class.php | 6 +++--- lib/util/sfFinder.class.php | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) 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/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] === '/') ) ) { From d6468e191ae475c7ccd9464ee2bfbc7e72c079a3 Mon Sep 17 00:00:00 2001 From: Dieter Date: Sun, 22 Mar 2020 20:30:00 +0100 Subject: [PATCH 08/34] Call get_magic_quotes_gpc() only for PHP < 5.4 as it always returns false on newer versions and is deprecated since PHP 7.4 --- lib/request/sfWebRequest.class.php | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/lib/request/sfWebRequest.class.php b/lib/request/sfWebRequest.class.php index 52c766f0f..2cc552bb9 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', '<') && 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', '<') && 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', '<') && get_magic_quotes_gpc()) + { + $retval = sfToolkit::stripslashesDeep($_COOKIE[$name]); + } + else + { + $retval = $_COOKIE[$name]; + } } return $retval; From 793f15236092bbfb15e34d7583af36da5e736dc4 Mon Sep 17 00:00:00 2001 From: Dieter Date: Sun, 22 Mar 2020 20:40:54 +0100 Subject: [PATCH 09/34] Use trusty for PHP 5.5 --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 462a8b11f..2da3037dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: php php: - - 5.5 - 5.6 - 7.0 - 7.1 @@ -22,6 +21,9 @@ matrix: - php: 5.4 dist: precise sudo: required + - php: 5.5 + dist: trusty + sudo: required # faster builds on new travis setup not using sudo sudo: false From a0dc91ddbf4dd697890fd2ba4d2d7c0762094d82 Mon Sep 17 00:00:00 2001 From: Dieter Date: Sun, 22 Mar 2020 20:50:11 +0100 Subject: [PATCH 10/34] Use trusty for PHP 5.6 to fix issue with memcache extension --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2da3037dc..91ad92f18 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: php php: - - 5.6 - 7.0 - 7.1 - 7.2 @@ -24,6 +23,9 @@ matrix: - 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 From 2032c8345c45ff2b7baa5ea60c59ea59f0d000a5 Mon Sep 17 00:00:00 2001 From: Dieter Date: Mon, 23 Mar 2020 19:25:03 +0100 Subject: [PATCH 11/34] Call get_magic_quotes_gpc() for PHP < 5.4.0-dev --- lib/request/sfWebRequest.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/request/sfWebRequest.class.php b/lib/request/sfWebRequest.class.php index 2cc552bb9..bf35cbcb4 100644 --- a/lib/request/sfWebRequest.class.php +++ b/lib/request/sfWebRequest.class.php @@ -75,7 +75,7 @@ public function initialize(sfEventDispatcher $dispatcher, $parameters = array(), parent::initialize($dispatcher, $parameters, $attributes, $options); // GET parameters - if (version_compare(PHP_VERSION, '5.4', '<') && get_magic_quotes_gpc()) + if (version_compare(PHP_VERSION, '5.4.0-dev', '<') && get_magic_quotes_gpc()) { $this->getParameters = sfToolkit::stripslashesDeep($_GET); } @@ -155,7 +155,7 @@ public function initialize(sfEventDispatcher $dispatcher, $parameters = array(), $this->setMethod(self::GET); } - if (version_compare(PHP_VERSION, '5.4', '<') && get_magic_quotes_gpc()) + if (version_compare(PHP_VERSION, '5.4.0-dev', '<') && get_magic_quotes_gpc()) { $this->postParameters = sfToolkit::stripslashesDeep($postParameters); } @@ -615,7 +615,7 @@ public function getCookie($name, $defaultValue = null) if (isset($_COOKIE[$name])) { - if (version_compare(PHP_VERSION, '5.4', '<') && get_magic_quotes_gpc()) + if (version_compare(PHP_VERSION, '5.4.0-dev', '<') && get_magic_quotes_gpc()) { $retval = sfToolkit::stripslashesDeep($_COOKIE[$name]); } From 437a29da9e8608a0887024d797b09c0b581778ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Benoist?= Date: Fri, 3 Apr 2020 12:08:40 +0200 Subject: [PATCH 12/34] 1.5.12 --- lib/autoload/sfCoreAutoload.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/autoload/sfCoreAutoload.class.php b/lib/autoload/sfCoreAutoload.class.php index d16a0310b..441495503 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.12-dev'); +define('SYMFONY_VERSION', '1.5.12'); /** * sfCoreAutoload class. From 7d1bd476772e8541b0a99dae02cfcf11eabe6d2d Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 3 Apr 2020 12:13:07 +0200 Subject: [PATCH 13/34] Fix tests count following #218 --- test/unit/validator/sfValidatorFileTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/validator/sfValidatorFileTest.php b/test/unit/validator/sfValidatorFileTest.php index c5b140557..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.'; From 80ff0d2f9fcf45940ae4a9cac3a66c7050827aea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Benoist?= Date: Fri, 3 Apr 2020 12:25:00 +0200 Subject: [PATCH 14/34] 1.5.13-dev --- lib/autoload/sfCoreAutoload.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/autoload/sfCoreAutoload.class.php b/lib/autoload/sfCoreAutoload.class.php index 441495503..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.12'); +define('SYMFONY_VERSION', '1.5.13-dev'); /** * sfCoreAutoload class. From ff4f9ca196cb362b1328c0834f9bcc18fa63b62b Mon Sep 17 00:00:00 2001 From: Sergey Matvienko Date: Wed, 6 May 2020 17:17:26 +0300 Subject: [PATCH 15/34] Remove `PHP Notice: Trying to access array offset on value of type null in sfForm.class.php on line 947` --- lib/form/sfForm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/form/sfForm.class.php b/lib/form/sfForm.class.php index 04fb38a59..db46c4d82 100644 --- a/lib/form/sfForm.class.php +++ b/lib/form/sfForm.class.php @@ -63,7 +63,6 @@ class sfForm implements ArrayAccess, Iterator, Countable */ public function __construct($defaults = array(), $options = array(), $CSRFSecret = null) { - $this->setDefaults($defaults); $this->options = $options; $this->localCSRFSecret = $CSRFSecret; @@ -71,6 +70,7 @@ public function __construct($defaults = array(), $options = array(), $CSRFSecret $this->widgetSchema = new sfWidgetFormSchema(); $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); + $this->setDefaults($defaults); $this->setup(); $this->configure(); From 73bae70bd9f0754b59f3fea47b112d6e00d90179 Mon Sep 17 00:00:00 2001 From: pathumhdes Date: Mon, 20 Apr 2020 11:28:34 +0530 Subject: [PATCH 16/34] PHP 7.4 Incompatibility Fixes Fix array and string offset access using curly braces (Deprecated since PHP 7.4) Fix array and string offset access using curly braces (Deprecated since PHP 7.4) PHP 7.4 incompatibility fix: Passing the glue and pieces parameters in reverse order to implode has been deprecated since PHP 7.4 --- lib/helper/UrlHelper.php | 2 +- lib/i18n/sfDateFormat.class.php | 16 ++++++++-------- lib/i18n/sfNumberFormat.class.php | 2 +- lib/i18n/sfNumberFormatInfo.class.php | 6 +++--- lib/view/sfViewCacheManager.class.php | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/helper/UrlHelper.php b/lib/helper/UrlHelper.php index 88b1895ac..de61246d2 100644 --- a/lib/helper/UrlHelper.php +++ b/lib/helper/UrlHelper.php @@ -630,7 +630,7 @@ function _encodeText($text) for ($i = 0; $i < strlen($text); $i++) { - $char = $text{$i}; + $char = $text[$i]; $r = mt_rand(0, 100); # roughly 10% raw, 45% hex, 45% dec diff --git a/lib/i18n/sfDateFormat.class.php b/lib/i18n/sfDateFormat.class.php index 27974a1bd..ceace0eee 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)); } @@ -397,30 +397,30 @@ protected function getTokens($pattern) for ($i = 0, $max = strlen($pattern); $i < $max; $i++) { - if ($char == null || $pattern{$i} == $char || $text) + if ($char == null || $pattern[$i] == $char || $text) { - $token .= $pattern{$i}; + $token .= $pattern[$i]; } else { $tokens[] = str_replace("''", "'", $token); - $token = $pattern{$i}; + $token = $pattern[$i]; } - if ($pattern{$i} == "'" && $text == false) + if ($pattern[$i] == "'" && $text == false) { $text = true; } - else if ($text && $pattern{$i} == "'" && $char == "'") + else if ($text && $pattern[$i] == "'" && $char == "'") { $text = true; } - else if ($text && $char != "'" && $pattern{$i} == "'") + else if ($text && $char != "'" && $pattern[$i] == "'") { $text = false; } - $char = $pattern{$i}; + $char = $pattern[$i]; } $tokens[] = $token; diff --git a/lib/i18n/sfNumberFormat.class.php b/lib/i18n/sfNumberFormat.class.php index 9c559f6f3..117ee2004 100644 --- a/lib/i18n/sfNumberFormat.class.php +++ b/lib/i18n/sfNumberFormat.class.php @@ -193,7 +193,7 @@ protected function formatInteger($string) // now for the integer groupings for ($i = 0; $i < $len; $i++) { - $char = $string{$len - $i - 1}; + $char = $string[($len - $i - 1)]; if ($multiGroup && $count == 0) { diff --git a/lib/i18n/sfNumberFormatInfo.class.php b/lib/i18n/sfNumberFormatInfo.class.php index 613b48adb..2bfb7a613 100644 --- a/lib/i18n/sfNumberFormatInfo.class.php +++ b/lib/i18n/sfNumberFormatInfo.class.php @@ -316,7 +316,7 @@ protected function parsePattern($pattern) // to find the groupsize 1. for ($i = strlen($pattern) - 1; $i >= 0; $i--) { - if ($pattern{$i} == $digit || $pattern{$i} == $hash) + if ($pattern[$i] == $digit || $pattern[$i] == $hash) { $groupSize1 = $i - $groupPos1; break; @@ -335,11 +335,11 @@ protected function parsePattern($pattern) { for ($i = strlen($pattern) - 1; $i >= 0; $i--) { - if ($pattern{$i} == $dot) + if ($pattern[$i] == $dot) { break; } - if ($pattern{$i} == $digit) + if ($pattern[$i] == $digit) { $decimalPoints = $i - $decimalPos; break; diff --git a/lib/view/sfViewCacheManager.class.php b/lib/view/sfViewCacheManager.class.php index 834d46697..f055e50f1 100644 --- a/lib/view/sfViewCacheManager.class.php +++ b/lib/view/sfViewCacheManager.class.php @@ -236,7 +236,7 @@ protected function getCacheKeyVaryHeaderPart($internalUri, $vary = '') { $varys[] = $header . '-' . preg_replace('/\W+/', '_', $request->getHttpHeader($header)); } - $vary = implode($varys, '-'); + $vary = implode('-', $varys); } return $vary; From 4d512dedcb6102278d665690beb5420b0df2bd0d Mon Sep 17 00:00:00 2001 From: Sergey Matvienko Date: Wed, 6 May 2020 16:56:13 +0300 Subject: [PATCH 17/34] Fix for `Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time` --- lib/config/sfFactoryConfigHandler.class.php | 4 ++++ lib/storage/sfSessionStorage.class.php | 7 +++++++ lib/user/sfBasicSecurityUser.class.php | 10 ++-------- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/config/sfFactoryConfigHandler.class.php b/lib/config/sfFactoryConfigHandler.class.php index f4a7b530a..c42b0e992 100644 --- a/lib/config/sfFactoryConfigHandler.class.php +++ b/lib/config/sfFactoryConfigHandler.class.php @@ -109,6 +109,10 @@ public function execute($configFiles) unset($parameters['database']); } + if (isset($config['user']['param']['timeout'])) { + $defaultParameters[] = sprintf("'gc_maxlifetime' => %d,", $config['user']['param']['timeout']); + } + $instances[] = sprintf(" \$class = sfConfig::get('sf_factory_storage', '%s');\n \$this->factories['storage'] = new \$class(array_merge(array(\n%s\n), sfConfig::get('sf_factory_storage_parameters', %s)));", $class, implode("\n", $defaultParameters), var_export($parameters, true)); break; diff --git a/lib/storage/sfSessionStorage.class.php b/lib/storage/sfSessionStorage.class.php index 0a29f19e0..57ff59973 100644 --- a/lib/storage/sfSessionStorage.class.php +++ b/lib/storage/sfSessionStorage.class.php @@ -63,6 +63,7 @@ public function initialize($options = null) 'session_cookie_secure' => $cookieDefaults['secure'], 'session_cookie_httponly' => isset($cookieDefaults['httponly']) ? $cookieDefaults['httponly'] : false, 'session_cache_limiter' => null, + 'gc_maxlifetime' => 1800, ), $options); // initialize parent @@ -90,6 +91,12 @@ public function initialize($options = null) session_cache_limiter($this->options['session_cache_limiter']); } + // force the max lifetime for session garbage collector to be greater than timeout + if (ini_get('session.gc_maxlifetime') < $this->options['gc_maxlifetime']) + { + ini_set('session.gc_maxlifetime', $this->options['gc_maxlifetime']); + } + if ($this->options['auto_start'] && !self::$sessionStarted) { session_start(); diff --git a/lib/user/sfBasicSecurityUser.class.php b/lib/user/sfBasicSecurityUser.class.php index d624d3c49..02086fffb 100644 --- a/lib/user/sfBasicSecurityUser.class.php +++ b/lib/user/sfBasicSecurityUser.class.php @@ -4,7 +4,7 @@ * This file is part of the symfony package. * (c) 2004-2006 Fabien Potencier * (c) 2004-2006 Sean Kerr - * + * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ @@ -42,7 +42,7 @@ public function clearCredentials() /** * Returns the current user's credentials. - * + * * @return array */ public function getCredentials() @@ -251,12 +251,6 @@ public function initialize(sfEventDispatcher $dispatcher, sfStorage $storage, $o $this->options['timeout'] = 1800; } - // force the max lifetime for session garbage collector to be greater than timeout - if (ini_get('session.gc_maxlifetime') < $this->options['timeout']) - { - ini_set('session.gc_maxlifetime', $this->options['timeout']); - } - // read data from storage $this->authenticated = $storage->read(self::AUTH_NAMESPACE); $this->credentials = $storage->read(self::CREDENTIAL_NAMESPACE); From 62e9c1e62fe92362bc97081eb7035dfeb8963260 Mon Sep 17 00:00:00 2001 From: pathumhdes Date: Sun, 17 May 2020 09:39:03 +0530 Subject: [PATCH 18/34] Changes done as per feedback --- lib/i18n/sfDateFormat.class.php | 2 +- lib/i18n/sfNumberFormat.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/i18n/sfDateFormat.class.php b/lib/i18n/sfDateFormat.class.php index ceace0eee..80a5a571f 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)); } diff --git a/lib/i18n/sfNumberFormat.class.php b/lib/i18n/sfNumberFormat.class.php index 117ee2004..bcf948d55 100644 --- a/lib/i18n/sfNumberFormat.class.php +++ b/lib/i18n/sfNumberFormat.class.php @@ -193,7 +193,7 @@ protected function formatInteger($string) // now for the integer groupings for ($i = 0; $i < $len; $i++) { - $char = $string[($len - $i - 1)]; + $char = $string[$len - $i - 1]; if ($multiGroup && $count == 0) { From d8388cdb31a19e9dca37c6d10c1b821aa2a6a513 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 8 Jun 2020 08:21:48 +0200 Subject: [PATCH 19/34] Rename package to `friendsofsymfony1/symfony1` - Add PHP requirements - Cleanup Travis - Update changelog --- .travis.yml | 24 ++++++++---------------- CHANGELOG.md | 15 +++++++++++++++ README.md | 2 +- composer.json | 7 ++++--- 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index 91ad92f18..c163be702 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ +os: linux +dist: xenial language: php php: @@ -9,45 +11,35 @@ php: - nightly # run build against nightly but allow them to fail -matrix: +jobs: fast_finish: true allow_failures: - php: nightly include: - php: 5.3 dist: precise - sudo: required - 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 services: - memcached -# cache vendor dirs cache: directories: - - lib/vendor/swiftmailer - $HOME/.composer/cache -install: - - composer self-update +before_install: + - sh -c 'if [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ] && [ $(php -r "echo PHP_MAJOR_VERSION;") -le 5 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;' + - sh -c 'if [ $(php -r "echo PHP_RELEASE_VERSION;") -le 98 ] && [ $(php -r "echo PHP_MAJOR_VERSION;") -le 5 ]; then echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;' -before_script: +install: # by default, --remote is not used on travis - git submodule update --remote --force - - sh -c 'if [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ] && [ $(php -r "echo PHP_MAJOR_VERSION;") -le 5 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;' - - sh -c 'if [ $(php -r "echo PHP_RELEASE_VERSION;") -le 98 ] && [ $(php -r "echo PHP_MAJOR_VERSION;") -le 5 ]; then echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;' - - composer install + - composer install --prefer-dist --no-progress --no-suggest -o script: - php data/bin/check_configuration.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 022e5a39e..9b84ddec7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,21 @@ CHANGELOG ========= +xx/xx/xxxx: Version 1.5.13 +-------------------------- + +* Fix for `Warning: ini_set(): A session is active...` #229 + +========= + +03/04/2020: Version 1.5.12 +-------------------------- + +* Move project from @LExpress to @FriendsOfSymfony1 +* Some doc & readme update +* Fixes for PHP 7.3 & 7.4 (thanks @W0rma for the code and @alquerci for the review) #224 +* Backport fix for cve-2019-18888 by @adrienperonnet #218 + 17/03/2018: Version 1.5.11 -------------------------- diff --git a/README.md b/README.md index 06b00303d..5a415e134 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ The end result of these advantages means there is no need to reinvent the wheel Symfony was written entirely in PHP 5. It has been thoroughly tested in various real-world projects, and is actually in use for high-demand e-business websites. It is compatible with most of the available databases engines, including MySQL, PostgreSQL, Oracle, and Microsoft SQL Server. -It runs on *nix and Windows platforms. +It runs on *nix and Windows platforms*. Requirements ------------ diff --git a/composer.json b/composer.json index 2562a3bc5..8e3a7c61b 100755 --- a/composer.json +++ b/composer.json @@ -1,19 +1,20 @@ { - "name": "lexpress/symfony1", + "name": "friendsofsymfony1/symfony1", "description": "Fork of symfony 1.4 with dic, form enhancements, latest swiftmailer and better performance", + "type": "library", "license": "MIT", "require": { + "php" : ">=5.3.0", "swiftmailer/swiftmailer": "~5.2" }, "require-dev": { "psr/log": "*" }, - "type": "library", "autoload": { "files": ["autoload.php"] }, "suggest": { - "lexpress/doctrine1": "Doctrine plugin", + "friendsofsymfony1/doctrine1": "Doctrine plugin", "propel/sf-propel-o-r-m-plugin": "Propel plugin", "psr/log": "Psr logger" }, From 28fa68237e2ed4aa25eba8c453884b0a681c4ce2 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 8 Jun 2020 15:48:13 +0200 Subject: [PATCH 20/34] 1.5.13 --- CHANGELOG.md | 7 ++++--- lib/autoload/sfCoreAutoload.class.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b84ddec7..33855aef2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,13 @@ CHANGELOG ========= -xx/xx/xxxx: Version 1.5.13 +08/06/2020: Version 1.5.13 -------------------------- * Fix for `Warning: ini_set(): A session is active...` #229 - -========= +* Php 7.4 Incompatibility Fixes #228 +* Remove notice appeared on php 7.4 #230 +* Rename package to `friendsofsymfony1/symfony1` #231 03/04/2020: Version 1.5.12 -------------------------- diff --git a/lib/autoload/sfCoreAutoload.class.php b/lib/autoload/sfCoreAutoload.class.php index f1bc5822f..104a67238 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.13-dev'); +define('SYMFONY_VERSION', '1.5.13'); /** * sfCoreAutoload class. From 1c02ce21540081286827c6d6666fb8ab0fcb3b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Benoist?= Date: Thu, 18 Jun 2020 13:17:50 +0200 Subject: [PATCH 21/34] Update package name --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5a415e134..38d65cc4b 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ See http://symfony.com/legacy/doc/getting-started/1_4/en/03-Symfony-Installation Option 1: Using [Composer](http://getcomposer.org/doc/00-intro.md) as dependency management: - composer require lexpress/symfony1 "1.5.*" + composer require friendsofsymfony1/symfony1 "1.5.*" composer install Note: On windows, if your project is a few directories down from the drive root, composer can throw an error relating to ZipArchive::extractTo(), this can be because pathnames are too long. There currently appears to be no proper solution but a workaround is to move your project to the drive root, run the commands from there, where they will run happily, and then move your project back. From 2987dcda4746c1bbb3a07ed3843a3efa31f64c84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Benoist?= Date: Thu, 18 Jun 2020 14:20:19 +0200 Subject: [PATCH 22/34] 1.5.14-dev --- lib/autoload/sfCoreAutoload.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/autoload/sfCoreAutoload.class.php b/lib/autoload/sfCoreAutoload.class.php index 104a67238..5e1604f79 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.13'); +define('SYMFONY_VERSION', '1.5.14-dev'); /** * sfCoreAutoload class. From e79e664214ec77ab20e6e059812af0784914b7b9 Mon Sep 17 00:00:00 2001 From: pathumhdes Date: Fri, 19 Jun 2020 09:12:15 +0530 Subject: [PATCH 23/34] Fixing Issue #234 --- lib/validator/sfValidatorBoolean.class.php | 8 ++++---- test/unit/validator/sfValidatorBooleanTest.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) mode change 100644 => 100755 lib/validator/sfValidatorBoolean.class.php mode change 100644 => 100755 test/unit/validator/sfValidatorBooleanTest.php diff --git a/lib/validator/sfValidatorBoolean.class.php b/lib/validator/sfValidatorBoolean.class.php old mode 100644 new mode 100755 index 43e476ef4..e226edeaa --- a/lib/validator/sfValidatorBoolean.class.php +++ b/lib/validator/sfValidatorBoolean.class.php @@ -33,8 +33,8 @@ class sfValidatorBoolean extends sfValidatorBase */ protected function configure($options = array(), $messages = array()) { - $this->addOption('true_values', array('true', 't', 'yes', 'y', 'on', '1')); - $this->addOption('false_values', array('false', 'f', 'no', 'n', 'off', '0')); + $this->addOption('true_values', array('true', 't', 'yes', 'y', 'on', '1', 1, true)); + $this->addOption('false_values', array('false', 'f', 'no', 'n', 'off', '0', 0, false)); $this->setOption('required', false); $this->setOption('empty_value', false); @@ -45,12 +45,12 @@ protected function configure($options = array(), $messages = array()) */ protected function doClean($value) { - if (in_array($value, $this->getOption('true_values'))) + if (in_array($value, $this->getOption('true_values'), true)) { return true; } - if (in_array($value, $this->getOption('false_values'))) + if (in_array($value, $this->getOption('false_values'), true)) { return false; } diff --git a/test/unit/validator/sfValidatorBooleanTest.php b/test/unit/validator/sfValidatorBooleanTest.php old mode 100644 new mode 100755 index 944455bf9..d77efcfdd --- a/test/unit/validator/sfValidatorBooleanTest.php +++ b/test/unit/validator/sfValidatorBooleanTest.php @@ -10,7 +10,7 @@ require_once(__DIR__.'/../../bootstrap/unit.php'); -$t = new lime_test(17); +$t = new lime_test(21); $v = new sfValidatorBoolean(); From 5d174453214e0f71a23c5a6b6a59132226b63bdc Mon Sep 17 00:00:00 2001 From: pathumhdes Date: Sat, 20 Jun 2020 07:43:38 +0530 Subject: [PATCH 24/34] Redefining the fix to avoid the BC break --- lib/validator/sfValidatorBoolean.class.php | 9 +++++---- test/unit/validator/sfValidatorBooleanTest.php | 18 +++++++++++++++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/lib/validator/sfValidatorBoolean.class.php b/lib/validator/sfValidatorBoolean.class.php index e226edeaa..ea4da0c26 100755 --- a/lib/validator/sfValidatorBoolean.class.php +++ b/lib/validator/sfValidatorBoolean.class.php @@ -33,8 +33,8 @@ class sfValidatorBoolean extends sfValidatorBase */ protected function configure($options = array(), $messages = array()) { - $this->addOption('true_values', array('true', 't', 'yes', 'y', 'on', '1', 1, true)); - $this->addOption('false_values', array('false', 'f', 'no', 'n', 'off', '0', 0, false)); + $this->addOption('true_values', array('true', 't', 'yes', 'y', 'on', '1')); + $this->addOption('false_values', array('false', 'f', 'no', 'n', 'off', '0')); $this->setOption('required', false); $this->setOption('empty_value', false); @@ -45,12 +45,13 @@ protected function configure($options = array(), $messages = array()) */ protected function doClean($value) { - if (in_array($value, $this->getOption('true_values'), true)) + $stringValue = $value !== false ? (string) $value : '0'; + if (in_array($stringValue, $this->getOption('true_values'))) { return true; } - if (in_array($value, $this->getOption('false_values'), true)) + if (in_array($stringValue, $this->getOption('false_values'))) { return false; } diff --git a/test/unit/validator/sfValidatorBooleanTest.php b/test/unit/validator/sfValidatorBooleanTest.php index d77efcfdd..981f814c2 100755 --- a/test/unit/validator/sfValidatorBooleanTest.php +++ b/test/unit/validator/sfValidatorBooleanTest.php @@ -10,7 +10,7 @@ require_once(__DIR__.'/../../bootstrap/unit.php'); -$t = new lime_test(21); +$t = new lime_test(23); $v = new sfValidatorBoolean(); @@ -31,6 +31,22 @@ $t->is($v->clean($false_value), false, '->clean() returns false if the value is in the false_values option'); } +// other special test cases +$t->is($v->clean(0), false, '->clean() returns false if the value is 0'); +$t->is($v->clean(false), false, '->clean() returns false if the value is false'); +$t->is($v->clean(1), true, '->clean() returns true if the value is 1'); +$t->is($v->clean(true), true, '->clean() returns true if the value is true'); +$t->is($v->clean(''), false, '->clean() returns false if the value is empty string as empty_value is false by default'); + +class MyFalseClass +{ + public function __toString() + { + return 'false'; + } +} +$t->is($v->clean(new MyFalseClass()), false, '->clean() returns false if the value is false'); + // required is false by default $t->is($v->clean(null), false, '->clean() returns false if the value is null'); From a38381f9736fd0079734321a8517dae015c60443 Mon Sep 17 00:00:00 2001 From: pathumhdes Date: Sat, 27 Jun 2020 09:06:39 +0530 Subject: [PATCH 25/34] Revise the fix to avoid the BC break --- lib/validator/sfValidatorBoolean.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/validator/sfValidatorBoolean.class.php b/lib/validator/sfValidatorBoolean.class.php index ea4da0c26..b7d92b667 100755 --- a/lib/validator/sfValidatorBoolean.class.php +++ b/lib/validator/sfValidatorBoolean.class.php @@ -45,13 +45,13 @@ protected function configure($options = array(), $messages = array()) */ protected function doClean($value) { - $stringValue = $value !== false ? (string) $value : '0'; - if (in_array($stringValue, $this->getOption('true_values'))) + $checkValue = $value === 0 ? '0' : $value; + if (in_array($checkValue, $this->getOption('true_values'))) { return true; } - if (in_array($stringValue, $this->getOption('false_values'))) + if (in_array($checkValue, $this->getOption('false_values'))) { return false; } From 07f31d6ea5472bd431dfd030454bd5080ee3adbf Mon Sep 17 00:00:00 2001 From: "Thomas A. Hirsch" Date: Tue, 8 Sep 2020 10:26:24 +0200 Subject: [PATCH 26/34] Updated lexpress to fos1 in the submodules. --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index f9e1e7496..3ee8d0c7d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,4 +4,4 @@ branch = 5.x [submodule "lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine"] path = lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine - url = https://github.com/LExpress/doctrine1.git + url = https://github.com/FriendsOfSymfony1/doctrine1.git From 9c1ef4e1bb21e16cb165e3716c780b5c7733cec6 Mon Sep 17 00:00:00 2001 From: "Thomas A. Hirsch" Date: Wed, 9 Sep 2020 21:21:10 +0200 Subject: [PATCH 27/34] Changes to allow Swiftmailer 5 and 6. --- composer.json | 2 +- lib/mailer/sfMailer.class.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 8e3a7c61b..150e446cb 100755 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "license": "MIT", "require": { "php" : ">=5.3.0", - "swiftmailer/swiftmailer": "~5.2" + "swiftmailer/swiftmailer": "~5.2|^6.0" }, "require-dev": { "psr/log": "*" diff --git a/lib/mailer/sfMailer.class.php b/lib/mailer/sfMailer.class.php index ee9ce93e8..fc545ff86 100755 --- a/lib/mailer/sfMailer.class.php +++ b/lib/mailer/sfMailer.class.php @@ -239,7 +239,8 @@ public function setDeliveryAddress($address) */ public function compose($from = null, $to = null, $subject = null, $body = null) { - return Swift_Message::newInstance() + $msg = new Swift_Message(); + return $msg ->setFrom($from) ->setTo($to) ->setSubject($subject) @@ -282,7 +283,7 @@ public function sendNextImmediately() * * @return int|false The number of sent emails */ - public function send(Swift_Mime_Message $message, &$failedRecipients = null) + public function send($message, &$failedRecipients = null) { if ($this->force) { From 1c64cbdfd98f76f0bb1d87ee5736643a32f6f627 Mon Sep 17 00:00:00 2001 From: "Thomas A. Hirsch" Date: Thu, 10 Sep 2020 07:42:18 +0200 Subject: [PATCH 28/34] PR feedback. --- lib/mailer/sfMailer.class.php | 5 +++-- lib/mailer/sfNoMailer.class.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/mailer/sfMailer.class.php b/lib/mailer/sfMailer.class.php index fc545ff86..86afba3e3 100755 --- a/lib/mailer/sfMailer.class.php +++ b/lib/mailer/sfMailer.class.php @@ -240,6 +240,7 @@ public function setDeliveryAddress($address) public function compose($from = null, $to = null, $subject = null, $body = null) { $msg = new Swift_Message(); + return $msg ->setFrom($from) ->setTo($to) @@ -278,8 +279,8 @@ public function sendNextImmediately() /** * Sends the given message. * - * @param Swift_Transport $transport A transport instance - * @param string[] &$failedRecipients An array of failures by-reference + * @param Swift_Mime_Message|Swift_Mime_SimpleMessage $message The message to send. + * @param string[] &$failedRecipients An array of failures by-reference * * @return int|false The number of sent emails */ diff --git a/lib/mailer/sfNoMailer.class.php b/lib/mailer/sfNoMailer.class.php index 83324e9a0..507b61a33 100644 --- a/lib/mailer/sfNoMailer.class.php +++ b/lib/mailer/sfNoMailer.class.php @@ -56,7 +56,7 @@ public function sendNextImmediately() return null; } - public function send(Swift_Mime_Message $message, &$failedRecipients = null) + public function send($message, &$failedRecipients = null) { return null; } From 44bcf108ba725e0e3c834db6aa506d50bcfd6b90 Mon Sep 17 00:00:00 2001 From: Sergey Matvienko Date: Thu, 19 Nov 2020 14:36:11 +0200 Subject: [PATCH 29/34] Update composer.json to automatically remove `lexpress/symfony1` package --- composer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composer.json b/composer.json index 8e3a7c61b..7a963b7b5 100755 --- a/composer.json +++ b/composer.json @@ -23,5 +23,8 @@ "dev-master": "1.5-dev" } }, + "replace": { + "lexpress/symfony1": "^1.5" + }, "bin": ["data/bin/symfony"] } From 8ae3232c51e309e1244a76c6559f92623894a007 Mon Sep 17 00:00:00 2001 From: "Thomas A. Hirsch" Date: Tue, 23 Mar 2021 18:00:40 +0100 Subject: [PATCH 30/34] PR feedback. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 150e446cb..d5bc7d931 100755 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "license": "MIT", "require": { "php" : ">=5.3.0", - "swiftmailer/swiftmailer": "~5.2|^6.0" + "swiftmailer/swiftmailer": "~5.2 || ^6.0" }, "require-dev": { "psr/log": "*" From 10e1a1b175d4c86f44b9843d413b3cc2702ad5a8 Mon Sep 17 00:00:00 2001 From: Pavel Date: Wed, 12 May 2021 20:45:02 +1000 Subject: [PATCH 31/34] Update PHPDoc for sfWebController::redirect() func We can actually pass array to sfWebController::redirect() function as first parameter, but IDE wrongly highlights this as "Expected parameter of type 'string', 'array' provided". --- lib/controller/sfWebController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/controller/sfWebController.class.php b/lib/controller/sfWebController.class.php index b7eb9f466..52944443c 100644 --- a/lib/controller/sfWebController.class.php +++ b/lib/controller/sfWebController.class.php @@ -168,7 +168,7 @@ public function convertUrlStringToParameters($url) /** * Redirects the request to another URL. * - * @param string $url An associative array of URL parameters or an internal URI as a string + * @param mixed $url An associative array of URL parameters or an internal URI as a string * @param int $delay A delay in seconds before redirecting. This is only needed on * browsers that do not support HTTP headers * @param int $statusCode The status code From aa68163805d5c05ce3dac1364d1bc89cc192a15b Mon Sep 17 00:00:00 2001 From: Pavel Date: Fri, 14 May 2021 19:08:06 +1000 Subject: [PATCH 32/34] sfWebController::redirect() - PHPDoc with more precise types The more precise the types are, the better IDE will help preventing errors. Co-authored-by: Ivan Voskoboinyk --- lib/controller/sfWebController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/controller/sfWebController.class.php b/lib/controller/sfWebController.class.php index 52944443c..0b0dffb18 100644 --- a/lib/controller/sfWebController.class.php +++ b/lib/controller/sfWebController.class.php @@ -168,7 +168,7 @@ public function convertUrlStringToParameters($url) /** * Redirects the request to another URL. * - * @param mixed $url An associative array of URL parameters or an internal URI as a string + * @param string|array $url An associative array of URL parameters or an internal URI as a string * @param int $delay A delay in seconds before redirecting. This is only needed on * browsers that do not support HTTP headers * @param int $statusCode The status code From c5bf8ceb0c9e04640eadb01546ee1cb882363b9a Mon Sep 17 00:00:00 2001 From: Pavel Date: Fri, 14 May 2021 19:20:21 +1000 Subject: [PATCH 33/34] sfWebController::genUrl() - PHPDoc with more precise types According to discussion: https://github.com/FriendsOfSymfony1/symfony1/pull/246#discussion_r632077346 --- lib/controller/sfWebController.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/controller/sfWebController.class.php b/lib/controller/sfWebController.class.php index 0b0dffb18..ebf54500f 100644 --- a/lib/controller/sfWebController.class.php +++ b/lib/controller/sfWebController.class.php @@ -23,8 +23,8 @@ abstract class sfWebController extends sfController /** * Generates an URL from an array of parameters. * - * @param mixed $parameters An associative array of URL parameters or an internal URI as a string. - * @param boolean $absolute Whether to generate an absolute URL + * @param string|array $parameters An associative array of URL parameters or an internal URI as a string. + * @param boolean $absolute Whether to generate an absolute URL * * @return string A URL to a symfony resource */ @@ -168,10 +168,10 @@ public function convertUrlStringToParameters($url) /** * Redirects the request to another URL. * - * @param string|array $url An associative array of URL parameters or an internal URI as a string - * @param int $delay A delay in seconds before redirecting. This is only needed on - * browsers that do not support HTTP headers - * @param int $statusCode The status code + * @param string|array $url An associative array of URL parameters or an internal URI as a string + * @param int $delay A delay in seconds before redirecting. This is only needed on + * browsers that do not support HTTP headers + * @param int $statusCode The status code * * @throws InvalidArgumentException If the url argument is null or an empty string */ From de1836e801d1cb22381388f1d19ca89d5a47831b Mon Sep 17 00:00:00 2001 From: Sebastian Butsch <5646364+wutsch0@users.noreply.github.com> Date: Wed, 27 Jun 2018 17:28:59 +0200 Subject: [PATCH 34/34] Rebase upstream Use strict comparison in `in_array()` and add boolean and usual integer values to 'true_values' and 'false_values' options --- lib/validator/sfValidatorBoolean.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/validator/sfValidatorBoolean.class.php b/lib/validator/sfValidatorBoolean.class.php index b7d92b667..f8f15f7e1 100755 --- a/lib/validator/sfValidatorBoolean.class.php +++ b/lib/validator/sfValidatorBoolean.class.php @@ -33,8 +33,8 @@ class sfValidatorBoolean extends sfValidatorBase */ protected function configure($options = array(), $messages = array()) { - $this->addOption('true_values', array('true', 't', 'yes', 'y', 'on', '1')); - $this->addOption('false_values', array('false', 'f', 'no', 'n', 'off', '0')); + $this->addOption('true_values', array('true', 't', 'yes', 'y', 'on', '1', true, 1)); + $this->addOption('false_values', array('false', 'f', 'no', 'n', 'off', '0', false, 0)); $this->setOption('required', false); $this->setOption('empty_value', false); @@ -46,12 +46,12 @@ protected function configure($options = array(), $messages = array()) protected function doClean($value) { $checkValue = $value === 0 ? '0' : $value; - if (in_array($checkValue, $this->getOption('true_values'))) + if (in_array($checkValue, $this->getOption('true_values'), true)) { return true; } - if (in_array($checkValue, $this->getOption('false_values'))) + if (in_array($checkValue, $this->getOption('false_values'), true)) { return false; }