Account for `\ErrorException` from `unserialize()` when Symfony’s PHP error conversion is enabled
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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:
- Lingua principale
- PHP
- Stelle
- 806
- Fork
- 104
- Merge medio
- 27m
- PR unite (30g)
- 3
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di phpstan/phpstan-symfony
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
phpstan/phpstan-symfony#510 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
phpstan/phpstan-symfony#494 · 5 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
phpstan/phpstan-symfony#268 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
phpstan/phpstan-symfony#509 · 2 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 48/100
phpstan/phpstan-symfony#466 · 4 commenti ·
Tutte le issue di phpstan/phpstan-symfony
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
verbb/formie#3022 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Automattic/blocks-engine#3090 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
-
macOS
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
beyondcode/herd-community#1771 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100