Skip to content

Commit b8bc8de

Browse files
committed
Add untested, unexposed PARAM_BINARY
1 parent c2dd272 commit b8bc8de

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

ext/pdo/pdo_dbh.stub.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ class PDO
3535
* @cvalue LONG_CONST(PDO_PARAM_STMT)
3636
*/
3737
public const PARAM_STMT = 4;
38+
/**
39+
* @var int
40+
* @cvalue LONG_CONST(PDO_PARAM_BINARY)
41+
*/
42+
public const PARAM_BINARY = 6;
3843
/**
3944
* @var int
4045
* @cvalue LONG_CONST(PDO_PARAM_INPUT_OUTPUT)

ext/pdo/pdo_dbh_arginfo.h

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/pdo/pdo_stmt.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ static bool really_register_bound_param(struct pdo_bound_param_data *param, pdo_
274274
parameter = Z_REFVAL(param->parameter);
275275
}
276276

277-
if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_STR && param->max_value_len <= 0 && !Z_ISNULL_P(parameter)) {
277+
if ((PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_STR || PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_BINARY) && param->max_value_len <= 0 && !Z_ISNULL_P(parameter)) {
278278
if (!try_convert_to_string(parameter)) {
279279
return 0;
280280
}
@@ -522,6 +522,7 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, enum pdo
522522
convert_to_boolean(dest);
523523
break;
524524
case PDO_PARAM_STR:
525+
case PDO_PARAM_BINARY:
525526
if (Z_TYPE_P(dest) == IS_FALSE) {
526527
/* Return "0" rather than "", because this is what database drivers that
527528
* don't have a dedicated boolean type would return. */

ext/pdo/php_pdo_driver.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ enum pdo_param_type {
4646
/* get_col: Not supported (yet?) */
4747
PDO_PARAM_STMT = 4, /* hierarchical result set */
4848

49+
PDO_PARAM_BINARY = 6,
50+
4951
/* magic flag to denote a parameter as being input/output */
5052
PDO_PARAM_INPUT_OUTPUT = 0x80000000,
5153

0 commit comments

Comments
 (0)