MFH: Fix #47438 mysql_fetch_field ignores zero offse

This commit is contained in:
Johannes Schlüter 2009-02-18 16:34:47 +00:00
parent 42bb8ed2b5
commit b489d3a69f
3 changed files with 41 additions and 1 deletions

View file

@ -2318,7 +2318,7 @@ PHP_FUNCTION(mysql_fetch_field)
ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, &result, -1, "MySQL result", le_result);
if (field) {
if (ZEND_NUM_ARGS() > 1) {
if (field<0 || field>=(int)mysql_num_fields(mysql_result)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad field offset");
RETURN_FALSE;