mirror of
https://github.com/php/php-src.git
synced 2025-08-19 17:04:47 +02:00
Fixing a leak in mysqlnd when passing invalid fetch modes to mysqlnd.
This commit is contained in:
parent
59dc338ac2
commit
d79cba2afd
3 changed files with 13 additions and 17 deletions
|
@ -2012,7 +2012,7 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type,
|
|||
}
|
||||
}
|
||||
|
||||
if ((result_type & MYSQL_BOTH) == 0) {
|
||||
if (result_type & ~MYSQL_BOTH) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The result type should be either MYSQL_NUM, MYSQL_ASSOC or MYSQL_BOTH");
|
||||
result_type = MYSQL_BOTH;
|
||||
}
|
||||
|
@ -2200,6 +2200,11 @@ PHP_FUNCTION(mysql_fetch_array)
|
|||
}
|
||||
ZEND_FETCH_RESOURCE(result, MYSQL_RES *, &mysql_result, -1, "MySQL result", le_result);
|
||||
|
||||
if (mode & ~MYSQL_BOTH) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The result type should be either MYSQL_NUM, MYSQL_ASSOC or MYSQL_BOTH");
|
||||
mode = MYSQL_BOTH;
|
||||
}
|
||||
|
||||
mysqlnd_fetch_into(result, mode, return_value, MYSQLND_MYSQL);
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue