php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #68424 Add new PDO mysql connection attr to control multi statements option
Submitted: 2014-11-14 15:02 UTC Modified: 2014-12-30 10:42 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: peter dot wolanin at acquia dot com Assigned:
Status: No Feedback Package: PDO MySQL
PHP Version: 5.6.3 OS: all
Private report: No CVE-ID:
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
3 + 38 = ?
Subscribe to this entry?

 
 [2014-11-14 15:02 UTC] peter dot wolanin at acquia dot com
Description:
------------

Proposed fix:  https://github.com/php/php-src/pull/896


mysqli does not set the CLIENT_MULTI_STATEMENTS flag on connect, so a query with multiple statements fails.

For PDO mysql, it hard-codes the CLIENT_MULTI_STATEMENTS flag in the connection, so there is no way to disable it. However, if using native prepares, sending multiple statements fails on the server. This is inconsistent.

This PR adds a new MySQL-specific attribute that can be only set at connection time to explicitly enable or disable multi statements. As written, it leaves the default the same as current master (enabled).

While this PR is against master, I think this change falls somewhere between a feature and a bugfix and should be back-ported to all supported versions.

The motivation for this is the severity of the recent SQL injection vulnerability in Drupal. If we had any way to disable multi statement in PDO (which is used in Drupal 7.x but not 6.x), we would have, and the vulnerability would have been significantly mitigated. see: https://www.drupal.org/SA-CORE-2014-005

Test script:
---------------
https://github.com/php/php-src/pull/896 includes added test.

Expected result:
----------------
It should be possible to limit PDO MySQL to single statement execution so it behaves like mysqli

Actual result:
--------------
multi-statement option is hard-coded into the connection logic

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-12-05 16:09 UTC] jpauli@php.net
-Status: Open +Status: Feedback
 [2014-12-05 16:09 UTC] jpauli@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.5-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2014-12-30 10:42 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Thu Mar 23 20:01:40 2017 UTC