Skip to content

[Translation] add Mo loader tests #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 9, 2011

Conversation

stealth35
Copy link

No description provided.

stof added a commit that referenced this pull request Nov 9, 2011
[Translation] add Mo loader tests
@stof stof merged commit 965f2bf into stof:gettext_loader Nov 9, 2011
stof pushed a commit that referenced this pull request Nov 17, 2011
Commits
-------

d974a4a Merge pull request #4 from stealth35/test_mo_loader
cf05646 delete useless tests
19f9de9 [Translation] fix gettext tests
965f2bf Merge pull request #3 from stealth35/test_mo_loader
9c2a26d [Translation] add Mo loader tests
9af2342 [Translation] Added the gettext loaders

Discussion
----------

[Translation] Added the gettext loaders

This is the squashed version of the work done by @xaav in symfony#634.

@stealth35 you said you will work on the dumpers. do you have some stuff on it ?

---------------------------------------------------------------------------

by drak at 2011/10/24 19:28:43 -0700

Is there any more progress with this?

---------------------------------------------------------------------------

by stealth35 at 2011/10/25 00:57:19 -0700

I work on the dumpers, but the Po loader is wrong, caus' the Po ressource can be multiline,

     msgid ""
     "Here is an example of how one might continue a very long string\n"
     "for the common case the string represents multi-line output.\n"

http://www.gnu.org/software/gettext/manual/gettext.html#PO-Files

Anyway the Po format is an intermediate format to Mo file, (like .txt to .res file for ICU), IMO we can just support the real gettext format : Mo

---------------------------------------------------------------------------

by stealth35 at 2011/11/03 02:00:24 -0700

@stof The MO Dumper is ready (stealth35/symfony@f2d1d5b), should we keep the PO format ?

---------------------------------------------------------------------------

by fabpot at 2011/11/07 08:50:59 -0800

@stealth35: The PO is what people will use for their translations. They will then dump it to MO. So, we need both PO and MO loaders and dumpers.

---------------------------------------------------------------------------

by stealth35 at 2011/11/08 01:25:39 -0800

@fabpot, I'm ready for both dumpers, you can merge this, and I'll open a PR for the dumpers

---------------------------------------------------------------------------

by fabpot at 2011/11/08 22:37:47 -0800

I've just had a look at this PR code again and I see that the unit tests are pretty slim. Is it possible to add some tests for the mo loader?

---------------------------------------------------------------------------

by stealth35 at 2011/11/09 01:15:25 -0800

@fabpot test send to @stof ✌️

---------------------------------------------------------------------------

by stof at 2011/11/09 02:22:55 -0800

and merged in this branch

---------------------------------------------------------------------------

by fabpot at 2011/11/09 02:39:09 -0800

The tests do not pass for me:

    There was 1 error:

    1) Symfony\Tests\Component\Translation\Loader\MoFileLoaderTest::testLoadDoesNothingIfEmpty
    InvalidArgumentException: MO stream content has an invalid format.

    /Users/fabien/work/symfony/git/symfony/src/Symfony/Component/Translation/Loader/MoFileLoader.php:79
    /Users/fabien/work/symfony/git/symfony/src/Symfony/Component/Translation/Loader/MoFileLoader.php:46
    /Users/fabien/work/symfony/git/symfony/tests/Symfony/Tests/Component/Translation/Loader/MoFileLoaderTest.php:34

    --

    There was 1 failure:

    1) Symfony\Tests\Component\Translation\Loader\PoFileLoaderTest::testLoad
    Failed asserting that two arrays are equal.
    --- Expected
    +++ Actual
    @@ @@
     Array (
    -    'foo' => 'bar'
     )

    /Users/fabien/work/symfony/git/symfony/tests/Symfony/Tests/Component/Translation/Loader/PoFileLoaderTest.php:25
stof pushed a commit that referenced this pull request Jan 10, 2013
fix typos in PhpMatcherDumper
stof pushed a commit that referenced this pull request Jan 10, 2013
This PR was merged into the master branch.

Commits
-------

c84907b Merge pull request #3 from Tobion/patch-5
9ab5e4f fix typos in PhpMatcherDumper
60eeacd Fixed typos
4a073e6 [Form] Fixed duplicate case expression

Discussion
----------

Fixed Typos

---------------------------------------------------------------------------

