diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2006-11-28 16:27:53 +0000 |
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2006-11-28 16:27:53 +0000 |
| commit | 2d4b8e19e2cd9dab59188cef89fd771d7a71aa7f (patch) | |
| tree | f3e760b5636da768fd401f6706f3f47e42ecfb99 | |
| parent | 2c6a5df4acc881da693219124751d0f314dda624 (diff) | |
| download | php-git-2d4b8e19e2cd9dab59188cef89fd771d7a71aa7f.tar.gz | |
Fixed bug #39656 (crash when calling fetch() on a PDO statment object
after closeCursor()).
| -rw-r--r-- | NEWS | 4 | ||||
| -rwxr-xr-x | ext/pdo/pdo_stmt.c | 9 | ||||
| -rw-r--r-- | ext/pdo_pgsql/pgsql_statement.c | 2 |
3 files changed, 12 insertions, 3 deletions
@@ -43,8 +43,12 @@ PHP NEWS php_filter.h). - Fixed wrong signature initialization in imagepng (Takeshi Abe) - Added optimization for imageline with horizontal and vertial lines (Pierre) +- Fixed bug #39656 (crash when calling fetch() on a PDO statment object + after closeCursor()). (Ilia, Tony) - Fixed bug #39653 (ext/dba doesn't check for db-4.5 and db-4.4 when db4 support is enabled). (Tony) +- Fixed bug #39623 (thread safety fixes on *nix for putenv() & mime_magic). + (Ilia, wharmby at uk dot ibm dot com) - Fixed bug #39621 (str_replace() is not binary safe on strings with equal length). (Tony) - Fixed bug #39613 (Possible segfault in imap initialization due to missing diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 6395490168..e47710c8df 100755 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -466,7 +466,7 @@ static PHP_METHOD(PDOStatement, execute) if (!stmt->executed) { /* this is the first execute */ - if (stmt->dbh->alloc_own_columns) { + if (stmt->dbh->alloc_own_columns && !stmt->columns) { /* for "big boy" drivers, we need to allocate memory to fetch * the results into, so lets do that now */ ret = pdo_stmt_describe_columns(stmt TSRMLS_CC); @@ -617,6 +617,10 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ static int do_fetch_common(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, long offset, int do_bind TSRMLS_DC) /* {{{ */ { + if (!stmt->executed) { + return 0; + } + if (!dispatch_param_event(stmt, PDO_PARAM_EVT_FETCH_PRE TSRMLS_CC)) { return 0; } @@ -1993,6 +1997,7 @@ static PHP_METHOD(PDOStatement, closeCursor) } } while (1); + stmt->executed = 0; RETURN_TRUE; } @@ -2002,7 +2007,7 @@ static PHP_METHOD(PDOStatement, closeCursor) PDO_HANDLE_STMT_ERR(); RETURN_FALSE; } - + stmt->executed = 0; RETURN_TRUE; } /* }}} */ diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c index fbcd31720b..55de65c2d5 100644 --- a/ext/pdo_pgsql/pgsql_statement.c +++ b/ext/pdo_pgsql/pgsql_statement.c @@ -197,7 +197,7 @@ stmt_retry: return 0; } - if(!stmt->executed) { + if (!stmt->executed && !stmt->column_count) { stmt->column_count = (int) PQnfields(S->result); S->cols = ecalloc(stmt->column_count, sizeof(pdo_pgsql_column)); } |
