Skip to content

Commit ea03cbe

Browse files
CrellGirgias
authored andcommitted
Update PDO parameters for named arguments.
Closes GH-6220
1 parent 99b3631 commit ea03cbe

9 files changed

+39
-39
lines changed

Zend/tests/bug70914.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ try {
1818
}
1919
?>
2020
--EXPECT--
21-
PDOStatement::fetchObject(): Argument #1 ($class_name) must be a valid class name, %Z given
21+
PDOStatement::fetchObject(): Argument #1 ($class) must be a valid class name, %Z given

ext/pdo/pdo_dbh.stub.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
class PDO
66
{
7-
public function __construct(string $dsn, ?string $username = null, ?string $passwd = null, ?array $options = null) {}
7+
public function __construct(string $dsn, ?string $username = null, ?string $password = null, ?array $options = null) {}
88

99
/** @return bool */
1010
public function beginTransaction() {}
@@ -34,13 +34,13 @@ public function inTransaction() {}
3434
public function lastInsertId(?string $name = null) {}
3535

3636
/** @return PDOStatement|false */
37-
public function prepare(string $statement, array $driver_options = []) {}
37+
public function prepare(string $query, array $driver_options = []) {}
3838

3939
/** @return PDOStatement|false */
40-
public function query(string $statement, ?int $fetch_mode = null, mixed ...$fetch_mode_args) {}
40+
public function query(string $query, ?int $fetch_mode = null, mixed ...$fetch_mode_args) {}
4141

4242
/** @return string|false */
43-
public function quote(string $string, int $parameter_type = PDO::PARAM_STR) {}
43+
public function quote(string $string, int $type = PDO::PARAM_STR) {}
4444

4545
/** @return bool */
4646
public function rollBack() {}

ext/pdo/pdo_dbh_arginfo.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 0c7acc78768ad1fb77a09a24ebd4d4e660b350c9 */
2+
* Stub hash: 2bee02a9952faf3f768873bafe1be9ef89086029 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO___construct, 0, 0, 1)
55
ZEND_ARG_TYPE_INFO(0, dsn, IS_STRING, 0)
66
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, username, IS_STRING, 1, "null")
7-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, passwd, IS_STRING, 1, "null")
7+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, password, IS_STRING, 1, "null")
88
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null")
99
ZEND_END_ARG_INFO()
1010

@@ -34,19 +34,19 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_lastInsertId, 0, 0, 0)
3434
ZEND_END_ARG_INFO()
3535

3636
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_prepare, 0, 0, 1)
37-
ZEND_ARG_TYPE_INFO(0, statement, IS_STRING, 0)
37+
ZEND_ARG_TYPE_INFO(0, query, IS_STRING, 0)
3838
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, driver_options, IS_ARRAY, 0, "[]")
3939
ZEND_END_ARG_INFO()
4040

4141
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_query, 0, 0, 1)
42-
ZEND_ARG_TYPE_INFO(0, statement, IS_STRING, 0)
42+
ZEND_ARG_TYPE_INFO(0, query, IS_STRING, 0)
4343
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, fetch_mode, IS_LONG, 1, "null")
4444
ZEND_ARG_VARIADIC_TYPE_INFO(0, fetch_mode_args, IS_MIXED, 0)
4545
ZEND_END_ARG_INFO()
4646

4747
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_quote, 0, 0, 1)
4848
ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
49-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, parameter_type, IS_LONG, 0, "PDO::PARAM_STR")
49+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_LONG, 0, "PDO::PARAM_STR")
5050
ZEND_END_ARG_INFO()
5151

5252
#define arginfo_class_PDO_rollBack arginfo_class_PDO_beginTransaction

