summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/mysqli/mysqli_api.c4
-rw-r--r--ext/mysqli/php_mysqli_structs.h3
-rw-r--r--ext/mysqli/tests/005.phpt3
3 files changed, 7 insertions, 3 deletions
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index 38bf9ae946..bb398af38c 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -409,7 +409,7 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval ***args, unsigned int argc,
bind[ofs].buffer = stmt->result.buf[ofs].val;
bind[ofs].is_null = &stmt->result.is_null[ofs];
bind[ofs].buffer_length = stmt->result.buf[ofs].buflen;
- bind[ofs].length = &stmt->result.buf[ofs].buflen;
+ bind[ofs].length = &stmt->result.buf[ofs].output_len;
break;
}
default:
@@ -916,7 +916,7 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS)
{
#endif
ZVAL_STRINGL(stmt->result.vars[i], stmt->result.buf[i].val,
- stmt->result.buf[i].buflen, 1);
+ stmt->result.buf[i].output_len, 1);
}
}
break;
diff --git a/ext/mysqli/php_mysqli_structs.h b/ext/mysqli/php_mysqli_structs.h
index ce02059488..81d1044ce1 100644
--- a/ext/mysqli/php_mysqli_structs.h
+++ b/ext/mysqli/php_mysqli_structs.h
@@ -73,8 +73,9 @@ enum mysqli_status {
};
typedef struct {
- ulong buflen;
char *val;
+ ulong buflen;
+ ulong output_len;
ulong type;
} VAR_BUFFER;
diff --git a/ext/mysqli/tests/005.phpt b/ext/mysqli/tests/005.phpt
index 69e04c7a60..563b10359d 100644
--- a/ext/mysqli/tests/005.phpt
+++ b/ext/mysqli/tests/005.phpt
@@ -32,6 +32,9 @@ require_once('skipifconnectfailure.inc');
var_dump($test);
+ /* this will crash with libmysql from PHP 5.0.6 (or earlier) to 5.3.0 */
+ mysqli_fetch($stmt);
+
mysqli_stmt_close($stmt);
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
mysqli_close($link);