Skip to content

Commit 9718e59

Browse files
committed
Merge branch 'PHP-8.0'
* PHP-8.0: PDO MySQL: Handle boolean parameter binding with libmysql
2 parents 4ceea86 + 51f57e7 commit 9718e59

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

ext/pdo_mysql/mysql_statement.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,10 @@ static const char * const pdo_param_event_names[] =
368368
"PDO_PARAM_EVT_NORMALIZE",
369369
};
370370

371+
#ifndef PDO_USE_MYSQLND
372+
static unsigned char libmysql_false_buffer = 0;
373+
static unsigned char libmysql_true_buffer = 1;
374+
#endif
371375

372376
static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *param, enum pdo_param_event event_type) /* {{{ */
373377
{
@@ -504,6 +508,16 @@ static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da
504508
*b->length = Z_STRLEN_P(parameter);
505509
PDO_DBG_RETURN(1);
506510

511+
case IS_FALSE:
512+
b->buffer_type = MYSQL_TYPE_TINY;
513+
b->buffer = &libmysql_false_buffer;
514+
PDO_DBG_RETURN(1);
515+
516+
case IS_TRUE:
517+
b->buffer_type = MYSQL_TYPE_TINY;
518+
b->buffer = &libmysql_true_buffer;
519+
PDO_DBG_RETURN(1);
520+
507521
case IS_LONG:
508522
b->buffer_type = MYSQL_TYPE_LONG;
509523
b->buffer = &Z_LVAL_P(parameter);

0 commit comments

Comments
 (0)