diff options
author | Ulf Wendel <uw@php.net> | 2009-09-30 14:39:33 +0000 |
---|---|---|
committer | Ulf Wendel <uw@php.net> | 2009-09-30 14:39:33 +0000 |
commit | 9408303390b0c4b212a5901541aba6ae2027a910 (patch) | |
tree | 654d09a16020b6eafbf3668042b6d9d350b91018 /ext/mysql/php_mysql.c | |
parent | 7a535b807c14649ceb5c01a04a21931fc8ca7303 (diff) | |
download | php-git-9408303390b0c4b212a5901541aba6ae2027a910.tar.gz |
Fixing a leak in mysqlnd when passing invalid fetch modes to mysqlnd.
Diffstat (limited to 'ext/mysql/php_mysql.c')
-rw-r--r-- | ext/mysql/php_mysql.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index aaee07bc6a..694640f59c 100644 --- a/ext/mysql/php_mysql.c +++ b/ext/mysql/php_mysql.c @@ -1972,7 +1972,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; } @@ -2149,6 +2149,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 } |