From a8b34348e714395bf15c88299adae1779253bb67 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Fri, 15 Feb 2019 18:30:30 +0100 Subject: [PATCH 01/11] [Debug][ErrorHandler] Preserve next error handler Co-authored-by: Joe --- src/Symfony/Component/Debug/ErrorHandler.php | 7 +++- .../Debug/Tests/ErrorHandlerTest.php | 39 +++++++++++++------ .../ErrorHandlerThatUsesThePreviousOne.php | 22 +++++++++++ .../Fixtures/LoggerThatSetAnErrorHandler.php | 5 ++- 4 files changed, 58 insertions(+), 15 deletions(-) create mode 100644 src/Symfony/Component/Debug/Tests/Fixtures/ErrorHandlerThatUsesThePreviousOne.php diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index 22a6426dab..66966db62d 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -517,6 +517,11 @@ class ErrorHandler $errorAsException ? ['exception' => $errorAsException] : [], ]; } else { + if (!\defined('HHVM_VERSION')) { + $currentErrorHandler = set_error_handler('var_dump'); + restore_error_handler(); + } + try { $this->isRecursive = true; $level = ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG; @@ -525,7 +530,7 @@ class ErrorHandler $this->isRecursive = false; if (!\defined('HHVM_VERSION')) { - set_error_handler([$this, __FUNCTION__]); + set_error_handler($currentErrorHandler); } } } diff --git a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php index 6e0afd55ca..c1dea75bbd 100644 --- a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php @@ -12,12 +12,12 @@ namespace Symfony\Component\Debug\Tests; use PHPUnit\Framework\TestCase; -use Psr\Log\LoggerInterface; use Psr\Log\LogLevel; use Psr\Log\NullLogger; use Symfony\Component\Debug\BufferingLogger; use Symfony\Component\Debug\ErrorHandler; use Symfony\Component\Debug\Exception\SilencedErrorContext; +use Symfony\Component\Debug\Tests\Fixtures\ErrorHandlerThatUsesThePreviousOne; use Symfony\Component\Debug\Tests\Fixtures\LoggerThatSetAnErrorHandler; /** @@ -590,26 +590,40 @@ class ErrorHandlerTest extends TestCase } /** - * @dataProvider errorHandlerIsNotLostWhenLoggingProvider + * @dataProvider errorHandlerWhenLoggingProvider */ - public function testErrorHandlerIsNotLostWhenLogging($customErrorHandlerHasBeenPreviouslyDefined, LoggerInterface $logger) + public function testErrorHandlerWhenLogging($previousHandlerWasDefined, $loggerSetsAnotherHandler, $nextHandlerIsDefined) { try { - if ($customErrorHandlerHasBeenPreviouslyDefined) { + if ($previousHandlerWasDefined) { set_error_handler('count'); } + $logger = $loggerSetsAnotherHandler ? new LoggerThatSetAnErrorHandler() : new NullLogger(); + $handler = ErrorHandler::register(); $handler->setDefaultLogger($logger); + if ($nextHandlerIsDefined) { + $handler = ErrorHandlerThatUsesThePreviousOne::register(); + } + @trigger_error('foo', E_USER_DEPRECATED); @trigger_error('bar', E_USER_DEPRECATED); $this->assertSame([$handler, 'handleError'], set_error_handler('var_dump')); + if ($logger instanceof LoggerThatSetAnErrorHandler) { + $this->assertCount(2, $logger->cleanLogs()); + } + restore_error_handler(); - if ($customErrorHandlerHasBeenPreviouslyDefined) { + if ($previousHandlerWasDefined) { + restore_error_handler(); + } + + if ($nextHandlerIsDefined) { restore_error_handler(); } } finally { @@ -618,13 +632,14 @@ class ErrorHandlerTest extends TestCase } } - public function errorHandlerIsNotLostWhenLoggingProvider() + public function errorHandlerWhenLoggingProvider() { - return [ - [false, new NullLogger()], - [true, new NullLogger()], - [false, new LoggerThatSetAnErrorHandler()], - [true, new LoggerThatSetAnErrorHandler()], - ]; + foreach ([false, true] as $previousHandlerWasDefined) { + foreach ([false, true] as $loggerSetsAnotherHandler) { + foreach ([false, true] as $nextHandlerIsDefined) { + yield [$previousHandlerWasDefined, $loggerSetsAnotherHandler, $nextHandlerIsDefined]; + } + } + } } } diff --git a/src/Symfony/Component/Debug/Tests/Fixtures/ErrorHandlerThatUsesThePreviousOne.php b/src/Symfony/Component/Debug/Tests/Fixtures/ErrorHandlerThatUsesThePreviousOne.php new file mode 100644 index 0000000000..d449c40cc7 --- /dev/null +++ b/src/Symfony/Component/Debug/Tests/Fixtures/ErrorHandlerThatUsesThePreviousOne.php @@ -0,0 +1,22 @@ + Date: Fri, 15 Feb 2019 10:01:57 +0200 Subject: [PATCH 02/11] =?UTF-8?q?#30172=20Add=20the=20missing=20validation?= =?UTF-8?q?=20translations=20for=20the=20Luxembourgish=20=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Resources/translations/validators.lb.xlf | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.lb.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.lb.xlf index bdbc9da09c..4c3579fb58 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.lb.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.lb.xlf @@ -322,6 +322,18 @@ This is not a valid UUID. Dëst ass keng gëlteg UUID. + + This value should be a multiple of {{ compared_value }}. + Dëse Wäert sollt e puer vun {{ compared_value }} sinn. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Dëse "Business Identifier Code" (BIC) ass net mat IBAN verbonnen {{ iban }}. + + + This value should be valid JSON. + Dëse Wäert sollt gëlteg JSON. + From f9772359b3ed1d485ed44e746e2d493854a72541 Mon Sep 17 00:00:00 2001 From: JL Date: Thu, 14 Feb 2019 14:11:29 +0200 Subject: [PATCH 03/11] Update validators.lt.xlf --- .../Resources/translations/validators.lt.xlf | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf index 60641b5e68..9a20d9172e 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf @@ -302,10 +302,38 @@ An empty file is not allowed. Failas negali būti tuščias. + + The host could not be resolved. + Serveris nepasiekiamas. + + + This value does not match the expected {{ charset }} charset. + Ši reikšmė neatitinka {{ charset }} koduotės. + + + This is not a valid Business Identifier Code (BIC). + Bendrovės Identifikavimo Kodas (BIC) nėra tinkamas. + Error Klaida + + This is not a valid UUID. + Ši reikšmė nėra tinkamas UUID. + + + This value should be a multiple of {{ compared_value }}. + Ši reikšmė turi būti skaičiaus {{ compared_value }} kartotinis. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Šis bendrovės identifikavimo kodas (BIC) nesusijęs su IBAN {{ iban }} + + + This value should be valid JSON. + Ši reikšmė turi būti tinkamo JSON formato. + From 85c448e915c5979949871127969809db0d213399 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 16 Feb 2019 12:46:43 +0100 Subject: [PATCH 04/11] added missing dot --- .../Validator/Resources/translations/validators.lt.xlf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf index 9a20d9172e..02eece5965 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf @@ -328,7 +328,7 @@ This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. - Šis bendrovės identifikavimo kodas (BIC) nesusijęs su IBAN {{ iban }} + Šis bendrovės identifikavimo kodas (BIC) nesusijęs su IBAN {{ iban }}. This value should be valid JSON. From bd719cd7e1956404b41a90e0b76e9fb270a8cedd Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 13 Feb 2019 23:17:49 +0100 Subject: [PATCH 05/11] [Twig] removed usage of non-namespaced classes --- src/Symfony/Bridge/Twig/DataCollector/TwigDataCollector.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/Twig/DataCollector/TwigDataCollector.php b/src/Symfony/Bridge/Twig/DataCollector/TwigDataCollector.php index 04b8dda567..80e36e0491 100644 --- a/src/Symfony/Bridge/Twig/DataCollector/TwigDataCollector.php +++ b/src/Symfony/Bridge/Twig/DataCollector/TwigDataCollector.php @@ -16,6 +16,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\DataCollector\DataCollector; use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface; use Twig\Environment; +use Twig\Error\LoaderError; use Twig\Markup; use Twig\Profiler\Dumper\HtmlDumper; use Twig\Profiler\Profile; @@ -70,7 +71,7 @@ class TwigDataCollector extends DataCollector implements LateDataCollectorInterf if ($profile->isTemplate()) { try { $template = $this->twig->load($name = $profile->getName()); - } catch (\Twig_Error_Loader $e) { + } catch (LoaderError $e) { $template = null; } From da325fc0e2b8348f839ed497384cabce39aa6e01 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 16 Feb 2019 12:54:38 +0100 Subject: [PATCH 06/11] bug #30245 fix lost namespace in eval (fizzka) This PR was squashed before being merged into the 4.2 branch (closes #30245). Discussion ---------- fix lost namespace in eval Bugfix: phpunit8 tearDown() declaration Commits ------- 8743a1ada8 fix lost namespace in eval --- .../FrameworkBundle/Test/KernelShutdownOnTearDownTrait.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/KernelShutdownOnTearDownTrait.php b/src/Symfony/Bundle/FrameworkBundle/Test/KernelShutdownOnTearDownTrait.php index 7eb4d0726e..b01dbb0494 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Test/KernelShutdownOnTearDownTrait.php +++ b/src/Symfony/Bundle/FrameworkBundle/Test/KernelShutdownOnTearDownTrait.php @@ -16,7 +16,9 @@ use PHPUnit\Framework\TestCase; // Auto-adapt to PHPUnit 8 that added a `void` return-type to the tearDown method if (method_exists(\ReflectionMethod::class, 'hasReturnType') && (new \ReflectionMethod(TestCase::class, 'tearDown'))->hasReturnType()) { -eval(' + eval(' + namespace Symfony\Bundle\FrameworkBundle\Test; + /** * @internal */ From 1090b8cb6e7abb946a0c64d021de85ebdee25a7b Mon Sep 17 00:00:00 2001 From: Gocha Ossinkine Date: Thu, 14 Feb 2019 21:08:19 +0500 Subject: [PATCH 07/11] Don't resolve the Deprecation error handler mode until a deprecation is triggered --- src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php index b81eff528a..fc60cbd436 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php @@ -105,8 +105,7 @@ class DeprecationErrorHandler 'remaining vendor' => array(), ); $deprecationHandler = function ($type, $msg, $file, $line, $context = array()) use (&$deprecations, $getMode, $UtilPrefix, $inVendors) { - $mode = $getMode(); - if ((E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) || DeprecationErrorHandler::MODE_DISABLED === $mode) { + if ((E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) || DeprecationErrorHandler::MODE_DISABLED === $mode = $getMode()) { $ErrorHandler = $UtilPrefix.'ErrorHandler'; return $ErrorHandler::handleError($type, $msg, $file, $line, $context); From 46d6a4d9ec54a57e271accf955c4a7bd9945ae3e Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 16 Feb 2019 23:37:38 +0100 Subject: [PATCH 08/11] [VarDumper] fix serializing Stub instances --- .../Component/VarDumper/Cloner/Stub.php | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Component/VarDumper/Cloner/Stub.php b/src/Symfony/Component/VarDumper/Cloner/Stub.php index 08fba75930..27dd3ef32c 100644 --- a/src/Symfony/Component/VarDumper/Cloner/Stub.php +++ b/src/Symfony/Component/VarDumper/Cloner/Stub.php @@ -39,22 +39,29 @@ class Stub public $position = 0; public $attr = []; + private static $defaultProperties = []; + /** * @internal */ public function __sleep() { - $this->serialized = [$this->class, $this->position, $this->cut, $this->type, $this->value, $this->handle, $this->refCount, $this->attr]; + $properties = []; - return ['serialized']; - } + if (!isset(self::$defaultProperties[$c = \get_class($this)])) { + self::$defaultProperties[$c] = get_class_vars($c); - /** - * @internal - */ - public function __wakeup() - { - list($this->class, $this->position, $this->cut, $this->type, $this->value, $this->handle, $this->refCount, $this->attr) = $this->serialized; - unset($this->serialized); + foreach ((new \ReflectionClass($c))->getStaticProperties() as $k => $v) { + unset(self::$defaultProperties[$c][$k]); + } + } + + foreach (self::$defaultProperties[$c] as $k => $v) { + if ($this->$k !== $v) { + $properties[] = $k; + } + } + + return $properties; } } From 5cac9ad97d3d736f30ba948a4f2d2e8b3d0c3278 Mon Sep 17 00:00:00 2001 From: Eno Mullaraj Date: Sun, 17 Feb 2019 13:24:11 +0100 Subject: [PATCH 09/11] [Validator] improve translations for albanian ("sq") locale * improve overall translation message consistency * fix singular expression messages * fix grammatical errors * use albanian form of expression * restore as lexical gap the "locale" translation --- .../Resources/translations/validators.sq.xlf | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.sq.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.sq.xlf index 4ee22e31f2..569ebca47f 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.sq.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.sq.xlf @@ -24,15 +24,15 @@ You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. - Duhet të zgjedhni së paku {{ limit }} alternativa.|Duhet të zgjedhni së paku {{ limit }} alternativa. + Duhet të zgjedhni së paku {{ limit }} alternativë.|Duhet të zgjedhni së paku {{ limit }} alternativa. You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. - Duhet të zgjedhni më së shumti {{ limit }} alternativa.|Duhet të zgjedhni më së shumti {{ limit }} alternativa. + Duhet të zgjedhni më së shumti {{ limit }} alternativë.|Duhet të zgjedhni më së shumti {{ limit }} alternativa. One or more of the given values is invalid. - Një apo më shumë nga vlerat e dhëna nuk janë të sakta. + Një apo më shumë nga vlerat e dhëna janë të pavlefshme. This field was not expected. @@ -40,7 +40,7 @@ This field is missing. - Kjo fushë është zhdukur. + Kjo fushë mungon. This value is not a valid date. @@ -52,7 +52,7 @@ This value is not a valid email address. - Kjo vlerë nuk është e-mail adresë e vlefshme. + Kjo vlerë nuk është adresë email-i e vlefshme. The file could not be found. @@ -64,11 +64,11 @@ The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. - File është shumë i madh ({{ size }} {{ suffix }}). Madhësia më e madhe e lejuar është {{ limit }} {{ suffix }}. + File është shumë i madh ({{ size }} {{ suffix }}). Madhësia maksimale e lejuar është {{ limit }} {{ suffix }}. The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. - Lloji mime i files nuk është i vlefshëm ({{ type }}). Llojet mime të lejuara janë {{ types }}. + Lloji mime i file-it është i pavlefshëm ({{ type }}). Llojet mime të lejuara janë {{ types }}. This value should be {{ limit }} or less. @@ -76,7 +76,7 @@ This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. - Kjo vlerë është shumë e gjatë. Duhet t'i ketë {{ limit }} ose më pak karaktere.|Kjo vlerë është shumë e gjatë. Duhet t'i ketë {{ limit }} ose më pak karaktere. + Kjo vlerë është shumë e gjatë. Duhet të përmbaj {{ limit }} karakter ose më pak.|Kjo vlerë është shumë e gjatë. Duhet të përmbaj {{ limit }} karaktere ose më pak. This value should be {{ limit }} or more. @@ -84,7 +84,7 @@ This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. - Kjo vlerë është shumë e shkurtër. Duhet t'i ketë {{ limit }} ose më shumë karaktere.|Kjo vlerë është shumë e shkurtër. Duhet t'i ketë {{ limit }} ose më shumë karaktere. + Kjo vlerë është shumë e shkurtër. Duhet të përmbaj {{ limit }} karakter ose më shumë.|Kjo vlerë është shumë e shkurtër. Duhet të përmbaj {{ limit }} karaktere ose më shumë. This value should not be blank. @@ -136,7 +136,7 @@ This is not a valid IP address. - Kjo vlerë nuk është IP adresë e vlefshme. + Kjo adresë IP nuk është e vlefshme. This value is not a valid language. @@ -144,7 +144,7 @@ This value is not a valid locale. - Kjo vlerë nuk është përcaktim rajonal i vlefshëm. + Kjo vlerë nuk është nje locale i vlefshëm. This value is not a valid country. @@ -156,7 +156,7 @@ The size of the image could not be detected. - Madhësia e këtij imazhi nuk mund të zbulohet. + Madhësia e imazhit nuk mund të zbulohet. The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. @@ -180,7 +180,7 @@ This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. - Kjo vlerë duhet të ketë saktësisht {{ limit }} karaktere.|Kjo vlerë duhet të ketë saktësisht {{ limit }} karaktere. + Kjo vlerë duhet të ketë saktësisht {{ limit }} karakter.|Kjo vlerë duhet të ketë saktësisht {{ limit }} karaktere. The file was only partially uploaded. @@ -200,27 +200,27 @@ A PHP extension caused the upload to fail. - Një ekstenzion i PHP-së bëri të dështojë ngarkimi i files. + Një ekstension i PHP-së shkaktoi dështimin e ngarkimit. This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. - Ky kolekcion duhet të përmbajë {{ limit }} ose më shumë elemente.|Ky kolekcion duhet të përmbajë {{ limit }} ose më shumë elemente. + Ky koleksion duhet të përmbajë {{ limit }} element ose më shumë.|Ky koleksion duhet të përmbajë {{ limit }} elemente ose më shumë. This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. - Ky kolekcion duhet të përmbajë {{ limit }} ose më pak elemente.|Ky kolekcion duhet të përmbajë {{ limit }} ose më pak elemente. + Ky koleksion duhet të përmbajë {{ limit }} element ose më pak.|Ky koleksion duhet të përmbajë {{ limit }} elemente ose më pak. This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. - Ky kolekcion duhet të përmbajë saktësisht {{ limit }} elemente.|Ky kolekcion duhet të përmbajë saktësisht {{ limit }} elemente. + Ky koleksion duhet të përmbajë saktësisht {{ limit }} element.|Ky koleksion duhet të përmbajë saktësisht {{ limit }} elemente. Invalid card number. - Numër kartele i pavlefshëm. + Numër karte i pavlefshëm. Unsupported card type or invalid card number. - Lloj kartele i pambështetur ose numër kartele i pavlefshëm. + Lloj karte i papranuar ose numër karte i pavlefshëm. This is not a valid International Bank Account Number (IBAN). @@ -292,11 +292,11 @@ The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. - Imazhi është i orientuar nga landscape ({{ width }}x{{ height }}px). Imazhet e orientuara nga landscape nuk lejohen. + Imazhi është i orientuar horizontalisht ({{ width }}x{{ height }}px). Imazhet e orientuara horizontalisht nuk lejohen. The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. - Imazhi është portret i orientuar ({{ width }}x{{ height }}px). Imazhet orientuese të portretit nuk lejohen. + Imazhi është i orientuar vertikalisht ({{ width }}x{{ height }}px). Imazhet orientuara vertikalisht nuk lejohen. An empty file is not allowed. @@ -304,15 +304,15 @@ The host could not be resolved. - Probleme me Host + Host-i nuk mund te zbulohej. This value does not match the expected {{ charset }} charset. - Kjo vlerë nuk përputhet me karakteret {{ charset }} e pritura. + Kjo vlerë nuk përputhet me kodifikimin e karaktereve {{ charset }} që pritej. This is not a valid Business Identifier Code (BIC). - Ky nuk është një Kod i Identifikueshëm i Biznesit (BIC). + Ky nuk është një Kod Identifikues i Biznesit (BIC) i vleflshem. Error @@ -320,7 +320,7 @@ This is not a valid UUID. - Kjo nuk është një UUID e vlefshme. + Ky nuk është një UUID i vlefshëm. This value should be a multiple of {{ compared_value }}. From 3fbcb965d0e7d2b9ea50075a47e623e647e5771e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Ostroluck=C3=BD?= Date: Sun, 17 Feb 2019 18:39:16 +0100 Subject: [PATCH 10/11] Remove unnecessary ProgressBar stdout writes (fixes flickering) --- .../Component/Console/Helper/ProgressBar.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Component/Console/Helper/ProgressBar.php b/src/Symfony/Component/Console/Helper/ProgressBar.php index a1c3cc5d21..1725655141 100644 --- a/src/Symfony/Component/Console/Helper/ProgressBar.php +++ b/src/Symfony/Component/Console/Helper/ProgressBar.php @@ -466,19 +466,16 @@ final class ProgressBar { if ($this->overwrite) { if (!$this->firstRun) { - // Move the cursor to the beginning of the line - $this->output->write("\x0D"); - - // Erase the line - $this->output->write("\x1B[2K"); - // Erase previous lines if ($this->formatLineCount > 0) { - $this->output->write(str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount)); + $message = str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount).$message; } + + // Move the cursor to the beginning of the line and erase the line + $message = "\x0D\x1B[2K$message"; } } elseif ($this->step > 0) { - $this->output->writeln(''); + $message = PHP_EOL.$message; } $this->firstRun = false; From ad752b1a484f47628a9f5f0d1716505465a32be6 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Sun, 17 Feb 2019 19:45:33 +0100 Subject: [PATCH 11/11] [TwigBridge] Fix test --- src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php b/src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php index e0e08232f5..3008f43f6f 100644 --- a/src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php @@ -54,7 +54,7 @@ class TransNodeTest extends TestCase protected function getVariableGetterWithStrictCheck($name) { if (Environment::MAJOR_VERSION >= 2) { - return sprintf('(isset($context["%1$s"]) || array_key_exists("%1$s", $context) ? $context["%1$s"] : (function () { throw new %2$s(\'Variable "%1$s" does not exist.\', 0, $this->source); })())', $name, Environment::VERSION_ID >= 20700 ? '\Twig\Error\RuntimeError' : 'Twig_Error_Runtime'); + return sprintf('(isset($context["%1$s"]) || array_key_exists("%1$s", $context) ? $context["%1$s"] : (function () { throw new %2$s(\'Variable "%1$s" does not exist.\', 0, $this->source); })())', $name, Environment::VERSION_ID >= 20700 ? 'RuntimeError' : 'Twig_Error_Runtime'); } if (\PHP_VERSION_ID >= 70000) {