From e9c81e4983d93ab0006c12e256a1f040c6b0e9ae Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 10 Sep 2005 20:58:19 +0000 Subject: [PATCH] actually register PDO_PARAM_BOOL as a constant (doh!). When emulating bound parameters, pass booleans via the driver's quoter method, so that is has an opportunity to tweak it. Refs #33876: PDO misquotes/miscasts bool(false) --- ext/pdo/pdo.c | 1 + ext/pdo/pdo_sql_parser.re | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ext/pdo/pdo.c b/ext/pdo/pdo.c index c12cef1ad6..e5c2796cab 100755 --- a/ext/pdo/pdo.c +++ b/ext/pdo/pdo.c @@ -295,6 +295,7 @@ PHP_MINIT_FUNCTION(pdo) le_ppdo = zend_register_list_destructors_ex(NULL, php_pdo_pdbh_dtor, "PDO persistent database", module_number); + REGISTER_LONG_CONSTANT("PDO_PARAM_BOOL", (long)PDO_PARAM_BOOL, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PDO_PARAM_NULL", (long)PDO_PARAM_NULL, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PDO_PARAM_INT", (long)PDO_PARAM_INT, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PDO_PARAM_STR", (long)PDO_PARAM_STR, CONST_CS|CONST_PERSISTENT); diff --git a/ext/pdo/pdo_sql_parser.re b/ext/pdo/pdo_sql_parser.re index ce982096fb..eeae984573 100644 --- a/ext/pdo/pdo_sql_parser.re +++ b/ext/pdo/pdo_sql_parser.re @@ -210,8 +210,6 @@ PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, plc->freeq = 0; break; - case IS_BOOL: - convert_to_long(param->parameter); case IS_LONG: case IS_DOUBLE: convert_to_string(param->parameter); @@ -220,6 +218,8 @@ PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, plc->freeq = 0; break; + case IS_BOOL: + convert_to_long(param->parameter); default: convert_to_string(param->parameter); if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter), -- 2.40.0