Skip to content

[Serializer] v6.4.23 AbstractObjectNormalizer::getAllowedAttribute signature change #61035

@Prometee

Description

@Prometee

Symfony version(s) affected

6.4.23

Description

Using Symfony 6.4.22 this method:
https://github.com/symfony/symfony/blob/v6.4.22/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php#L223
has been now moved to the class AbstractObjectNormalizer in Symfony 6.4.23. Which lead to this kind of error if you extends this class.

~/Documents/Projects/git/Flux.shop git:[master]
composer update symfony/serializer --no-cache
Loading composer repositories with package information                                                                                                                           Restricting packages listed in "symfony/symfony" to "^6.4"
Updating dependencies
Lock file operations: 0 installs, 1 update, 0 removals
  - Upgrading symfony/serializer (v6.4.22 => v6.4.23)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
  - Downloading symfony/serializer (v6.4.23)
  - Upgrading symfony/serializer (v6.4.22 => v6.4.23): Extracting archive
Package behat/transliterator is abandoned, you should avoid using it. No replacement was suggested.
Package php-http/message-factory is abandoned, you should avoid using it. Use psr/http-factory instead.
Generating autoload files
165 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
phpstan/extension-installer: Extensions installed

What about running composer global require symfony/thanks && composer thanks now?
This will spread some 💖  by sending a ★  to the GitHub repositories of your fellow package maintainers.

Run composer recipes at any time to see the status of your Symfony recipes.

Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 255
!!  PHP Fatal error:  Declaration of ApiPlatform\Serializer\AbstractItemNormalizer::getAllowedAttributes($classOrObject, array $context, $attributesAsString = false) must be compatible with Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer::getAllowedAttributes(object|string $classOrObject, array $context, bool $attributesAsString = false): array|bool in vendor/api-platform/core/src/Serializer/AbstractItemNormalizer.php on line 493
!!  
!!  Fatal error: Declaration of ApiPlatform\Serializer\AbstractItemNormalizer::getAllowedAttributes($classOrObject, array $context, $attributesAsString = false) must be compatible with Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer::getAllowedAttributes(object|string $classOrObject, array $context, bool $attributesAsString = false): array|bool in vendor/api-platform/core/src/Serializer/AbstractItemNormalizer.php on line 493
!!  Symfony\Component\ErrorHandler\Error\FatalError {#59432
!!    #message: "Compile Error: Declaration of ApiPlatform\Serializer\AbstractItemNormalizer::getAllowedAttributes($classOrObject, array $context, $attributesAsString = false) must be compatible with Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer::getAllowedAttributes(object|string $classOrObject, array $context, bool $attributesAsString = false): array|bool"
!!    #code: 0
!!    #file: "./vendor/api-platform/core/src/Serializer/AbstractItemNormalizer.php"
!!    #line: 493
!!    -error: array:4 [
!!      "type" => 64
!!      "message" => "Declaration of ApiPlatform\Serializer\AbstractItemNormalizer::getAllowedAttributes($classOrObject, array $context, $attributesAsString = false) must be compatible with Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer::getAllowedAttributes(object|string $classOrObject, array $context, bool $attributesAsString = false): array|bool"
!!      "file" => "vendor/api-platform/core/src/Serializer/AbstractItemNormalizer.php"
!!      "line" => 493
!!    ]
!!  }
!!  
Script @auto-scripts was called via post-update-cmd

How to reproduce

Install both APIP 2.7 and Symfony 6.4 last versions.
Clear the cache and you can get the same error.

Possible Solution

Revert the signature of AbstractObjectNormalizer::getAllowedAttribute to what it was in the previous minor Symfony version.

Additional Context

Related issues:
Sylius/Sylius-Standard#1150
api-platform/core#7257

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy