Fix #69592: pdo_dblib now skips datasets without columns while fetching data#1758
Fix #69592: pdo_dblib now skips datasets without columns while fetching data#1758MiRacLe-RPZ wants to merge 3 commits intophp:PHP-5.6from MiRacLe-RPZ:bug-69592
Conversation
Some sql-statements can return empty resultsets, now pdo_dblib skips empty datasets like ext/mssql.
|
I like this change, but there's probably code in the wild that relies on this (admittedly broken) behavior. It would make for smoother PHP upgrades if this was an opt-in behavior, via a driver attribute or whatever. |
|
@adambaratz, several versions ago "code in the wild" cannot be relies on "that", because call of nextResult causes segfault (see PR #1386). This behaviour copied from ext/mssql(dblib). |
|
I haven't dug into the code enough to understand why, but the segfaults weren't a consistent issue. My company has a fair bit of code that expects empty rowsets. Would it be hard to add a boolean attribute to control this? It could be deprecated after a few minor revisions, but it would make it possible to transition out of this behavior instead of causing code to break when you upgrade PHP. |
|
@adambaratz can you show testcase with code that expects empty rowset(s) ? P.S. - a "empty rowset" i mean dataset without columns, not rows... |
|
The gist would be to change your example like this: |
|
@adambaratz ok, i will try to add this functional optional by default, last question (programmer's main problem) - name for this pdo-attribute ? |
|
It seems like the convention for driver-specific attrs is PDO::[DRIVER]ATTR[name]. I think PDO::DBLIB_ATTR_SKIP_EMPTY_ROWSETS would be fine. |
… for skip rowsets without columns
|
Is there a 7.0 compatible patch for this issue? Thanks. |
|
Since this targets a security fix only branch, and since the author seems to have abandoned working on it (or responding to questions/comments), I'm closing this PR. Please take this action as (more) encouragement to open a PR against a supported branch. |
Some sql-statements can return empty resultsets, now pdo_dblib skips empty datasets like ext/mssql.