ZF-12316: Zend_Db_Statement::_stripQuoted() will cause "Segmentation fault" when one sql field length exceed 10000


The sql bellow will cause php "Segmentation fault", my php version is 5.3.2, and ZF version is 1.11.11

<?php require_once 'Zend/Db.php'; require_once 'Zend/Db/Statement/Pdo.php'; $dbAdapter = Zend_Db::factory('Pdo_Mysql', array( 'host' => '', 'username' => 'root', 'password' => '123456', 'dbname' => 'test' )); $text = str_pad('a', 10000, 'a'); $sql = "INSERT INTO faketable(fake_id, fake_field) VALUES(1, '$text')"; $stmt = new Zend_Db_Statement_Pdo($dbAdapter, $sql); ?>

Zend_Db_Statement::_stripQuoted() use preg_replace, and the regex cause this, but i don't know how to fix this.

<?php //... // get a version of the SQL statement with all quoted // values and delimited identifiers stripped out // remove "foo\"bar" $sql = preg_replace("/$q($qe|\\\\{2}|[^$q])*$q/", '', $sql); // remove 'foo\'bar' if (!empty($q)) { $sql = preg_replace("/$q($qe|[^$q])*$q/", '', $sql); } //.... ?>


i found this when i user $db->query() to insert multi rows one time.

$sql = 'INSERT INTO table(field_1, field_2) VALUES (val1, val2), (val3, val4), (val5, val6)'; $db->query($sql);