changed structure of UTF8 data; added comment for fix in source code

This commit is contained in:
v-kaywon 2017-06-19 12:55:40 -07:00
parent 734e80cd0c
commit c508a84ef1
5 changed files with 998 additions and 1153 deletions

View file

@ -659,6 +659,9 @@ PHP_FUNCTION( sqlsrv_close )
LOG( SEV_ERROR, "Failed to remove connection resource %1!d!", Z_RES_HANDLE_P( conn_r ));
}
// when conn_r is first parsed in zend_parse_parameters, conn_r becomes a zval that points to a zend_resource with a refcount of 2
// need to DELREF here so the refcount becomes 1 and conn_r can be appropriate destroyed by the garbage collector when it goes out of scope
// zend_list_close only destroy the resource pointed to by Z_RES_P( conn_r ), not the zend_resource itself
Z_TRY_DELREF_P(conn_r);
ZVAL_NULL( conn_r );

View file

@ -1376,6 +1376,9 @@ PHP_FUNCTION( sqlsrv_free_stmt )
LOG( SEV_ERROR, "Failed to remove stmt resource %1!d!", Z_RES_P( stmt_r )->handle);
}
// when stmt_r is first parsed in zend_parse_parameters, stmt_r becomes a zval that points to a zend_resource with a refcount of 2
// need to DELREF here so the refcount becomes 1 and stmt_r can be appropriate destroyed by the garbage collector when it goes out of scope
// zend_list_close only destroy the resource pointed to by Z_RES_P( stmt_r ), not the zend_resource itself
Z_TRY_DELREF_P(stmt_r);
ZVAL_NULL( stmt_r );

File diff suppressed because one or more lines are too long

View file

@ -23,8 +23,6 @@ function MemCheck($noPasses, $noRows1, $noRows2, $startStep, $endStep, $leakThre
Trace("Execution setup: $noPasses passes over a table with $noRows1 => ".($noRows1 + $noRows2)." rows.\n");
$conn1 = Connect();
$conn1->setAttribute(PDO::SQLSRV_ATTR_ENCODING, PDO::SQLSRV_ENCODING_UTF8);
SetUTF8Data(true);
CreateTable($conn1, $tableName);
$noRowsInserted = InsertRows($conn1, $tableName, $noRows1);

View file

@ -270,19 +270,15 @@ function RunTest($noPasses, $noRows, $tableName, $conn, $prepared, $release, $mo
case 1: // no release
$conn2 = GetConnection();
sqlsrv_close($conn2);
// need unset to trigger the destruction a zval of refcount 0
unset($conn2);
break;
case 2: // query with no release
$stmt = ExecQuery($conn, $tableName, $prepared);
unset($stmt);
break;
case 3: // query with release
$stmt = ExecQuery($conn, $tableName, $prepared);
sqlsrv_free_stmt($stmt);
unset($stmt);
break;
case 4: // fetch
@ -299,7 +295,6 @@ function RunTest($noPasses, $noRows, $tableName, $conn, $prepared, $release, $mo
{
die("$rowCount rows retrieved instead of $noRows\n");
}
unset($stmt);
break;
case 5: // fetch fields
@ -316,7 +311,6 @@ function RunTest($noPasses, $noRows, $tableName, $conn, $prepared, $release, $mo
die("Field $i of row $rowCount is missing");
}
unset($fld);
$fld = null;
}
}
if ($release)
@ -327,7 +321,6 @@ function RunTest($noPasses, $noRows, $tableName, $conn, $prepared, $release, $mo
{
die("$rowCount rows retrieved instead of $noRows\n");
}
unset($stmt);
break;
case 6: // fetch array
@ -344,7 +337,6 @@ function RunTest($noPasses, $noRows, $tableName, $conn, $prepared, $release, $mo
{
die("$rowCount rows retrieved instead of $noRows\n");
}
unset($stmt);
break;
case 7: // fetch object
@ -361,14 +353,15 @@ function RunTest($noPasses, $noRows, $tableName, $conn, $prepared, $release, $mo
{
die("$rowCount rows retrieved instead of $noRows\n");
}
unset($stmt);
break;
default:
break;
}
// need unset to trigger the destruction of a zval with refcount of 0
unset($conn2);
unset($stmt);
}
$memEnd = memory_get_usage();
Trace( intval($memEnd) . " - " . intval($memStart) . "\n" );