From: Derick Rethans Date: Fri, 16 May 2003 19:07:57 +0000 (+0000) Subject: - Fixed bug #23661: mysql_fetch_array gives no warning on an invalid X-Git-Tag: BEFORE_FD_REVERT~67 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=37142b284f7422dce8fd818b25b46af76397ca36;p=php - Fixed bug #23661: mysql_fetch_array gives no warning on an invalid result_type --- diff --git a/NEWS b/NEWS index b81f537e20..2abff4e8e9 100644 --- a/NEWS +++ b/NEWS @@ -41,6 +41,8 @@ PHP 4 NEWS - Fixed several 64-bit problems. (Dave) - Fixed several errors in hwapi extension. Objects weren't handled properly. (Uwe) +- Fixed bug #23661 (mysql_fetch_array give no warning when an invalid argument + was passed as result_type). (Derick) - Fixed bug #23606 (Unable to build --with-db4 (db4.1.25)). (Marcus) - Fixed bug #23567 (pfsockopen() returns dead connections). (Wez) - Fixed bug #23527 (PostScript Type 1 fonts do not render properly). diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index 1e7ba432b9..2d766c4dcc 100644 --- a/ext/mysql/php_mysql.c +++ b/ext/mysql/php_mysql.c @@ -1876,6 +1876,10 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type, WRONG_PARAM_COUNT; break; } + + if ((result_type & MYSQL_BOTH) == 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The result type should be either MYSQL_NUM, MYSQL_ASSOC or MYSQL_BOTH."); + } ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);