Skip to content

Commit 3ae948a

Browse files
committed
Use #[\SensitiveParameter] attribute instead of @sensitive-param in stubs
1 parent fbe6665 commit 3ae948a

24 files changed

+135
-318
lines changed

ext/ftp/ftp.stub.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ function ftp_connect(string $hostname, int $port = 21, int $timeout = 90): FTP\C
7575
function ftp_ssl_connect(string $hostname, int $port = 21, int $timeout = 90): FTP\Connection|false {}
7676
#endif
7777

78-
/** @sensitive-param $password */
79-
function ftp_login(FTP\Connection $ftp, string $username, string $password): bool {}
78+
function ftp_login(FTP\Connection $ftp, string $username, #[\SensitiveParameter] string $password): bool {}
8079
function ftp_pwd(FTP\Connection $ftp): string|false {}
8180
function ftp_cdup(FTP\Connection $ftp): bool {}
8281
function ftp_chdir(FTP\Connection $ftp, string $directory): bool {}

ext/ftp/ftp_arginfo.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/hash/hash.stub.php

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,19 @@ function hash(string $algo, string $data, bool $binary = false, array $options =
1515
function hash_file(string $algo, string $filename, bool $binary = false, array $options = []): string|false {}
1616

1717
/**
18-
* @sensitive-param $key
1918
* @refcount 1
2019
*/
21-
function hash_hmac(string $algo, string $data, string $key, bool $binary = false): string {}
20+
function hash_hmac(string $algo, string $data, #[\SensitiveParameter] string $key, bool $binary = false): string {}
2221

2322
/**
24-
* @sensitive-param $key
2523
* @refcount 1
2624
*/
27-
function hash_hmac_file(string $algo, string $filename, string $key, bool $binary = false): string|false {}
25+
function hash_hmac_file(string $algo, string $filename, #[\SensitiveParameter] string $key, bool $binary = false): string|false {}
2826

2927
/**
30-
* @sensitive-param $key
3128
* @refcount 1
3229
*/
33-
function hash_init(string $algo, int $flags = 0, string $key = "", array $options = []): HashContext {}
30+
function hash_init(string $algo, int $flags = 0, #[\SensitiveParameter] string $key = "", array $options = []): HashContext {}
3431

3532
function hash_update(HashContext $context, string $data): bool {}
3633

@@ -59,22 +56,16 @@ function hash_algos(): array {}
5956
function hash_hmac_algos(): array {}
6057

6158
/**
62-
* @sensitive-param $password
6359
* @refcount 1
6460
*/
65-
function hash_pbkdf2(string $algo, string $password, string $salt, int $iterations, int $length = 0, bool $binary = false): string {}
61+
function hash_pbkdf2(string $algo, #[\SensitiveParameter] string $password, string $salt, int $iterations, int $length = 0, bool $binary = false): string {}
6662

67-
/**
68-
* @sensitive-param $known_string
69-
* @sensitive-param $user_string
70-
*/
71-
function hash_equals(string $known_string, string $user_string): bool {}
63+
function hash_equals(#[\SensitiveParameter] string $known_string, #[\SensitiveParameter] string $user_string): bool {}
7264

7365
/**
74-
* @sensitive-param $key
7566
* @refcount 1
7667
*/
77-
function hash_hkdf(string $algo, string $key, int $length = 0, string $info = "", string $salt = ""): string {}
68+
function hash_hkdf(string $algo, #[\SensitiveParameter] string $key, int $length = 0, string $info = "", string $salt = ""): string {}
7869

7970
#ifdef PHP_MHASH_BC
8071
/** @deprecated */

ext/hash/hash_arginfo.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/imap/php_imap.stub.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,7 @@
405405
*/
406406
const IMAP_GC_TEXTS = UNKNOWN;
407407

408-
/** @sensitive-param $password */
409-
function imap_open(string $mailbox, string $user, string $password, int $flags = 0, int $retries = 0, array $options = []): IMAP\Connection|false {}
408+
function imap_open(string $mailbox, string $user, #[\SensitiveParameter] string $password, int $flags = 0, int $retries = 0, array $options = []): IMAP\Connection|false {}
410409

411410
function imap_reopen(IMAP\Connection $imap, string $mailbox, int $flags = 0, int $retries = 0): bool {}
412411

ext/imap/php_imap_arginfo.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/ldap/ldap.stub.php

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -610,10 +610,7 @@
610610
#endif
611611

612612
#ifdef HAVE_ORALDAP
613-
/**
614-
* @sensitive-param $password
615-
*/
616-
function ldap_connect(?string $uri = null, int $port = 389, string $wallet = UNKNOWN, string $password = UNKNOWN, int $auth_mode = GSLC_SSL_NO_AUTH): LDAP\Connection|false {}
613+
function ldap_connect(?string $uri = null, int $port = 389, string $wallet = UNKNOWN, #[\SensitiveParameter] string $password = UNKNOWN, int $auth_mode = GSLC_SSL_NO_AUTH): LDAP\Connection|false {}
617614
#else
618615
function ldap_connect(?string $uri = null, int $port = 389): LDAP\Connection|false {}
619616
#endif
@@ -623,21 +620,12 @@ function ldap_unbind(LDAP\Connection $ldap): bool {}
623620
/** @alias ldap_unbind */
624621
function ldap_close(LDAP\Connection $ldap): bool {}
625622

626-
/**
627-
* @sensitive-param $password
628-
*/
629-
function ldap_bind(LDAP\Connection $ldap, ?string $dn = null, ?string $password = null): bool {}
623+
function ldap_bind(LDAP\Connection $ldap, ?string $dn = null, #[\SensitiveParameter] ?string $password = null): bool {}
630624

631-
/**
632-
* @sensitive-param $password
633-
*/
634-
function ldap_bind_ext(LDAP\Connection $ldap, ?string $dn = null, ?string $password = null, ?array $controls = null): LDAP\Result|false {}
625+
function ldap_bind_ext(LDAP\Connection $ldap, ?string $dn = null, #[\SensitiveParameter] ?string $password = null, ?array $controls = null): LDAP\Result|false {}
635626

636627
#ifdef HAVE_LDAP_SASL
637-
/**
638-
* @sensitive-param $password
639-
*/
640-
function ldap_sasl_bind(LDAP\Connection $ldap, ?string $dn = null, ?string $password = null, ?string $mech = null, ?string $realm = null, ?string $authc_id = null, ?string $authz_id = null, ?string $props = null): bool {}
628+
function ldap_sasl_bind(LDAP\Connection $ldap, ?string $dn = null, #[\SensitiveParameter] ?string $password = null, ?string $mech = null, ?string $realm = null, ?string $authc_id = null, ?string $authz_id = null, ?string $props = null): bool {}
641629
#endif
642630

643631
/** @param LDAP\Connection|array $ldap */
@@ -791,10 +779,8 @@ function ldap_exop(LDAP\Connection $ldap, string $request_oid, ?string $request_
791779
#ifdef HAVE_LDAP_PASSWD
792780
/**
793781
* @param array $controls
794-
* @sensitive-param $old_password
795-
* @sensitive-param $new_password
796782
*/
797-
function ldap_exop_passwd(LDAP\Connection $ldap, string $user = "", string $old_password = "", string $new_password = "", &$controls = null): string|bool {}
783+
function ldap_exop_passwd(LDAP\Connection $ldap, string $user = "", #[\SensitiveParameter] string $old_password = "", #[\SensitiveParameter] string $new_password = "", &$controls = null): string|bool {}
798784
#endif
799785

800786

ext/ldap/ldap_arginfo.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/mysqli/mysqli.stub.php

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,10 @@ class mysqli
126126
*/
127127
public int $warning_count;
128128

129-
/** @sensitive-param $password */
130129
public function __construct(
131130
?string $hostname = null,
132131
?string $username = null,
133-
?string $password = null,
132+
#[\SensitiveParameter] ?string $password = null,
134133
?string $database = null,
135134
?int $port = null,
136135
?string $socket = null
@@ -149,11 +148,10 @@ public function autocommit(bool $enable): bool {}
149148
public function begin_transaction(int $flags = 0, ?string $name = null): bool {}
150149

151150
/**
152-
* @sensitive-param $password
153151
* @tentative-return-type
154152
* @alias mysqli_change_user
155153
*/
156-
public function change_user(string $username, string $password, ?string $database): bool {}
154+
public function change_user(string $username, #[\SensitiveParameter] string $password, ?string $database): bool {}
157155

158156
/**
159157
* @tentative-return-type
@@ -175,15 +173,14 @@ public function close() {} // TODO make return type void
175173
public function commit(int $flags = 0, ?string $name = null): bool {}
176174

177175
/**
178-
* @sensitive-param $password
179176
* @tentative-return-type
180177
* @alias mysqli_connect
181178
* @no-verify
182179
*/
183180
public function connect(
184181
?string $hostname = null,
185182
?string $username = null,
186-
?string $password = null,
183+
#[\SensitiveParameter] ?string $password = null,
187184
?string $database = null,
188185
?int $port = null,
189186
?string $socket = null
@@ -289,14 +286,13 @@ public function prepare(string $query): mysqli_stmt|false {}
289286
public function query(string $query, int $result_mode = MYSQLI_STORE_RESULT): mysqli_result|bool {}
290287

291288
/**
292-
* @sensitive-param $password
293289
* @tentative-return-type
294290
* @alias mysqli_real_connect
295291
*/
296292
public function real_connect(
297293
?string $hostname = null,
298294
?string $username = null,
299-
?string $password = null,
295+
#[\SensitiveParameter] ?string $password = null,
300296
?string $database = null,
301297
?int $port = null,
302298
?string $socket = null,
@@ -743,8 +739,7 @@ function mysqli_autocommit(mysqli $mysql, bool $enable): bool {}
743739

744740
function mysqli_begin_transaction(mysqli $mysql, int $flags = 0, ?string $name = null): bool {}
745741

746-
/** @sensitive-param $password */
747-
function mysqli_change_user(mysqli $mysql, string $username, string $password, ?string $database): bool {}
742+
function mysqli_change_user(mysqli $mysql, string $username, #[\SensitiveParameter] string $password, ?string $database): bool {}
748743

749744
/** @refcount 1 */
750745
function mysqli_character_set_name(mysqli $mysql): string {}
@@ -755,12 +750,11 @@ function mysqli_commit(mysqli $mysql, int $flags = 0, ?string $name = null): boo
755750

756751
/**
757752
* @refcount 1
758-
* @sensitive-param $password
759753
*/
760754
function mysqli_connect(
761755
?string $hostname = null,
762756
?string $username = null,
763-
?string $password = null,
757+
#[\SensitiveParameter] ?string $password = null,
764758
?string $database = null,
765759
?int $port = null,
766760
?string $socket = null
@@ -930,11 +924,11 @@ function mysqli_report(int $flags): bool {}
930924
/** @refcount 1 */
931925
function mysqli_query(mysqli $mysql, string $query, int $result_mode = MYSQLI_STORE_RESULT): mysqli_result|bool {}
932926

933-
/** @sensitive-param $password */
934927
function mysqli_real_connect(
935928
mysqli $mysql,
936929
?string $hostname = null,
937930
?string $username = null,
931+
#[\SensitiveParameter]
938932
?string $password = null,
939933
?string $database = null,
940934
?int $port = null,

ext/mysqli/mysqli_arginfo.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/oci8/oci8.stub.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -295,46 +295,40 @@ function oci_close($connection): ?bool {}
295295
function ocilogoff($connection): ?bool {}
296296

297297
/**
298-
* @sensitive-param $password
299298
* @return resource|false
300299
*/
301-
function oci_new_connect(string $username, string $password, ?string $connection_string = null, string $encoding = "", int $session_mode = OCI_DEFAULT) {}
300+
function oci_new_connect(string $username, #[\SensitiveParameter] string $password, ?string $connection_string = null, string $encoding = "", int $session_mode = OCI_DEFAULT) {}
302301

303302
/**
304-
* @sensitive-param $password
305303
* @return resource|false
306304
* @alias oci_new_connect
307305
* @deprecated
308306
*/
309-
function ocinlogon(string $username, string $password, ?string $connection_string = null, string $encoding = "", int $session_mode = OCI_DEFAULT) {}
307+
function ocinlogon(string $username, #[\SensitiveParameter] string $password, ?string $connection_string = null, string $encoding = "", int $session_mode = OCI_DEFAULT) {}
310308

311309
/**
312-
* @sensitive-param $password
313310
* @return resource|false
314311
*/
315-
function oci_connect(string $username, string $password, ?string $connection_string = null, string $encoding = "", int $session_mode = OCI_DEFAULT) {}
312+
function oci_connect(string $username, #[\SensitiveParameter] string $password, ?string $connection_string = null, string $encoding = "", int $session_mode = OCI_DEFAULT) {}
316313

317314
/**
318-
* @sensitive-param $password
319315
* @return resource|false
320316
* @alias oci_connect
321317
* @deprecated
322318
*/
323-
function ocilogon(string $username, string $password, ?string $connection_string = null, string $encoding = "", int $session_mode = OCI_DEFAULT) {}
319+
function ocilogon(string $username, #[\SensitiveParameter] string $password, ?string $connection_string = null, string $encoding = "", int $session_mode = OCI_DEFAULT) {}
324320

325321
/**
326-
* @sensitive-param $password
327322
* @return resource|false
328323
*/
329-
function oci_pconnect(string $username, string $password, ?string $connection_string = null, string $encoding = "", int $session_mode = OCI_DEFAULT) {}
324+
function oci_pconnect(string $username, #[\SensitiveParameter] string $password, ?string $connection_string = null, string $encoding = "", int $session_mode = OCI_DEFAULT) {}
330325

331326
/**
332-
* @sensitive-param $password
333327
* @return resource|false
334328
* @alias oci_pconnect
335329
* @deprecated
336330
*/
337-
function ociplogon(string $username, string $password, ?string $connection_string = null, string $encoding = "", int $session_mode = OCI_DEFAULT) {}
331+
function ociplogon(string $username, #[\SensitiveParameter] string $password, ?string $connection_string = null, string $encoding = "", int $session_mode = OCI_DEFAULT) {}
338332

339333
/**
340334
* @param resource|null $connection_or_statement

ext/oci8/oci8_arginfo.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/odbc/odbc.stub.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,14 @@ function odbc_result_all($statement, string $format = ""): int|false {}
7070
function odbc_free_result($statement): bool {}
7171

7272
/**
73-
* @sensitive-param $password
7473
* @return resource|false
7574
*/
76-
function odbc_connect(string $dsn, string $user, string $password, int $cursor_option = SQL_CUR_USE_DRIVER) {}
75+
function odbc_connect(string $dsn, string $user, #[\SensitiveParameter] string $password, int $cursor_option = SQL_CUR_USE_DRIVER) {}
7776

7877
/**
79-
* @sensitive-param $password
8078
* @return resource|false
8179
*/
82-
function odbc_pconnect(string $dsn, string $user, string $password, int $cursor_option = SQL_CUR_USE_DRIVER) {}
80+
function odbc_pconnect(string $dsn, string $user, #[\SensitiveParameter] string $password, int $cursor_option = SQL_CUR_USE_DRIVER) {}
8381

8482
/** @param resource $odbc */
8583
function odbc_close($odbc): void {}

ext/odbc/odbc_arginfo.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)