From 49493a2dcfb2cd1758b69b13d9006ead3be0e066 Mon Sep 17 00:00:00 2001 From: Lior Kaplan Date: Fri, 1 Jan 2016 19:19:27 +0200 Subject: Happy new year (Update copyright to 2016) --- ext/pdo_mysql/mysql_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/pdo_mysql/mysql_driver.c') diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index 7297c896bd..003a0c33be 100644 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2015 The PHP Group | + | Copyright (c) 1997-2016 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | -- cgit v1.2.1 From 36b4311edd3e2dec31de1582c207e83b09d6f42b Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Mon, 4 Jan 2016 05:38:15 -0800 Subject: Do not edit the value in place (might be relates to #71261) --- ext/pdo_mysql/mysql_driver.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'ext/pdo_mysql/mysql_driver.c') diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index 5b28cf73ce..f09bc05314 100644 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -368,43 +368,40 @@ static inline int mysql_handle_autocommit(pdo_dbh_t *dbh) /* {{{ pdo_mysql_set_attribute */ static int pdo_mysql_set_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val) { + zend_long lval = zval_get_long(val); + zend_bool bval = lval? 1 : 0; PDO_DBG_ENTER("pdo_mysql_set_attribute"); PDO_DBG_INF_FMT("dbh=%p", dbh); PDO_DBG_INF_FMT("attr=%l", attr); switch (attr) { case PDO_ATTR_AUTOCOMMIT: - convert_to_boolean(val); /* ignore if the new value equals the old one */ - if (dbh->auto_commit ^ (Z_TYPE_P(val) == IS_TRUE)) { - dbh->auto_commit = (Z_TYPE_P(val) == IS_TRUE); + if (dbh->auto_commit ^ bval) { + dbh->auto_commit = bval; mysql_handle_autocommit(dbh); } PDO_DBG_RETURN(1); case PDO_MYSQL_ATTR_USE_BUFFERED_QUERY: - convert_to_boolean(val); /* ignore if the new value equals the old one */ - ((pdo_mysql_db_handle *)dbh->driver_data)->buffered = (Z_TYPE_P(val) == IS_TRUE); + ((pdo_mysql_db_handle *)dbh->driver_data)->buffered = bval; PDO_DBG_RETURN(1); case PDO_MYSQL_ATTR_DIRECT_QUERY: case PDO_ATTR_EMULATE_PREPARES: - convert_to_boolean(val); /* ignore if the new value equals the old one */ - ((pdo_mysql_db_handle *)dbh->driver_data)->emulate_prepare = (Z_TYPE_P(val) == IS_TRUE); + ((pdo_mysql_db_handle *)dbh->driver_data)->emulate_prepare = bval; PDO_DBG_RETURN(1); case PDO_ATTR_FETCH_TABLE_NAMES: - convert_to_boolean(val); - ((pdo_mysql_db_handle *)dbh->driver_data)->fetch_table_names = (Z_TYPE_P(val) == IS_TRUE); + ((pdo_mysql_db_handle *)dbh->driver_data)->fetch_table_names = bval; PDO_DBG_RETURN(1); #ifndef PDO_USE_MYSQLND case PDO_MYSQL_ATTR_MAX_BUFFER_SIZE: - convert_to_long(val); - if (Z_LVAL_P(val) < 0) { + if (lval < 0) { /* TODO: Johannes, can we throw a warning here? */ ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size = 1024*1024; PDO_DBG_INF_FMT("Adjusting invalid buffer size to =%l", ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size); } else { - ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size = Z_LVAL_P(val); + ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size = lval; } PDO_DBG_RETURN(1); break; -- cgit v1.2.1 From 93dc91b386b53bdd317ea6abd70640e2bbfbaf73 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 30 Jan 2016 14:56:17 +0100 Subject: Remove version checks PHP_VERSION_ID PHP_API_VERSION ZEND_MODULE_API_NO PHP_MAJOR_VERSION, PHP_MINOR_VERSION ZEND_ENGINE_2 I've left litespeed alone, as it seems to genuinely maintain support for many PHP versions. --- ext/pdo_mysql/mysql_driver.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'ext/pdo_mysql/mysql_driver.c') diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index f09bc05314..1b1d1abbea 100644 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -630,12 +630,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options) } #ifndef PDO_USE_MYSQLND -#if PHP_API_VERSION < 20100412 - if ((PG(open_basedir) && PG(open_basedir)[0] != '\0') || PG(safe_mode)) -#else - if (PG(open_basedir) && PG(open_basedir)[0] != '\0') -#endif - { + if (PG(open_basedir) && PG(open_basedir)[0] != '\0') { local_infile = 0; } #endif -- cgit v1.2.1