mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Handle OOM in mysqlnd_fetch_row_unbuffered_c()
This commit is contained in:
parent
2b18a3ff93
commit
2b00096004
1 changed files with 21 additions and 18 deletions
|
@ -646,27 +646,30 @@ mysqlnd_fetch_row_unbuffered_c(MYSQLND_RES * result TSRMLS_DC)
|
||||||
result->conn->stats TSRMLS_CC);
|
result->conn->stats TSRMLS_CC);
|
||||||
|
|
||||||
retrow = mnd_malloc(result->field_count * sizeof(char *));
|
retrow = mnd_malloc(result->field_count * sizeof(char *));
|
||||||
|
if (retrow) {
|
||||||
|
for (i = 0; i < field_count; i++, field++, zend_hash_key++) {
|
||||||
|
zval *data = result->unbuf->last_row_data[i];
|
||||||
|
unsigned int len;
|
||||||
|
|
||||||
for (i = 0; i < field_count; i++, field++, zend_hash_key++) {
|
if (Z_TYPE_P(data) != IS_NULL) {
|
||||||
zval *data = result->unbuf->last_row_data[i];
|
convert_to_string(data);
|
||||||
unsigned int len;
|
retrow[i] = Z_STRVAL_P(data);
|
||||||
|
len = Z_STRLEN_P(data);
|
||||||
|
} else {
|
||||||
|
retrow[i] = NULL;
|
||||||
|
len = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (Z_TYPE_P(data) != IS_NULL) {
|
if (lengths) {
|
||||||
convert_to_string(data);
|
lengths[i] = len;
|
||||||
retrow[i] = Z_STRVAL_P(data);
|
}
|
||||||
len = Z_STRLEN_P(data);
|
|
||||||
} else {
|
if (field->max_length < len) {
|
||||||
retrow[i] = NULL;
|
field->max_length = len;
|
||||||
len = 0;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (lengths) {
|
|
||||||
lengths[i] = len;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (field->max_length < len) {
|
|
||||||
field->max_length = len;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
SET_OOM_ERROR(result->conn->error_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (ret == FAIL) {
|
} else if (ret == FAIL) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue