Account for `\ErrorException` from `unserialize()` when Symfony’s PHP error conversion is enabled
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 45/100
Línea de trabajo
The payload names no files, so start by locating where phpstan-symfony reads the framework configuration and where it could add throw types for functions. Reproduce with a small Symfony config that sets php_errors.log, then check whether PHPStan flags the catch (\ErrorException) around unserialize() as unreachable. Done when that catch is no longer reported and a test covers the enabled and disabled configurations.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Hey there 👋
Disclaimer: the text below is generated with LLM, but I checked it 🤞
When Symfony is configured to convert PHP errors into exceptions (framework.php_errors.log: true), malformed input to unserialize() can throw \ErrorException.
PHP emits an E_NOTICE for malformed serialized input before PHP 8.3 and an E_WARNING from PHP 8.3 onward. Symfony’s error handler converts that diagnostic into \ErrorException when the corresponding error level is enabled for throwing and included in error_reporting().
For example:
try {
$value = unserialize($data, ['allowed_classes' => false]);
} catch (\ErrorException $exception) {
// Handle malformed serialized data.
}
PHPStan’s built-in exception model does not account for this conversion and can report the catch as unreachable, although it is reachable with Symfony’s throwing error handler active.
Could phpstan-symfony account for this behavior when the Symfony configuration enables PHP error conversion, including the configured throwing levels?
Expected behavior:
- Recognize that
unserialize()may throw\ErrorExceptionwhen the relevant diagnostic is converted into an exception.
References:
- Lenguaje dominante
- PHP
- Estrellas
- 805
- Forks
- 104
- Merge medio
- 27 min
- PR fusionados (30 d)
- 3
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de phpstan/phpstan-symfony
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
phpstan/phpstan-symfony#510 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
phpstan/phpstan-symfony#494 · 5 comentarios ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
phpstan/phpstan-symfony#268 ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
phpstan/phpstan-symfony#509 · 2 comentarios ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 48/100
phpstan/phpstan-symfony#466 · 4 comentarios ·
Todos los issues de phpstan/phpstan-symfony
Issues similares
-
domain/discovery
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Admin search throws for permissions added through Admin.generalIndexItems('permissions', ...)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
neos/flow-development-collection#3639 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
The PHP version check in prepare.php still allows PHP 7.2 and 7.3Posiblemente ocupada @ekamran la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
WordPress/phpunit-test-runner#359 ·
Los mantenedores suelen responder en 2 días
-
[ObjectMapper] Merge the objects that repeated `#[Map]` attributes map …Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. AbiertoObjectMapper
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
symfony/symfony-docs#23390 ·
Los mantenedores suelen responder en 2 días