Req #68424 [Opn->Fbk]: Add new PDO mysql connection attr to control multi statements option

From: Date: Fri, 05 Dec 2014 16:09:05 +0000
Subject: Req #68424 [Opn->Fbk]: Add new PDO mysql connection attr to control multi statements option
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188937@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68424&edit=1 ID: 68424 Updated by: jpauli@php.net Reported by: peter dot wolanin at acquia dot com Summary: Add new PDO mysql connection attr to control multi statements option -Status: Open +Status: Feedback Type: Feature/Change Request Package: PDO MySQL Operating System: all PHP Version: 5.6.3 Block user comment: N Private report: N New Comment: Please try using this snapshot: http://snaps.php.net/php5.5-latest.tar.gz For Windows: http://windows.php.net/snapshots/ Previous Comments: ------------------------------------------------------------------------ [2014-11-14 15:02:29] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68424&edit=1

« previous php.bugs (#188937) next »