Backend Development 7 min read

How Saki Fixed a PDO Compatibility Bug in PHP 8.1 and Contributed to the PHP Core

This article recounts how developer Saki discovered a PDO extension incompatibility after PHP 8.1 upgrade, submitted detailed bug reports and pull requests, added unit tests, resolved further SQL Server issues, and ultimately became a PHP core contributor, illustrating the open‑source contribution process.

IT Services Circle
IT Services Circle
IT Services Circle
How Saki Fixed a PDO Compatibility Bug in PHP 8.1 and Contributed to the PHP Core

Saki, a PHP and C developer at BASE Inc., is introduced as a maintainer of the PDO and BCMath extensions and a release manager for PHP 8.4. The article highlights the community’s focus on her photo rather than her technical contributions.

On July 4, 2023, Saki reported an issue to php/php-src indicating that after upgrading to PHP 8.1 the PDO extension behaved incompatibly with previous versions. The bug manifested when querying a MySQL table containing float , double , and decimal columns.

CREATE TABLE test (
    float_col float(3,2),
    double_col double(3,2),
    decimal_col decimal(3,2)
);
INSERT INTO test (float_col, double_col, decimal_col) VALUES (2.60, 3.60, 4.60);

Using PDO with emulated prepares and stringified fetches produced different results in PHP 8.0 and PHP 8.1:

$pdo = new PDO("mysql:host=mysql;dbname=test", "root", "");
$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
$pdo->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
$results = $pdo->query("SELECT * from test");
foreach ($results as $result) {
    var_dump($result);
}

The PHP 8.1 compatibility documentation states that integers and floats are now returned as native types when using emulated prepared statements, and the previous behavior can be restored by enabling PDO::ATTR_STRINGIFY_FETCHES . However, even with both attributes set to true , PHP 8.1 still omitted trailing zeros, showing a regression.

Saki filed a detailed PR on July 7, 2023, adding a fix and unit tests after a reviewer (youkidearitai) suggested testing. The PR was positively received, and after a brief review cycle the changes were merged into PHP 8.1.22 and 8.2.9 on July 17.

Subsequently, developers reported a new exception when using the Microsoft SQL Server PDO driver with the updated PHP versions. Saki identified that the driver’s PDO::setAttribute() now threw an exception instead of returning false . She submitted another PR to the Microsoft GitHub repository, fixing the driver behavior and noting that only the Microsoft driver deviated from the documented contract.

These contributions earned Saki a promotion to PHP core developer in early 2024, where she now focuses on improving the performance of the BCMath extension.

The article concludes with a brief author bio and several unrelated promotional links.

BackendDatabaseopen-sourcePHPBug FixPDOphp8.1
IT Services Circle
Written by

IT Services Circle

Delivering cutting-edge internet insights and practical learning resources. We're a passionate and principled IT media platform.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.