[php-src] Issue #25299: PDOException with SQLSTATE string loses code after serialization round-trip on PHP 8.5.12

From: Date: Sat, 07 Nov 2026 23:39:07 +0000
Subject: [php-src] Issue #25299: PDOException with SQLSTATE string loses code after serialization round-trip on PHP 8.5.12
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-254062@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/25299 Author: tacman PHP 8.5.12 CLI NTS, Homebrew macOS. Minimal reproduction, no framework: try { $pdo = new PDO('sqlite::memory:'); $pdo->query('select * from missing'); } catch (PDOException $e) { $copy = unserialize(serialize($e)); var_dump($e->getCode(), $copy->getCode()); } Actual: Warning: Undefined property: PDOException::$code string(5) "HY000" NULL Expected: both codes remain "HY000" without warnings. A manually constructed PDOException with an integer code round-trips correctly. This affects actual driver errors with SQLSTATE strings. Impact: Symfony 8.2 parallel Messenger sends exceptions between processes. A PostgreSQL unique-constraint error in our application triggered this defect; ErrorHandler's FlattenException::setCode(string|int) then received null and stopped the worker. The standalone SQLite reproduction demonstrates that the serialization defect is independent of Symfony and PostgreSQL.

« previous php.bugs (#254062) next »