diff options
Diffstat (limited to 'ext/pdo_mysql')
-rwxr-xr-x | ext/pdo_mysql/config.m4 | 4 | ||||
-rwxr-xr-x | ext/pdo_mysql/mysql_driver.c | 4 | ||||
-rwxr-xr-x | ext/pdo_mysql/mysql_statement.c | 14 | ||||
-rwxr-xr-x | ext/pdo_mysql/pdo_mysql.c | 18 | ||||
-rwxr-xr-x | ext/pdo_mysql/php_pdo_mysql_int.h | 2 | ||||
-rw-r--r-- | ext/pdo_mysql/tests/bug_51670.phpt | 24 | ||||
-rw-r--r-- | ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt | 2 | ||||
-rw-r--r-- | ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt | 2 |
8 files changed, 42 insertions, 28 deletions
diff --git a/ext/pdo_mysql/config.m4 b/ext/pdo_mysql/config.m4 index 0b0de12bd..2eb2f8262 100755 --- a/ext/pdo_mysql/config.m4 +++ b/ext/pdo_mysql/config.m4 @@ -1,9 +1,9 @@ -dnl $Id: config.m4 291501 2009-11-30 15:11:29Z jani $ +dnl $Id: config.m4 297583 2010-04-06 13:42:21Z tony2001 $ dnl config.m4 for extension pdo_mysql dnl vim: se ts=2 sw=2 et: PHP_ARG_WITH(pdo-mysql, for MySQL support for PDO, -[ --with-pdo-mysql[=DIR] PDO: MySQL support. DIR is the MySQL base directoy +[ --with-pdo-mysql[=DIR] PDO: MySQL support. DIR is the MySQL base directory If mysqlnd is passed as DIR, the MySQL native native driver will be used [/usr/local]]) diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index 37a67e56e..07b7f920e 100755 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mysql_driver.c 294543 2010-02-04 20:28:55Z johannes $ */ +/* $Id: mysql_driver.c 298626 2010-04-26 23:55:03Z kalle $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -649,7 +649,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ goto cleanup; } -#if PHP_MAJOR_VERSION < 6 +#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') diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c index 074e9fbb2..f4a501f80 100755 --- a/ext/pdo_mysql/mysql_statement.c +++ b/ext/pdo_mysql/mysql_statement.c @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mysql_statement.c 294543 2010-02-04 20:28:55Z johannes $ */ +/* $Id: mysql_statement.c 299574 2010-05-21 11:09:28Z andrey $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -111,7 +111,7 @@ static int pdo_mysql_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ #endif /* HAVE_MYSQL_NEXT_RESULT || PDO_USE_MYSQLND */ #if PDO_USE_MYSQLND if (!S->stmt && S->current_data) { - free(S->current_data); + mnd_free(S->current_data); } #endif /* PDO_USE_MYSQLND */ @@ -264,7 +264,7 @@ static int pdo_mysql_stmt_execute_prepared_mysqlnd(pdo_stmt_t *stmt TSRMLS_DC) / } /* for SHOW/DESCRIBE and others the column/field count is not available before execute */ - stmt->column_count = S->stmt->field_count; + stmt->column_count = mysql_stmt_field_count(S->stmt); for (i = 0; i < stmt->column_count; i++) { mysqlnd_stmt_bind_one_result(S->stmt, i); } @@ -376,7 +376,7 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ /* for SHOW/DESCRIBE and others the column/field count is not available before execute */ int i; - stmt->column_count = S->stmt->field_count; + stmt->column_count = mysql_stmt_field_count(S->stmt); for (i = 0; i < stmt->column_count; i++) { mysqlnd_stmt_bind_one_result(S->stmt, i); } @@ -652,7 +652,7 @@ static int pdo_mysql_stmt_fetch(pdo_stmt_t *stmt, } #if PDO_USE_MYSQLND if (!S->stmt && S->current_data) { - free(S->current_data); + mnd_free(S->current_data); } #endif /* PDO_USE_MYSQLND */ @@ -745,8 +745,8 @@ static int pdo_mysql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsig } #if PDO_USE_MYSQLND if (S->stmt) { - Z_ADDREF_P(S->stmt->result_bind[colno].zv); - *ptr = (char*)&S->stmt->result_bind[colno].zv; + Z_ADDREF_P(S->stmt->data->result_bind[colno].zv); + *ptr = (char*)&S->stmt->data->result_bind[colno].zv; *len = sizeof(zval); PDO_DBG_RETURN(1); } diff --git a/ext/pdo_mysql/pdo_mysql.c b/ext/pdo_mysql/pdo_mysql.c index 158c033b0..ec3e0441b 100755 --- a/ext/pdo_mysql/pdo_mysql.c +++ b/ext/pdo_mysql/pdo_mysql.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pdo_mysql.c 294514 2010-02-04 09:37:38Z pajoye $ */ +/* $Id: pdo_mysql.c 294274 2010-01-31 19:18:56Z iliaa $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -115,12 +115,11 @@ static PHP_MINFO_FUNCTION(pdo_mysql) /* }}} */ -#if PDO_USE_MYSQLND +#if PDO_USE_MYSQLND && PDO_DBG_ENABLED /* {{{ PHP_RINIT_FUNCTION */ static PHP_RINIT_FUNCTION(pdo_mysql) { -#if PDO_DBG_ENABLED if (PDO_MYSQL_G(debug)) { MYSQLND_DEBUG *dbg = mysqlnd_debug_init(mysqlnd_debug_std_no_trace_funcs TSRMLS_CC); if (!dbg) { @@ -129,18 +128,15 @@ static PHP_RINIT_FUNCTION(pdo_mysql) dbg->m->set_mode(dbg, PDO_MYSQL_G(debug)); PDO_MYSQL_G(dbg) = dbg; } -#endif return SUCCESS; } /* }}} */ - /* {{{ PHP_RSHUTDOWN_FUNCTION */ static PHP_RSHUTDOWN_FUNCTION(pdo_mysql) { -#if PDO_DBG_ENABLED MYSQLND_DEBUG *dbg = PDO_MYSQL_G(dbg); PDO_DBG_ENTER("RSHUTDOWN"); if (dbg) { @@ -148,11 +144,11 @@ static PHP_RSHUTDOWN_FUNCTION(pdo_mysql) dbg->m->free_handle(dbg); PDO_MYSQL_G(dbg) = NULL; } -#endif + return SUCCESS; } /* }}} */ - +#endif /* {{{ PHP_GINIT_FUNCTION */ @@ -167,8 +163,6 @@ static PHP_GINIT_FUNCTION(pdo_mysql) #endif } /* }}} */ -#endif - /* {{{ pdo_mysql_functions[] */ const zend_function_entry pdo_mysql_functions[] = { @@ -205,15 +199,11 @@ zend_module_entry pdo_mysql_module_entry = { #endif PHP_MINFO(pdo_mysql), "1.0.2", -#if PDO_USE_MYSQLND PHP_MODULE_GLOBALS(pdo_mysql), PHP_GINIT(pdo_mysql), NULL, NULL, STANDARD_MODULE_PROPERTIES_EX -#else - STANDARD_MODULE_PROPERTIES -#endif }; /* }}} */ diff --git a/ext/pdo_mysql/php_pdo_mysql_int.h b/ext/pdo_mysql/php_pdo_mysql_int.h index 51e5e5591..d9728b01a 100755 --- a/ext/pdo_mysql/php_pdo_mysql_int.h +++ b/ext/pdo_mysql/php_pdo_mysql_int.h @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_pdo_mysql_int.h 294514 2010-02-04 09:37:38Z pajoye $ */ +/* $Id: php_pdo_mysql_int.h 294278 2010-01-31 20:00:36Z gwynne $ */ #ifndef PHP_PDO_MYSQL_INT_H #define PHP_PDO_MYSQL_INT_H diff --git a/ext/pdo_mysql/tests/bug_51670.phpt b/ext/pdo_mysql/tests/bug_51670.phpt new file mode 100644 index 000000000..d5387e6c6 --- /dev/null +++ b/ext/pdo_mysql/tests/bug_51670.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #51670 (getColumnMeta causes segfault when re-executing query after calling nextRowset) +--SKIPIF-- +<?php +if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded'); +require dirname(__FILE__) . '/config.inc'; +require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +PDOTest::skip(); +?> +--FILE-- +<?php +require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +$query = $db->prepare('SELECT 1 AS num'); +$query->execute(); +if(!is_array($query->getColumnMeta(0))) die('FAIL!'); +$query->nextRowset(); +$query->execute(); +if(!is_array($query->getColumnMeta(0))) die('FAIL!'); +echo 'done!'; +?> +--EXPECTF-- +done! + diff --git a/ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt b/ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt index c0df4a512..ea25cdc32 100644 --- a/ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt @@ -178,5 +178,5 @@ Warning: PDO::getAttribute(): SQLSTATE[IM001]: Driver does not support this func [021] Execting '1'/boolean got ''/boolean' for options 'PDO::MYSQL_ATTR_LOCAL_INFILE' [023] Execting 'SET @a=1'/string got ''/boolean' for options 'PDO::MYSQL_ATTR_INIT_COMMAND' [024] SQLSTATE[42000] [1065] Query was empty -[025] SQLSTATE[42S02] [1146] Table 'test.nonexistent' doesn't exist +[025] SQLSTATE[42S02] [1146] Table '%s.nonexistent' doesn't exist done! diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt index 9c54dc2f6..18ef17b7c 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt @@ -142,8 +142,8 @@ object(myclass)#%d (1) { } Using PDO::FETCH_CLASS to fetch the object from DB and unserialize it... -myclass::__construct(PDO shall call __construct()) myclass::__set(myobj, 'C:7:"myclass":19:{Data from serialize}') +myclass::__construct(PDO shall call __construct()) object(myclass)#%d (2) { [%u|b%"myprotected":protected]=> %unicode|string%(19) "a protected propery" |