ext/pdo/pdo_stmt.stub.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
class PDOStatement implements IteratorAggregate
66
{
77
/** @return bool */
8-
public function bindColumn(string|int $column, mixed &$param, int $type = 0, int $maxlen = 0, mixed $driverdata = null) {}
8+
public function bindColumn(string|int $column, mixed &$param, int $type = 0, int $max_length = 0, mixed $driver_options = null) {}
99

1010
/** @return bool */
11-
public function bindParam(string|int $parameter, mixed &$param, int $type = PDO::PARAM_STR, int $maxlen = 0, mixed $driverdata = null) {}
11+
public function bindParam(string|int $param, mixed &$bind_var, int $type = PDO::PARAM_STR, int $max_length = 0, mixed $driver_options = null) {}
1212

1313
/** @return bool */
14-
public function bindValue(string|int $parameter, mixed $value, int $type = PDO::PARAM_STR) {}
14+
public function bindValue(string|int $param, mixed $value, int $type = PDO::PARAM_STR) {}
1515

1616
/** @return bool */
1717
public function closeCursor() {}
@@ -32,22 +32,22 @@ public function errorInfo() {}
3232
public function execute(?array $input_parameters = null) {}
3333

3434
/** @return mixed */
35-
public function fetch(int $fetch_style = PDO::FETCH_BOTH, int $cursor_orientation = PDO::FETCH_ORI_NEXT, int $cursor_offset = 0) {}
35+
public function fetch(int $mode = PDO::FETCH_BOTH, int $cursor_orientation = PDO::FETCH_ORI_NEXT, int $cursor_offset = 0) {}
3636

3737
/** @return array */
38-
public function fetchAll(int $fetch_style = PDO::FETCH_BOTH, mixed ...$fetch_mode_args) {}
38+
public function fetchAll(int $mode = PDO::FETCH_BOTH, mixed ...$args) {}
3939

4040
/** @return mixed */
41-
public function fetchColumn(int $column_number = 0) {}
41+
public function fetchColumn(int $index = 0) {}
4242

4343
/** @return mixed */
44-
public function fetchObject(?string $class_name = "stdClass", ?array $ctor_args = null) {}
44+
public function fetchObject(?string $class = "stdClass", ?array $constructor_args = null) {}
4545

4646
/** @return mixed */
47-
public function getAttribute(int $attribute) {}
47+
public function getAttribute(int $name) {}
4848

4949
/** @return array|false */
50-
public function getColumnMeta(int $column) {}
50+
public function getColumnMeta(int $index) {}
5151

5252
/** @return bool */
5353
public function nextRowset() {}

ext/pdo/pdo_stmt_arginfo.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: c12bc1c5d1e3dbd8cce67e50c974b20ec5564e67 */
2+
* Stub hash: b3338fc077eab1280da093f059fac14dd7f19678 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_bindColumn, 0, 0, 2)
55
ZEND_ARG_TYPE_MASK(0, column, MAY_BE_STRING|MAY_BE_LONG, NULL)
66
ZEND_ARG_TYPE_INFO(1, param, IS_MIXED, 0)
77
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_LONG, 0, "0")
8-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, maxlen, IS_LONG, 0, "0")
9-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, driverdata, IS_MIXED, 0, "null")
8+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, max_length, IS_LONG, 0, "0")
9+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, driver_options, IS_MIXED, 0, "null")
1010
ZEND_END_ARG_INFO()
1111

1212
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_bindParam, 0, 0, 2)
13-
ZEND_ARG_TYPE_MASK(0, parameter, MAY_BE_STRING|MAY_BE_LONG, NULL)
14-
ZEND_ARG_TYPE_INFO(1, param, IS_MIXED, 0)
13+
ZEND_ARG_TYPE_MASK(0, param, MAY_BE_STRING|MAY_BE_LONG, NULL)
14+
ZEND_ARG_TYPE_INFO(1, bind_var, IS_MIXED, 0)
1515
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_LONG, 0, "PDO::PARAM_STR")
16-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, maxlen, IS_LONG, 0, "0")
17-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, driverdata, IS_MIXED, 0, "null")
16+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, max_length, IS_LONG, 0, "0")
17+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, driver_options, IS_MIXED, 0, "null")
1818
ZEND_END_ARG_INFO()
1919

2020
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_bindValue, 0, 0, 2)
21-
ZEND_ARG_TYPE_MASK(0, parameter, MAY_BE_STRING|MAY_BE_LONG, NULL)
21+
ZEND_ARG_TYPE_MASK(0, param, MAY_BE_STRING|MAY_BE_LONG, NULL)
2222
ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0)
2323
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_LONG, 0, "PDO::PARAM_STR")
2424
ZEND_END_ARG_INFO()
@@ -39,31 +39,31 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_execute, 0, 0, 0)
3939
ZEND_END_ARG_INFO()
4040

