Tobion
Repos
28
Followers
374
Following
2

A generic library to retry an operation in case of an error. You can configure the behavior like the exceptions to retry on.

15
0

Loads routes in Symfony based on OpenAPI/Swagger annotations

36
3

The Symfony PHP framework

28144
8788

PSR-7 HTTP message library

7668
260

A vocabulary in the semantic web for describing sports competitions and the results.

7
7

A three-dimensional implementation of Abalone, a strategy board game.

C
1
1

Events

Create README.md

Created at 4 days ago
issue comment
[Form] deprecate translation_parameters options given TranslatableMessage

no

Created at 3 weeks ago
opened issue
Serializer/PropertyInfo treats list<Type> as Type[] and does not enforce sequential indexes

Symfony version(s) affected

6.2.3

Description

list<Type> annotation in phpstan and psalm are

Lists are arrays with sequential integer keys starting at 0.

But when annotating an array like this, the deserializer (and I fear also the propertyinfo component) does not distinguish between a list and a generic array (Type[] / array<Type>). It enforces in both cases that the array indexes are integers. But it does not check that the result is an array_is_list in the list case.

So this means that you can actually deserialize a json object with integer keys instead of an actual json array and you will get a deserialized object where the array indexes are not sequential starting at 0.

How to reproduce

  • Annotate an array with list<string>
  • Try to deserialze a json object with with non-sequential integer keys json_encode([5 => 'foo', 1 => 'bar']) which should fail

Possible Solution

  • Better solution: Validate the incoming array with array_is_list so it's not allowed to deserialize a json object into an list
  • Worse solution: use array_values at the end to ensure the resulting array is valid according to the annotated type

Additional Context

No response

Created at 2 months ago
delete branch
Tobion delete branch fix-int-overflow
Created at 2 months ago
pull request opened
Limit page size to prevent integer overflow

The $param is typed int. So if the routing param does not fit into an int, PHP will throw a TypeError. This in turn would trigger an 500 internal server error. So by requesting a too big page, e.g. /de/blog/page/147483647147483647147483647, one can trigger internal errors which should not be possible.

I don't think there is an easy solution to this general problem that Symfony could automatically provide. So the best solution seems to be to limit the size of the routing placeholder. With this limit the page will always fit into an int even on a 32-bit platform.

Created at 2 months ago
create branch
Tobion create branch fix-int-overflow
Created at 2 months ago
Created at 2 months ago