Page MenuHomeFreeBSD

Fix PDO Bug in PHP 8

Authored by tz on May 5 2021, 8:40 AM.



There was a serious bug introduced in PHP 8.0.5:

The test script below fails because the pgsql driver seems to treat everything as PARAM_STR, despite being explicitly requested to bind the value as PARAM_INT; the "?" placeholder is therefore replaced with the string '4326' instead of the integer 4326.

The problem is, in PostGIS, the ST_Transform() function has different signatures with different behaviours depending on whether the second parameter is an integer or a string.

As far as I can see, because of this issue, there is no way to pass an actual integer to a function without using explicit, PostgreSQL-specific CAST syntax.

Diff Detail

R11 FreeBSD ports repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

tz requested review of this revision.May 5 2021, 8:40 AM
tz created this revision.

Updating diff with patches for php 7.4.

I tested this on a server where I'm experiencing the issue.

Took the freedom to update the patch with a fix for 7.4 too.

As reviewer I approve this.

This revision is now accepted and ready to land.May 5 2021, 10:45 AM