Update bvt tests for PHP 8.2 (#1409)

This commit is contained in:
Sicong 2022-09-13 11:17:57 -07:00 committed by GitHub
parent ed96718152
commit 4974fe4334
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 23 additions and 7 deletions

View file

@ -321,7 +321,7 @@ class BuildUtil(object):
else: # pdo_sqlsrv else: # pdo_sqlsrv
cmd_line = ' --enable-pdo --with-pdo-sqlsrv=shared ' + cmd_line cmd_line = ' --enable-pdo --with-pdo-sqlsrv=shared ' + cmd_line
cmd_line = 'cscript configure.js --disable-all --enable-cli --enable-cgi --enable-json --enable-embed' + cmd_line cmd_line = 'cscript configure.js --disable-all --enable-cli --enable-cgi --enable-json --enable-embed --enable-mbstring' + cmd_line
if self.thread == 'nts': if self.thread == 'nts':
cmd_line = cmd_line + ' --disable-zts' cmd_line = cmd_line + ' --disable-zts'
return cmd_line return cmd_line

View file

@ -8,9 +8,13 @@ fetch with all fetch styles
$conn = new PDO( "sqlsrv:server=$server ; Database = $databaseName", "$uid", "$pwd"); $conn = new PDO( "sqlsrv:server=$server ; Database = $databaseName", "$uid", "$pwd");
print( "\n---------- PDO::FETCH_CLASS -------------\n" ); print( "\n---------- PDO::FETCH_CLASS -------------\n" );
$stmt = $conn->query( "select * from HumanResources.Department order by GroupName" ); $stmt = $conn->query( "select DepartmentID, Name, GroupName from HumanResources.Department order by GroupName" );
class cc { class cc {
public $DepartmentID;
public $Name;
public $GroupName;
function __construct( $arg ) { function __construct( $arg ) {
echo "$arg"; echo "$arg";
} }
@ -26,7 +30,7 @@ fetch with all fetch styles
} }
print( "\n---------- PDO::FETCH_INTO -------------\n" ); print( "\n---------- PDO::FETCH_INTO -------------\n" );
$stmt = $conn->query( "select * from HumanResources.Department order by GroupName" ); $stmt = $conn->query( "select DepartmentID, Name, GroupName from HumanResources.Department order by GroupName" );
$c_obj = new cc( '' ); $c_obj = new cc( '' );
$stmt->setFetchMode(PDO::FETCH_INTO, $c_obj); $stmt->setFetchMode(PDO::FETCH_INTO, $c_obj);

View file

@ -25,6 +25,10 @@ fetches the rows in a result set in an array
print "\n-----------\n"; print "\n-----------\n";
class cc { class cc {
public $ContactTypeID;
public $Name;
public $ModifiedDate;
function __construct( $arg ) { function __construct( $arg ) {
echo "$arg\n"; echo "$arg\n";
} }
@ -34,7 +38,7 @@ fetches the rows in a result set in an array
} }
}; };
$stmt = $conn->query( 'SELECT TOP(2) * FROM Person.ContactType' ); $stmt = $conn->query( 'SELECT TOP(2) ContactTypeID, Name, ModifiedDate FROM Person.ContactType' );
$all = $stmt->fetchAll( PDO::FETCH_CLASS, 'cc', array( 'Hi!' )); $all = $stmt->fetchAll( PDO::FETCH_CLASS, 'cc', array( 'Hi!' ));
var_dump( $all ); var_dump( $all );

View file

@ -26,9 +26,13 @@ while ( $row = $stmt->fetch() ){
} }
echo "\n........ query with a new class ............\n"; echo "\n........ query with a new class ............\n";
$query = 'select * from HumanResources.Department order by GroupName'; $query = 'select DepartmentID, Name, GroupName from HumanResources.Department order by GroupName';
// query with a class // query with a class
class cc { class cc {
public $DepartmentID;
public $Name;
public $GroupName;
function __construct( $arg ) { function __construct( $arg ) {
echo "$arg"; echo "$arg";
} }

View file

@ -25,7 +25,7 @@ $tsql1 = "UPDATE Production.ProductReview
// //
$reviewID = 3; $reviewID = 3;
$comments = utf8_encode("testing 1, 2, 3, 4. Testing."); $comments = mb_convert_encoding("testing 1, 2, 3, 4. Testing.", 'ISO-8859-1', 'UTF-8');
$params1 = array( $params1 = array(
array( $comments, null ), array( $comments, null ),
array( $reviewID, null ) array( $reviewID, null )

View file

@ -7,6 +7,8 @@ retrieves each row of a result set as an instance of the Product class defined i
/* Define the Product class. */ /* Define the Product class. */
class Product class Product
{ {
/* Constructor */ /* Constructor */
public function ProductConstruct($ID) public function ProductConstruct($ID)
{ {
@ -17,6 +19,8 @@ class Product
public $StockedQty; public $StockedQty;
public $SafetyStockLevel; public $SafetyStockLevel;
private $UnitPrice; private $UnitPrice;
public $Name;
public $Color;
function getPrice() function getPrice()
{ {
return $this->UnitPrice; return $this->UnitPrice;

View file

@ -27,7 +27,7 @@ $tsql1 = "UPDATE Production.ProductReview
// utf8_encode to simulate an application that uses UTF-8 encoded data. // utf8_encode to simulate an application that uses UTF-8 encoded data.
// //
$reviewID = 3; $reviewID = 3;
$comments = utf8_encode("testing"); $comments = mb_convert_encoding("testing", 'ISO-8859-1', 'UTF-8');
$params1 = array( $params1 = array(
array($comments, array($comments,
SQLSRV_PARAM_IN, SQLSRV_PARAM_IN,