Fixing a leak in mysqlnd when passing invalid fetch modes to mysqlnd.

This commit is contained in:
Ulf Wendel 2009-09-30 14:39:33 +00:00
parent 59dc338ac2
commit d79cba2afd
3 changed files with 13 additions and 17 deletions

View file

@ -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
}