summaryrefslogtreecommitdiff
path: root/ext/pdo_odbc/odbc_driver.c
diff options
context:
space:
mode:
authorGeorge Peter Banyard <girgias@php.net>2021-03-15 16:26:04 +0000
committerGeorge Peter Banyard <girgias@php.net>2021-03-17 00:58:01 +0000
commitebaeb93c3f9f23aa9b2e5ccc1f8bf17ec3700bf2 (patch)
treeb719eb118b40cb31fb2abc543c2e55afea3d9ca1 /ext/pdo_odbc/odbc_driver.c
parentc465462e912eae73d1e0407f2d2cb815f40f1c13 (diff)
downloadphp-git-ebaeb93c3f9f23aa9b2e5ccc1f8bf17ec3700bf2.tar.gz
Add API to fetch bool value for PDO attribute values
Closes GH-6766
Diffstat (limited to 'ext/pdo_odbc/odbc_driver.c')
-rw-r--r--ext/pdo_odbc/odbc_driver.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c
index 719aa36219..790ee87851 100644
--- a/ext/pdo_odbc/odbc_driver.c
+++ b/ext/pdo_odbc/odbc_driver.c
@@ -333,9 +333,14 @@ static bool odbc_handle_rollback(pdo_dbh_t *dbh)
static bool odbc_handle_set_attr(pdo_dbh_t *dbh, zend_long attr, zval *val)
{
pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data;
+ bool bval;
+
switch (attr) {
case PDO_ODBC_ATTR_ASSUME_UTF8:
- H->assume_utf8 = zval_is_true(val);
+ if (!pdo_get_bool_param(&bval, val)) {
+ return false;
+ }
+ H->assume_utf8 = bval;
return true;
default:
strcpy(H->einfo.last_err_msg, "Unknown Attribute");