4141
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_fetch, 0, 0, 0)
42-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, fetch_style, IS_LONG, 0, "PDO::FETCH_BOTH")
42+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "PDO::FETCH_BOTH")
4343
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cursor_orientation, IS_LONG, 0, "PDO::FETCH_ORI_NEXT")
4444
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cursor_offset, IS_LONG, 0, "0")
4545
ZEND_END_ARG_INFO()
4646

4747
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_fetchAll, 0, 0, 0)
48-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, fetch_style, IS_LONG, 0, "PDO::FETCH_BOTH")
49-
ZEND_ARG_VARIADIC_TYPE_INFO(0, fetch_mode_args, IS_MIXED, 0)
48+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "PDO::FETCH_BOTH")
49+
ZEND_ARG_VARIADIC_TYPE_INFO(0, args, IS_MIXED, 0)
5050
ZEND_END_ARG_INFO()
5151

5252
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_fetchColumn, 0, 0, 0)
53-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, column_number, IS_LONG, 0, "0")
53+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, index, IS_LONG, 0, "0")
5454
ZEND_END_ARG_INFO()
5555

5656
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_fetchObject, 0, 0, 0)
57-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, class_name, IS_STRING, 1, "\"stdClass\"")
58-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, ctor_args, IS_ARRAY, 1, "null")
57+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, class, IS_STRING, 1, "\"stdClass\"")
58+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, constructor_args, IS_ARRAY, 1, "null")
5959
ZEND_END_ARG_INFO()
6060

6161
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_getAttribute, 0, 0, 1)
62-
ZEND_ARG_TYPE_INFO(0, attribute, IS_LONG, 0)
62+
ZEND_ARG_TYPE_INFO(0, name, IS_LONG, 0)
6363
ZEND_END_ARG_INFO()
6464

6565
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_getColumnMeta, 0, 0, 1)
66-
ZEND_ARG_TYPE_INFO(0, column, IS_LONG, 0)
66+
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
6767
ZEND_END_ARG_INFO()
6868

6969
#define arginfo_class_PDOStatement_nextRowset arginfo_class_PDOStatement_closeCursor

ext/pdo_mysql/tests/bug_37445.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ $stmt = $db->prepare("SELECT 1");
1717
$stmt->bindParam(':a', 'b');
1818
?>
1919
--EXPECTF--
20-
Fatal error: Uncaught Error: PDOStatement::bindParam(): Argument #2 ($param) cannot be passed by reference in %sbug_37445.php:%d
20+
Fatal error: Uncaught Error: PDOStatement::bindParam(): Argument #2 ($bind_var) cannot be passed by reference in %sbug_37445.php:%d
2121
Stack trace:
2222
#0 {main}
2323
thrown in %sbug_37445.php on line %d

ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ $db = MySQLPDOTest::factory();
344344
$db->exec('DROP TABLE IF EXISTS test');
345345
?>
346346
--EXPECT--
347-
PDO::prepare(): Argument #1 ($statement) cannot be empty
347+
PDO::prepare(): Argument #1 ($query) cannot be empty
348348
array(1) {
349349
[0]=>
350350
array(1) {

ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,5 @@ object(myclass)#%d (4) {
111111
["null"]=>
112112
NULL
113113
}
114-
PDOStatement::fetchObject(): Argument #1 ($class_name) must be a valid class name, class_does_not_exist given
114+
PDOStatement::fetchObject(): Argument #1 ($class) must be a valid class name, class_does_not_exist given
115115
done!

ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,6 @@ $db->exec('DROP TABLE IF EXISTS test');
302302
print "done!";
303303
?>
304304
--EXPECT--
305-
PDOStatement::getColumnMeta(): Argument #1 ($column) must be greater than or equal to 0
305+
PDOStatement::getColumnMeta(): Argument #1 ($index) must be greater than or equal to 0
306306
Testing native PS...
307307
done!

0 commit comments

Comments
 (0)