changed structure of UTF8 data; added comment for fix in source code
This commit is contained in:
parent
734e80cd0c
commit
c508a84ef1
|
@ -659,6 +659,9 @@ PHP_FUNCTION( sqlsrv_close )
|
||||||
LOG( SEV_ERROR, "Failed to remove connection resource %1!d!", Z_RES_HANDLE_P( conn_r ));
|
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);
|
Z_TRY_DELREF_P(conn_r);
|
||||||
ZVAL_NULL( conn_r );
|
ZVAL_NULL( conn_r );
|
||||||
|
|
||||||
|
|
|
@ -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);
|
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);
|
Z_TRY_DELREF_P(stmt_r);
|
||||||
ZVAL_NULL( stmt_r );
|
ZVAL_NULL( stmt_r );
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -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");
|
Trace("Execution setup: $noPasses passes over a table with $noRows1 => ".($noRows1 + $noRows2)." rows.\n");
|
||||||
$conn1 = Connect();
|
$conn1 = Connect();
|
||||||
$conn1->setAttribute(PDO::SQLSRV_ATTR_ENCODING, PDO::SQLSRV_ENCODING_UTF8);
|
|
||||||
SetUTF8Data(true);
|
|
||||||
|
|
||||||
CreateTable($conn1, $tableName);
|
CreateTable($conn1, $tableName);
|
||||||
$noRowsInserted = InsertRows($conn1, $tableName, $noRows1);
|
$noRowsInserted = InsertRows($conn1, $tableName, $noRows1);
|
||||||
|
|
|
@ -270,19 +270,15 @@ function RunTest($noPasses, $noRows, $tableName, $conn, $prepared, $release, $mo
|
||||||
case 1: // no release
|
case 1: // no release
|
||||||
$conn2 = GetConnection();
|
$conn2 = GetConnection();
|
||||||
sqlsrv_close($conn2);
|
sqlsrv_close($conn2);
|
||||||
// need unset to trigger the destruction a zval of refcount 0
|
|
||||||
unset($conn2);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // query with no release
|
case 2: // query with no release
|
||||||
$stmt = ExecQuery($conn, $tableName, $prepared);
|
$stmt = ExecQuery($conn, $tableName, $prepared);
|
||||||
unset($stmt);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: // query with release
|
case 3: // query with release
|
||||||
$stmt = ExecQuery($conn, $tableName, $prepared);
|
$stmt = ExecQuery($conn, $tableName, $prepared);
|
||||||
sqlsrv_free_stmt($stmt);
|
sqlsrv_free_stmt($stmt);
|
||||||
unset($stmt);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4: // fetch
|
case 4: // fetch
|
||||||
|
@ -299,7 +295,6 @@ function RunTest($noPasses, $noRows, $tableName, $conn, $prepared, $release, $mo
|
||||||
{
|
{
|
||||||
die("$rowCount rows retrieved instead of $noRows\n");
|
die("$rowCount rows retrieved instead of $noRows\n");
|
||||||
}
|
}
|
||||||
unset($stmt);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5: // fetch fields
|
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");
|
die("Field $i of row $rowCount is missing");
|
||||||
}
|
}
|
||||||
unset($fld);
|
unset($fld);
|
||||||
$fld = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($release)
|
if ($release)
|
||||||
|
@ -327,7 +321,6 @@ function RunTest($noPasses, $noRows, $tableName, $conn, $prepared, $release, $mo
|
||||||
{
|
{
|
||||||
die("$rowCount rows retrieved instead of $noRows\n");
|
die("$rowCount rows retrieved instead of $noRows\n");
|
||||||
}
|
}
|
||||||
unset($stmt);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6: // fetch array
|
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");
|
die("$rowCount rows retrieved instead of $noRows\n");
|
||||||
}
|
}
|
||||||
unset($stmt);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7: // fetch object
|
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");
|
die("$rowCount rows retrieved instead of $noRows\n");
|
||||||
}
|
}
|
||||||
unset($stmt);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// need unset to trigger the destruction of a zval with refcount of 0
|
||||||
|
unset($conn2);
|
||||||
|
unset($stmt);
|
||||||
}
|
}
|
||||||
$memEnd = memory_get_usage();
|
$memEnd = memory_get_usage();
|
||||||
Trace( intval($memEnd) . " - " . intval($memStart) . "\n" );
|
Trace( intval($memEnd) . " - " . intval($memStart) . "\n" );
|
||||||
|
|
Loading…
Reference in a new issue