Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Account for `\ErrorException` from `unserialize()` when Symfony’s PHP error conversion is enabled

Aperta
#514 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
php
Ambito
devtools

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 \ErrorException when 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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di phpstan/phpstan-symfony

Tutte le issue di phpstan/phpstan-symfony

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.