andrey Tue Apr 19 09:42:31 2005 EDT Added files: (Branch: PHP_5_0) /php-src/ext/mysqli/tests bug32405.phpt
Modified files: /php-src/ext/mysqli mysqli_api.c Log: MFH http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.87.2.12&r2=1.87.2.13&ty=u Index: php-src/ext/mysqli/mysqli_api.c diff -u php-src/ext/mysqli/mysqli_api.c:1.87.2.12 php-src/ext/mysqli/mysqli_api.c:1.87.2.13 --- php-src/ext/mysqli/mysqli_api.c:1.87.2.12 Thu Mar 17 13:12:30 2005 +++ php-src/ext/mysqli/mysqli_api.c Tue Apr 19 09:42:29 2005 @@ -15,7 +15,7 @@ | Author: Georg Richter <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ - $Id: mysqli_api.c,v 1.87.2.12 2005/03/17 18:12:30 tony2001 Exp $ + $Id: mysqli_api.c,v 1.87.2.13 2005/04/19 13:42:29 andrey Exp $ */ #ifdef HAVE_CONFIG_H @@ -311,6 +311,9 @@ case MYSQL_TYPE_BLOB: case MYSQL_TYPE_TIMESTAMP: case MYSQL_TYPE_DECIMAL: +#ifdef FIELD_TYPE_NEWDECIMAL + case MYSQL_TYPE_NEWDECIMAL: +#endif stmt->result.buf[ofs].type = IS_STRING; stmt->result.buf[ofs].buflen = (stmt->stmt->fields) ? (stmt->stmt->fields[ofs].length) ? stmt->stmt->fields[ofs].length + 1: 256: 256; @@ -585,7 +588,7 @@ zval *mysql_stmt; unsigned int i; ulong ret; - long lval; + int lval; double dval; my_ulonglong llval; @@ -611,11 +614,11 @@ if (!stmt->result.is_null[i]) { switch (stmt->result.buf[i].type) { case IS_LONG: - memcpy(&lval, stmt->result.buf[i].val, sizeof(long)); + memcpy(&lval, stmt->result.buf[i].val, sizeof(lval)); ZVAL_LONG(stmt->result.vars[i], lval); break; case IS_DOUBLE: - memcpy(&dval, stmt->result.buf[i].val, sizeof(double)); + memcpy(&dval, stmt->result.buf[i].val, sizeof(dval)); ZVAL_DOUBLE(stmt->result.vars[i], dval); break; case IS_STRING: @@ -749,7 +752,7 @@ MYSQL_RES *result; zval *mysql_result; MYSQL_FIELD *field; - int offset; + long offset; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) { return; @@ -839,7 +842,7 @@ { MYSQL_RES *result; zval *mysql_result; - unsigned int fieldnr; + unsigned long fieldnr; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &fieldnr) == FAILURE) { return; @@ -1029,7 +1032,7 @@ { MY_MYSQL *mysql; zval *mysql_link; - int processid; + unsigned long processid; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_link, mysqli_link_class_entry, &processid) == FAILURE) { return; @@ -1277,7 +1280,7 @@ MY_MYSQL *mysql; char *hostname = NULL, *username=NULL, *passwd=NULL, *dbname=NULL, *socket=NULL; unsigned int hostname_len, username_len, passwd_len, dbname_len, socket_len; - unsigned int port=0, flags=0; + unsigned long port=0, flags=0; zval *mysql_link; zval *object = getThis(); @@ -1416,7 +1419,8 @@ MY_STMT *stmt; zval *mysql_stmt; char *data; - long param_nr, data_len; + long param_nr; + int data_len; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols", &mysql_stmt, mysqli_stmt_class_entry, ¶m_nr, &data, &data_len) == FAILURE) { @@ -1521,6 +1525,9 @@ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_stmt, mysqli_stmt_class_entry, &offset) == FAILURE) { return; } + if (offset < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset must be positive"); + } MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt"); http://cvs.php.net/co.php/php-src/ext/mysqli/tests/bug32405.phpt?r=1.1&p=1 Index: php-src/ext/mysqli/tests/bug32405.phpt +++ php-src/ext/mysqli/tests/bug32405.phpt --TEST-- Bug #32405 --SKIPIF-- <?php require_once('skipif.inc'); ?> --FILE-- <?php include ("connect.inc"); /*** test mysqli_connect 127.0.0.1 ***/ $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); /* two fields are needed. the problem does not occur with 1 field only selected. */ $link->query("CREATE TABLE test_users(user_id int(10) unsigned NOT NULL auto_increment, login varchar(50) default '', PRIMARY KEY (user_id))"); $link->query('INSERT INTO test_users VALUES (NULL, "user1"), (NULL, "user2"), (NULL, "user3"), (NULL, "user4")'); if ($stmt = $link->prepare("SELECT SQL_NO_CACHE user_id, login FROM test_users")) { $stmt->execute(); $stmt->bind_result($col1, $col2); while ($stmt->fetch()) { var_dump($col1, $col2); } $stmt->close(); } mysqli_query($link,"DROP TABLE test_users"); mysqli_close($link); ?> --EXPECT-- int(1) string(5) "user1" int(2) string(5) "user2" int(3) string(5) "user3" int(4) string(5) "user4" -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php