by Tobion at 2012-12-14T22:51:05Z

:+1: Thanks for fixing some of my typos.
@pborreli see pborreli/symfony#3
stof pushed a commit that referenced this pull request Dec 17, 2014
This PR was submitted for the master branch but it was merged into the 2.5 branch instead (closes symfony#12453).

Discussion
----------

[Debug] Show only unique class candidates

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

```
PHPUnit 4.3.5 by Sebastian Bergmann.

Configuration read from .../symfony/phpunit.xml.dist

S....S.............................FFFS.......

Time: 2.29 seconds, Memory: 8.50Mb

There were 3 failures:

1) Symfony\Component\Debug\Tests\FatalErrorHandler\ClassNotFoundFatalErrorHandlerTest::testClassNotFound with data set #2 (array(1, 12, 'foo.php', 'Class \'UndefinedFunctionException\' not found'), 'Attempted to load class "UndefinedFunctionException" from the global namespace.
Did you forget a "use" statement for "Symfony\\Component\\Debug\\Exception\\UndefinedFunctionException"?')
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
 Attempted to load class "UndefinedFunctionException" from the global namespace.
-Did you forget a "use" statement for "Symfony\Component\Debug\Exception\UndefinedFunctionException"?
+Did you forget a "use" statement for e.g. "Symfony\Component\Debug\Exception\UndefinedFunctionException" or "Symfony\Component\Debug\Exception\UndefinedFunctionException"?

.../symfony/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php:28

2) Symfony\Component\Debug\Tests\FatalErrorHandler\ClassNotFoundFatalErrorHandlerTest::testClassNotFound with data set #3 (array(1, 12, 'foo.php', 'Class \'PEARClass\' not found'), 'Attempted to load class "PEARClass" from the global namespace.
Did you forget a "use" statement for "Symfony_Component_Debug_Tests_Fixtures_PEARClass"?')
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
 Attempted to load class "PEARClass" from the global namespace.
-Did you forget a "use" statement for "Symfony_Component_Debug_Tests_Fixtures_PEARClass"?
+Did you forget a "use" statement for e.g. "Symfony_Component_Debug_Tests_Fixtures_PEARClass" or "Symfony_Component_Debug_Tests_Fixtures_PEARClass"?

.../symfony/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php:28

3) Symfony\Component\Debug\Tests\FatalErrorHandler\ClassNotFoundFatalErrorHandlerTest::testClassNotFound with data set #4 (array(1, 12, 'foo.php', 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found'), 'Attempted to load class "UndefinedFunctionException" from namespace "Foo\\Bar".
Did you forget a "use" statement for "Symfony\\Component\\Debug\\Exception\\UndefinedFunctionException"?')
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
 Attempted to load class "UndefinedFunctionException" from namespace "Foo\Bar".
-Did you forget a "use" statement for "Symfony\Component\Debug\Exception\UndefinedFunctionException"?
+Did you forget a "use" statement for e.g. "Symfony\Component\Debug\Exception\UndefinedFunctionException" or "Symfony\Component\Debug\Exception\UndefinedFunctionException"?

.../symfony/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php:28
```

Commits
-------

db8a3ae [Debug] Show only unique class candidates
stof pushed a commit that referenced this pull request Jul 2, 2015
This PR was merged into the 2.8 branch.

Discussion
----------

[VarDumper] Added support for SplFileInfo

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | ~
| License       | MIT
| Doc PR        | ~

Before:
```
SplFileInfo {#3}
```

After:
```
SplFileInfo {#3
  path: "/home/greg/dev/github.com/lyrixx/gaga-photo/fixtures"
  filename: "grisou.jpg"
  basename: "grisou.jpg"
  pathname: "/home/greg/dev/github.com/lyrixx/gaga-photo/fixtures/grisou.jpg"
  extension: "jpg"
  realPath: "/home/greg/dev/github.com/lyrixx/gaga-photo/fixtures/grisou.jpg"
  aTime: 2015-04-20 23:21:15
  mTime: 2014-08-17 15:37:36
  cTime: 2015-04-20 23:09:51
  inode: 12197643
  size: 966553
  perms: 0100750
  owner: 1000
  group: 1000
  type: "file"
  writable: true
  readable: true
  executable: true
  file: true
  dir: false
  link: false
}
```

For a link:

```
SplFileInfo {#3
  path: ""
  filename: "link"
  basename: "link"
  pathname: "link"
  extension: ""
  realPath: "/home/greg/dev/github.com/symfony/var-dumper/composer.json"
  aTime: 2015-04-20 23:39:15
  mTime: 2015-04-20 23:39:15
  cTime: 2015-04-20 23:39:15
  inode: 11272232
  size: 967
  perms: 0100644
  owner: 1000
  group: 1000
  type: "link"
  writable: true
  readable: true
  executable: false
  file: true
  dir: false
  link: true
  linkTarget: "composer.json"
}
```

For a remote file:

```
SplFileInfo {#3
  path: "http://google.com"
  filename: "foobar.php"
  basename: "foobar.php"
  pathname: "http://google.com/foobar.php"
  extension: "php"
  realPath: false
  writable: false
  readable: false
  executable: false
  file: false
  dir: false
  link: false
}
```

For a CSV:
```
SplFileObject {#3
  path: ""
  filename: "test.csv"
  basename: "test.csv"
  pathname: "test.csv"
  extension: "csv"
  realPath: "/home/greg/dev/github.com/symfony/var-dumper/test.csv"
  aTime: 2015-04-21 12:55:07
  mTime: 2015-04-21 12:55:07
  cTime: 2015-04-21 12:55:07
  inode: 11272237
  size: 0
  perms: 0100644
  owner: 1000
  group: 1000
  type: "file"
  writable: true
  readable: true
  executable: false
  file: true
  dir: false
  link: false
  csvControl: array:2 [
    0 => ","
    1 => """
  ]
  flags: SKIP_EMPTY|READ_CSV
  maxLineLen: 0
  fstat: array:7 [
    "dev" => 64513
    "ino" => 11272237
    "nlink" => 1
    "rdev" => 0
    "blksize" => 4096
    "blocks" => 0
    "…" => "…20"
  ]
  eof: false
  key: 0
}

Commits
-------

e75c233 [VarDumper] Added support for SplFileObject
eb50b13 [VarDumper] Added support for SplFileInfo
stof pushed a commit that referenced this pull request Nov 30, 2015
…eprecation on-demand (nicolas-grekas)

This PR was merged into the 2.8 branch.

Discussion
----------

[Bridge\PhpUnit] Display the stack trace of a deprecation on-demand

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

This PR has been essential into making symfony#16708, and I think everyone working on a 3.0 migration will need this.

Example:

```
$ SYMFONY_DEPRECATIONS_HELPER=/FormExtensionBootstrap3LayoutTest/ ./phpunit src/Symfony/Bridge/Twig/
PHPUnit 4.8.18 by Sebastian Bergmann and contributors.

Testing src/Symfony/Bridge/Twig/
................................................
Remaining deprecation triggered by Symfony\Bridge\Twig\Tests\Extension\FormExtensionBootstrap3LayoutTest::testSingleChoiceGrouped:
The value "false" for the "choices_as_values" option is deprecated since version 2.8 and will not be supported anymore in 3.0. Set this option to "true" and flip the contents of the "choices" option instead.
Stack trace:
#0 src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php(286): trigger_error()
#1 src/Symfony/Component/OptionsResolver/OptionsResolver.php(962): Symfony\Component\Form\Extension\Core\Type\ChoiceType->Symfony\Component\Form\Extension\Core\Type\{closure}()
#2 src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php(277): Symfony\Component\OptionsResolver\OptionsResolver->offsetGet()
#3 src/Symfony/Component/OptionsResolver/OptionsResolver.php(962): Symfony\Component\Form\Extension\Core\Type\ChoiceType->Symfony\Component\Form\Extension\Core\Type\{closure}()
#4 src/Symfony/Component/OptionsResolver/OptionsResolver.php(791): Symfony\Component\OptionsResolver\OptionsResolver->offsetGet()
symfony#5 src/Symfony/Component/Form/ResolvedFormType.php(156): Symfony\Component\OptionsResolver\OptionsResolver->resolve()
symfony#6 src/Symfony/Component/Form/FormFactory.php(119): Symfony\Component\Form\ResolvedFormType->createBuilder()
symfony#7 src/Symfony/Component/Form/FormFactory.php(48): Symfony\Component\Form\FormFactory->createNamedBuilder()
symfony#8 src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php(540): Symfony\Component\Form\FormFactory->createNamed()
symfony#9 [internal function]: Symfony\Component\Form\Tests\AbstractBootstrap3LayoutTest->testSingleChoiceGrouped()
symfony#10 {main}
KO src/Symfony/Bridge/Twig/
```

Commits
-------

5a88fb6 [Bridge\PhpUnit] Display the stack trace of a deprecation on-demand
stof pushed a commit that referenced this pull request Jan 24, 2017
…er in autowired classes (brainexe)

This PR was squashed before being merged into the 3.1 branch (closes symfony#21372).

Discussion
----------

[DependencyInjection] Fixed variadic method parameter in autowired classes

| Q             | A
| ------------- | ---
| Branch?       | 3.1
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | --
| License       | MIT

Autowiring classes containing methods with variadic method parameter throws a ReflectionException in compile process:

```
PHP Fatal error:  Uncaught ReflectionException: Internal error: Failed to retrieve the default value in /.../vendor/symfony/dependency-injection/Compiler/AutowirePass.php:437
Stack trace:
#0 /.../vendor/symfony/dependency-injection/Compiler/AutowirePass.php(437): ReflectionParameter->getDefaultValue()
#1 /.../vendor/symfony/dependency-injection/Compiler/AutowirePass.php(80): Symfony\Component\DependencyInjection\Compiler\AutowirePass::getResourceMetadataForMethod(Object(ReflectionMethod))
#2 /.../vendor/symfony/dependency-injection/Compiler/AutowirePass.php(105): Symfony\Component\DependencyInjection\Compiler\AutowirePass::createResourceForClass(Object(ReflectionClass))
#3 /.../vendor/symfony/dependency-injection/Compiler/AutowirePass.php(48): Symfony\Component\DependencyInjection\Compiler\AutowirePass->completeDefinition('__controller.Sw...', Object(Symfony\Component\DependencyInjection\Definition), Array)
#4 /.../vendor/symfony/dependency-injection/Compiler/Compiler in /.../vendor/symfony/dependency-injection/Compiler/AutowirePass.php on line 437
```

**Example:**
```
<?php
class FooVariadic
{
    public function bar(...$arguments)
    {
    }
}

$method = new ReflectionMethod(FooVariadic::class, 'bar');
$parameter = $method->getParameters()[0];
$parameter->getDefaultValue(); // -> ReflectionException: Internal error: Failed to retrieve the default value in ...
```

Commits
-------

a7f63de [DependencyInjection] Fixed variadic method parameter in autowired classes
stof pushed a commit that referenced this pull request Mar 10, 2022
… resource (Seldaek)

This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[Process] Avoid calling fclose on an already closed resource

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

I got this in Composer while interrupting an install process with Ctrl-C.

```
PHP Fatal error:  Uncaught TypeError: fclose(): supplied resource is not a valid stream resource in /var/www/composer/vendor/symfony/process/Pipes/AbstractPipes.php:50
Stack trace:
#0 /var/www/composer/vendor/symfony/process/Pipes/AbstractPipes.php(50): fclose()
#1 /var/www/composer/vendor/symfony/process/Pipes/UnixPipes.php(50): Symfony\Component\Process\Pipes\AbstractPipes->close()
#2 [internal function]: Symfony\Component\Process\Pipes\UnixPipes->__destruct()
#3 {main}
  thrown in /var/www/composer/vendor/symfony/process/Pipes/AbstractPipes.php on line 50
```

I am assuming it's due to a process which was not closed properly, which is very likely given we run a bunch of them concurrently.. It's pretty hard to debug as it's also hard to reproduce, so I am not sure what to do except handle this case gracefully in the close/__destruct function and hope that at least lets it clean up processes without crashing this way.

Commits
-------

a9e43a7 [Process] Avoid calling fclose on an already closed resource
stof pushed a commit that referenced this pull request Oct 27, 2022
Prevents:

> Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

on `getDefaultName()` returning `null`
stof pushed a commit that referenced this pull request Oct 27, 2022
str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
stof pushed a commit that referenced this pull request Oct 27, 2022
…(HypeMC)

This PR was merged into the 5.4 branch.

Discussion
----------

[Console] Fix deprecation when description is null

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Fixes `str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated` when `getDefaultDescription()` returns `null`, caused by symfony#46574.

Commits
-------

7a08b52 [Console] Fix deprecation when description is null
stof pushed a commit that referenced this pull request Oct 27, 2022
Co-authored-by: Jérémy Derussé <jeremy@derusse.com>
stof pushed a commit that referenced this pull request Oct 27, 2022
…r (jderusse, nicolas-grekas)

This PR was merged into the 6.2 branch.

Discussion
----------

[DoctrineBridge] Add an Entity Argument Resolver

| Q             | A
| ------------- | ---
| Branch?       | 6.1
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | part of symfony#40333
| License       | MIT
| Doc PR        | todo

This PR provides an Argument Resolver for Doctrine entities.

This would replace the SensioFramework's DoctrineParamConverter (in fact most of the code is copy/pasted from here) and helps users to disable the paramConverter and fix the related issue.

usage:
```yaml
sensio_framework_extra:
    request:
        converters: false
services:
    Symfony\Bridge\Doctrine\ArgumentResolver\EntityValueResolver: ~
```

```php
#[Route('/blog/{slug}')]
public function show(Post $post)
{
}
```

or with custom options
```php
#[Route('/blog/{id}')]
public function show(
  #[MapEntity(entityManager: 'foo', expr: 'repository.findNotDeletedById(id)')]
  Post $post
)
{
}
```

Commits
-------

5a3df5e Improve EntityValueResolver (#3)
4524083 Add an Entity Argument Resolver
stof pushed a commit that referenced this pull request Feb 21, 2023
…for PHPStan (ogizanagi)

This PR was merged into the 6.2 branch.

Discussion
----------

[Console] Fix `OutputInterface` options int-mask for PHPStan

| Q             | A
| ------------- | ---
| Branch?       | 6.2
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | N/A <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead -->
| License       | MIT
| Doc PR        | N/A

When upgrading an application to 6.2, I encountered this issue with PHPStan:

```shell
 ------ -------------------------------------------------------------------------------------------------------
  Line   Pilot/Runner/Output/MultiplexingOutput.php
 ------ -------------------------------------------------------------------------------------------------------
  79     Default value of the parameter #3 $options (0) of method
         App\Pilot\Runner\Output\MultiplexingOutput::write() is incompatible with type 1|2|4|16|32|64|128|256.
 ------ -------------------------------------------------------------------------------------------------------
```

The `MultiplexingOutput` implements the `OutputInterface` and defined `0` as the default value for `$options`:

```php
    public function write(string|iterable $messages, bool $newline = false, int $options = 0): void
```

as defined by the interface:

https://github.com/symfony/symfony/blob/69f46f231b16be1bce1e2ecfa7f9a1fb192cda22/src/Symfony/Component/Console/Output/OutputInterface.php#L40

When trying to use `self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL` as default value:

```shell
 ------ -------------------------------------------------------------------------------------------------------
  Line   Pilot/Runner/Output/MultiplexingOutput.php
 ------ -------------------------------------------------------------------------------------------------------
  79     Default value of the parameter #3 $options (33) of method
         App\Pilot\Runner\Output\MultiplexingOutput::write() is incompatible with type 1|2|4|16|32|64|128|256.
 ------ -------------------------------------------------------------------------------------------------------
```

Or simply using `Output::write()` with specific options:

```shell
 ------ -------------------------------------------------------------------------------------------------------
  Line   Pilot/Runner/Output/MultiplexingOutput.php
 ------ -------------------------------------------------------------------------------------------------------
  81     Parameter #3 $options of method Symfony\Component\Console\Output\Output::write() expects
         1|2|4|16|32|64|128|256, 33 given.
 ------ -------------------------------------------------------------------------------------------------------
```

Using PHPStan's [`int-mask-of`](https://phpstan.org/writing-php-code/phpdoc-types#integer-masks) is the solution for this, and allows by nature the `0` value.
It was even used [at some point](symfony#47016 (comment)), but reverted to use `self::VERBOSITY_*|self::OUTPUT_*`. However, it does not behave as expected for masks.

So, either we use `int-mask-of`, or we revert to `int`?

Commits
-------

304a17a [Console] Fix OutputInterface options int-mask for PhpStan
stof pushed a commit that referenced this pull request Feb 21, 2023
…(HypeMC)

This PR was merged into the 6.2 branch.

Discussion
----------

[HttpKernel] Fix `CacheAttributeListener` priority

| Q             | A
| ------------- | ---
| Branch?       | 6.2
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Currently the `CacheAttributeListener` & the `IsGrantedAttributeListener` have the same priority:

```
Registered Listeners for "kernel.controller_arguments" Event
============================================================

 ------- --------------------------------------------------------------------------------------------------------- ----------
  Order   Callable                                                                                                  Priority
 ------- --------------------------------------------------------------------------------------------------------- ----------
  #1      Symfony\Component\HttpKernel\EventListener\CacheAttributeListener::onKernelControllerArguments()          10
  #2      Symfony\Component\Security\Http\EventListener\IsGrantedAttributeListener::onKernelControllerArguments()   10
  #3      Symfony\Component\HttpKernel\EventListener\ErrorListener::onControllerArguments()                         0
 ------- --------------------------------------------------------------------------------------------------------- ----------
```

Since the `CacheAttributeListener` is alphabetically first, it's first to get triggered. This can cause an unauthenticated user to receive a 304 Not modified instead of a 302 Redirect, resulting in the user seeing some stale content from when they were authenticated instead of getting redirected to the login page.

This PR changes the priority of the `CacheAttributeListener` to be lower than that of the `IsGrantedAttributeListener`.

Commits
-------

90eb89f [HttpKernel] Fix CacheAttributeListener priority
stof pushed a commit that referenced this pull request Oct 17, 2023
This PR was squashed before being merged into the 1.2-dev branch.

Discussion
----------

Add support for streamed Symfony request

As a continuation of #3 and symfony#50 . Add support for converting a `ServerRequestInterface` with a large body to a Symfony request.

I'm not all too familiar with Symfony components, but I saw that a Symfony request supports `string|resource|null` as its body. Since calling `detach()` on a `StreamInterface` will make the stream unsuable I added a `$streamed` argument to the function in order to not make break any existing code, and to make it a conscious decision of the caller to stream the response.

I'm happy to make any necessary changes if needed.

Commits
-------

df26630 Add support for streamed Symfony request
stof pushed a commit that referenced this pull request Aug 14, 2024
…rsimpsons)

This PR was merged into the 5.4 branch.

Discussion
----------

[Yaml] 🐛 throw ParseException on invalid date

| Q             | A
| ------------- | ---
| Branch?       | 5.4 <!-- see below -->
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Issues        | None <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead -->
| License       | MIT

(found in symfony-tools/docs-builder#179)

When parsing the following yaml:
```
date: 6418-75-51
```

`symfony/yaml` will throw an exception:
```
$ php main.php
PHP Fatal error:  Uncaught Exception: Failed to parse time string (6418-75-51) at position 6 (5): Unexpected character in /tmp/symfony-yaml/vendor/symfony/yaml/Inline.php:714
Stack trace:
#0 /tmp/symfony-yaml/vendor/symfony/yaml/Inline.php(714): DateTimeImmutable->__construct()
#1 /tmp/symfony-yaml/vendor/symfony/yaml/Inline.php(312): Symfony\Component\Yaml\Inline::evaluateScalar()
#2 /tmp/symfony-yaml/vendor/symfony/yaml/Inline.php(80): Symfony\Component\Yaml\Inline::parseScalar()
#3 /tmp/symfony-yaml/vendor/symfony/yaml/Parser.php(790): Symfony\Component\Yaml\Inline::parse()
#4 /tmp/symfony-yaml/vendor/symfony/yaml/Parser.php(341): Symfony\Component\Yaml\Parser->parseValue()
symfony#5 /tmp/symfony-yaml/vendor/symfony/yaml/Parser.php(86): Symfony\Component\Yaml\Parser->doParse()
symfony#6 /tmp/symfony-yaml/vendor/symfony/yaml/Yaml.php(77): Symfony\Component\Yaml\Parser->parse()
symfony#7 /tmp/symfony-yaml/main.php(8): Symfony\Component\Yaml\Yaml::parse()
symfony#8 {main}
  thrown in /tmp/symfony-yaml/vendor/symfony/yaml/Inline.php on line 714
```

This is because the "month" is invalid. Fixing the "month" will trigger about the same issue because the "day" would be invalid.

With the current change it will throw a `ParseException`.

Commits
-------

6d71a7e 🐛 throw ParseException on invalid date
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants