Skip to content

Commit bba1f18

Browse files
authored
Updated function signatures and error messages (#1163)
1 parent 550a710 commit bba1f18

8 files changed

+16
-10
lines changed

test/functional/pdo_sqlsrv/PDO94_Extend1.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class ExPDO extends PDO
5858
$this->test2 = 22;
5959
}
6060

61-
function query($sql)
61+
function query($sql, $fetch_style = PDO::FETCH_BOTH,...$fetch_mode_args)
6262
{
6363
echo __METHOD__ . "()\n";
6464
$stmt = parent::prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('ExPDOStatement')));

test/functional/pdo_sqlsrv/PDO95_Extend2.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class ExPDO extends PDO
5555
return (call_user_func_array(array($this, 'parent::exec'), $args));
5656
}
5757

58-
public function query(string $statement)
58+
public function query($statement, $fetch_style = PDO::FETCH_BOTH,...$fetch_mode_args)
5959
{
6060
$this->protocol();
6161
$args = func_get_args();

test/functional/pdo_sqlsrv/PDO96_Extend3.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class ExPDO extends PDO
6161
echo __METHOD__ . "()\n";
6262
}
6363

64-
function query($sql)
64+
function query($sql, $fetch_style = PDO::FETCH_BOTH,...$fetch_mode_args)
6565
{
6666
echo __METHOD__ . "()\n";
6767
$stmt = $this->prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('ExPDOStatement', array($this))));

test/functional/pdo_sqlsrv/PDO97_Extend4.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class ExPDO extends PDO
6666
echo __METHOD__ . "()\n";
6767
}
6868

69-
function query($sql)
69+
function query($sql, $fetch_style = PDO::FETCH_BOTH,...$fetch_mode_args)
7070
{
7171
echo __METHOD__ . "()\n";
7272
$stmt = $this->prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('ExPDOStatement', array($this))));

test/functional/pdo_sqlsrv/PDO98_Extend5.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class ExPDO extends PDO
6969
echo __METHOD__ . "()\n";
7070
}
7171

72-
function query($sql)
72+
function query($sql, $fetch_style = PDO::FETCH_BOTH,...$fetch_mode_args)
7373
{
7474
echo __METHOD__ . "()\n";
7575
$stmt = parent::query($sql);

test/functional/pdo_sqlsrv/pdostatement_fetchAll.phpt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,11 @@ function fetchAllInvalid($conn, $tbname)
8080
} catch (PDOException $ex) {
8181
print_r($ex);
8282
} catch (Error $err) {
83-
$expected = (PHP_MAJOR_VERSION == 8) ? 'PDO::FETCH_UNKNOWN' : 'FETCH_UNKNOWN';
84-
$message = "Undefined class constant '$expected'";
83+
if (PHP_MAJOR_VERSION == 8) {
84+
$message = "Undefined constant PDO::FETCH_UNKNOWN";
85+
} else {
86+
$message = "Undefined class constant 'FETCH_UNKNOWN'";
87+
}
8588
if ($err->getMessage() !== $message) {
8689
echo $err->getMessage() . PHP_EOL;
8790
}

test/functional/pdo_sqlsrv/pdostatement_fetch_style.phpt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,11 @@ function fetchWithStyle($conn, $tbname, $style)
8282
} catch (PDOException $err) {
8383
print_r($err);
8484
} catch (Error $err) {
85-
$expected = (PHP_MAJOR_VERSION == 8) ? 'PDO::FETCH_UNKNOWN' : 'FETCH_UNKNOWN';
86-
$message = "Undefined class constant '$expected'";
85+
if (PHP_MAJOR_VERSION == 8) {
86+
$message = "Undefined constant PDO::FETCH_UNKNOWN";
87+
} else {
88+
$message = "Undefined class constant 'FETCH_UNKNOWN'";
89+
}
8790
if ($err->getMessage() !== $message) {
8891
echo $err->getMessage() . PHP_EOL;
8992
}

test/functional/sqlsrv/sqlsrv_input_param_unknown_encoding.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function warningHandler($errno, $errstr)
2121

2222
function compareMessages($err)
2323
{
24-
$exp8x = "Undefined constant 'SQLSRV_ENC_UNKNOWN'";
24+
$exp8x = 'Undefined constant "SQLSRV_ENC_UNKNOWN"';
2525
$exp7x = "Use of undefined constant SQLSRV_ENC_UNKNOWN - assumed 'SQLSRV_ENC_UNKNOWN' (this will throw an Error in a future version of PHP)";
2626

2727
$expected = (PHP_MAJOR_VERSION == 8) ? $exp8x : $exp7x;

0 commit comments

Comments
 (0)