cvs: php-src /ext/pdo pdo_sql_parser.c pdo_sql_parser.re

From: Date: Sun, 03 Dec 2006 23:28:01 +0000
Subject: cvs: php-src /ext/pdo pdo_sql_parser.c pdo_sql_parser.re
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-41854@lists.php.net to get a copy of this message
iliaa Sun Dec 3 23:28:01 2006 UTC Modified files: /php-src/ext/pdo pdo_sql_parser.re pdo_sql_parser.c Log: MFB: Added missing check for mismatching number of tokens & bound params in prepared statement emulation. http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/pdo_sql_parser.re?r1=1.34&r2=1.35&diff_format=u Index: php-src/ext/pdo/pdo_sql_parser.re diff -u php-src/ext/pdo/pdo_sql_parser.re:1.34 php-src/ext/pdo/pdo_sql_parser.re:1.35 --- php-src/ext/pdo/pdo_sql_parser.re:1.34 Thu Nov 23 14:41:51 2006 +++ php-src/ext/pdo/pdo_sql_parser.re Sun Dec 3 23:28:00 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pdo_sql_parser.re,v 1.34 2006/11/23 14:41:51 iliaa Exp $ */ +/* $Id: pdo_sql_parser.re,v 1.35 2006/12/03 23:28:00 iliaa Exp $ */ #include "php.h" #include "php_pdo_driver.h" @@ -132,7 +132,6 @@ goto clean_up; } - if (stmt->supports_placeholders == query_type && !stmt->named_rewrite_template) { /* query matches native syntax */ ret = 0; @@ -156,7 +155,13 @@ ret = -1; goto clean_up; } - + + if (params && bindno != zend_hash_num_elements(params) && stmt->supports_placeholders == PDO_PLACEHOLDER_NONE) { + pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "number of bound variables does not match number of tokens" TSRMLS_CC); + ret = -1; + goto clean_up; + } + /* what are we going to do ? */ if (stmt->supports_placeholders == PDO_PLACEHOLDER_NONE) { http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/pdo_sql_parser.c?r1=1.44&r2=1.45&diff_format=u Index: php-src/ext/pdo/pdo_sql_parser.c diff -u php-src/ext/pdo/pdo_sql_parser.c:1.44 php-src/ext/pdo/pdo_sql_parser.c:1.45 --- php-src/ext/pdo/pdo_sql_parser.c:1.44 Thu Nov 23 14:41:51 2006 +++ php-src/ext/pdo/pdo_sql_parser.c Sun Dec 3 23:28:00 2006 @@ -1,4 +1,4 @@ -/* Generated by re2c 0.10.6 on Thu Nov 23 09:42:00 2006 */ +/* Generated by re2c 0.10.6 on Sun Dec 3 18:28:10 2006 */ #line 1 "ext/pdo/pdo_sql_parser.re" /* +----------------------------------------------------------------------+ @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pdo_sql_parser.c,v 1.44 2006/11/23 14:41:51 iliaa Exp $ */ +/* $Id: pdo_sql_parser.c,v 1.45 2006/12/03 23:28:00 iliaa Exp $ */ #include "php.h" #include "php_pdo_driver.h" @@ -352,7 +352,6 @@ goto clean_up; } - if (stmt->supports_placeholders == query_type && !stmt->named_rewrite_template) { /* query matches native syntax */ ret = 0; @@ -376,7 +375,13 @@ ret = -1; goto clean_up; } - + + if (params && bindno != zend_hash_num_elements(params) && stmt->supports_placeholders == PDO_PLACEHOLDER_NONE) { + pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "number of bound variables does not match number of tokens" TSRMLS_CC); + ret = -1; + goto clean_up; + } + /* what are we going to do ? */ if (stmt->supports_placeholders == PDO_PLACEHOLDER_NONE) {

« previous php.cvs (#41854) next »