From: Andrey Hristov Date: Tue, 19 Apr 2005 13:28:41 +0000 (+0000) Subject: - nail down another 64bit problem. this will fix about 14 failing tests X-Git-Tag: php-5.0.1b1~478 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2a3c71b833bd8f069120448cbacdaeda08c184dc;p=php - nail down another 64bit problem. this will fix about 14 failing tests on amd64 (probably other 64 bit arch). - use ulong for this boolean variable, as it was before - throw an warning if offset passed to mysqli_stmt_data_seek is negative --- diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 1a82a8199b..5c7b4ca961 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -588,7 +588,7 @@ PHP_FUNCTION(mysqli_stmt_fetch) zval *mysql_stmt; unsigned int i; ulong ret; - long lval; + int lval; double dval; my_ulonglong llval; @@ -614,11 +614,11 @@ PHP_FUNCTION(mysqli_stmt_fetch) 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: @@ -1491,6 +1491,9 @@ PHP_FUNCTION(mysqli_stmt_data_seek) 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"); @@ -1698,7 +1701,7 @@ PHP_FUNCTION(mysqli_stmt_attr_set) { MY_STMT *stmt; zval *mysql_stmt; - zend_bool mode; + ulong mode; ulong attr; int rc;