Skip to content

Commit 8efc6f1

Browse files
Fix session_set_cookie_params signature
1 parent 9dbff97 commit 8efc6f1

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

resources/functionMap.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9750,8 +9750,8 @@
97509750
'session_register_shutdown' => ['void'],
97519751
'session_reset' => ['bool'],
97529752
'session_save_path' => ['string|false', 'newname='=>'string'],
9753-
'session_set_cookie_params' => ['bool', 'lifetime'=>'int', 'path='=>'string', 'domain='=>'?string', 'secure='=>'bool', 'httponly='=>'bool'],
9754-
'session_set_cookie_params\'1' => ['bool', 'options'=>'array{lifetime?:int,path?:string,domain?:?string,secure?:bool,httponly?:bool,samesite?:\'None\'|\'Lax\'|\'Strict\'|\'none\'|\'lax\'|\'strict\'}'],
9753+
'session_set_cookie_params' => ['bool', 'lifetime'=>'int', 'path='=>'string', 'domain='=>'string', 'secure='=>'bool', 'httponly='=>'bool'],
9754+
'session_set_cookie_params\'1' => ['bool', 'options'=>'array{lifetime?:int,path?:string,domain?:string,secure?:bool,httponly?:bool,samesite?:\'None\'|\'Lax\'|\'Strict\'|\'none\'|\'lax\'|\'strict\'}'],
97559755
'session_set_save_handler' => ['bool', 'open'=>'callable(string,string):bool', 'close'=>'callable():bool', 'read'=>'callable(string):string', 'write'=>'callable(string,string):bool', 'destroy'=>'callable(string):bool', 'gc'=>'callable(string):bool', 'create_sid='=>'callable():string', 'validate_sid='=>'callable(string):bool', 'update_timestamp='=>'callable(string):bool'],
97569756
'session_set_save_handler\'1' => ['bool', 'sessionhandler'=>'SessionHandlerInterface', 'register_shutdown='=>'bool'],
97579757
'session_start' => ['bool', 'options='=>'array'],

resources/functionMap_php80delta.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@
104104
'preg_match_all' => ['0|positive-int|false', 'pattern'=>'string', 'subject'=>'string', '&w_subpatterns='=>'array', 'flags='=>'int', 'offset='=>'int'],
105105
'proc_get_status' => ['array{command: string, pid: int, running: bool, signaled: bool, stopped: bool, exitcode: int, termsig: int, stopsig: int}', 'process'=>'resource'],
106106
'scandir' => ['__benevolent<list<string>|false>', 'dir'=>'string', 'sorting_order='=>'SCANDIR_SORT_ASCENDING|SCANDIR_SORT_DESCENDING|SCANDIR_SORT_NONE', 'context='=>'?resource'],
107+
'session_set_cookie_params' => ['bool', 'lifetime'=>'int', 'path='=>'string|null', 'domain='=>'string|null', 'secure='=>'bool|null', 'httponly='=>'bool|null'],
108+
'session_set_cookie_params\'1' => ['bool', 'options'=>'array{lifetime?:int,path?:string|null,domain?:string|null,secure?:bool|null,httponly?:bool|null,samesite?:\'None\'|\'Lax\'|\'Strict\'|\'none\'|\'lax\'|\'strict\'}'],
107109
'set_error_handler' => ['?callable', 'callback'=>'null|callable(int,string,string,int):bool', 'error_types='=>'int'],
108110
'socket_addrinfo_lookup' => ['AddressInfo[]', 'node'=>'string', 'service='=>'mixed', 'hints='=>'array'],
109111
'socket_select' => ['int|false', '&w_read'=>'Socket[]|null', '&w_write'=>'Socket[]|null', '&w_except'=>'Socket[]|null', 'seconds'=>'int|null', 'microseconds='=>'int'],
@@ -250,6 +252,8 @@
250252
'read_exif_data' => ['array', 'filename'=>'string', 'sections_needed='=>'string', 'sub_arrays='=>'bool', 'read_thumbnail='=>'bool'],
251253
'restore_include_path' => ['void'],
252254
'round' => ['__benevolent<float|false>', 'number'=>'float', 'precision='=>'int', 'mode='=>'1|2|3|4'],
255+
'session_set_cookie_params' => ['bool', 'lifetime'=>'int', 'path='=>'string', 'domain='=>'string', 'secure='=>'bool', 'httponly='=>'bool'],
256+
'session_set_cookie_params\'1' => ['bool', 'options'=>'array{lifetime?:int,path?:string,domain?:string,secure?:bool,httponly?:bool,samesite?:\'None\'|\'Lax\'|\'Strict\'|\'none\'|\'lax\'|\'strict\'}'],
253257
'socket_select' => ['int|false', '&w_read_fds'=>'resource[]|null', '&w_write_fds'=>'resource[]|null', '&w_except_fds'=>'resource[]|null', 'tv_sec'=>'int|null', 'tv_usec='=>'int|null'],
254258
'sodium_crypto_aead_chacha20poly1305_ietf_decrypt' => ['?string|?false', 'confidential_message'=>'string', 'public_message'=>'string', 'nonce'=>'string', 'key'=>'string'],
255259
'SplFileObject::fgetss' => ['string|false', 'allowable_tags='=>'string'],

tests/PHPStan/Rules/Functions/CallToFunctionParametersRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2179,6 +2179,11 @@ public function testBug8506(): void
21792179
$this->analyse([__DIR__ . '/data/bug-8506.php'], []);
21802180
}
21812181

2182+
public function testBug7772(): void
2183+
{
2184+
$this->analyse([__DIR__ . '/data/bug-7772.php'], []);
2185+
}
2186+
21822187
public function testBug13065(): void
21832188
{
21842189
$errors = [];
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Bug7772;
4+
5+
function session_start(
6+
int $lifetime,
7+
?string $path = null,
8+
?string $domain = null,
9+
?bool $secure = null,
10+
?bool $httponly = true
11+
): void {
12+
\session_set_cookie_params($lifetime, $path, $domain, $secure, $httponly);
13+
\session_start();
14+
}

0 commit comments

Comments
 (0)