Skip to content

Conversation

@zonuexe
Copy link
Contributor

@zonuexe zonuexe commented Oct 26, 2023

No description provided.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function always returns non-empty-list and neither '0' nor ''. https://www.php.net/manual/en/function.hash-algos.php

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function always returns non-empty-list and neither '0' nor ''.
https://www.php.net/manual/en/function.hash-hmac-algos.php

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MD5 and SHA1 are fixed lengths, so they will never return either '0' or ''.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function sets only 0 and 1 in the variable by reference.

https://github.com/php/php-src/blob/php-8.2.5/ext/standard/file.c#L212-L221

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$length = 0 means the default length, so an empty string will never be returned.

https://www.php.net/manual/en/function.hash-hkdf.php

@ondrejmirtes
Copy link
Member

Hi, this looks good but I can't merge it because some tests are still failing.

@zonuexe
Copy link
Contributor Author

zonuexe commented Oct 31, 2023

Sorry, I'll fix it tonight (UTC+9).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do this kind of changes actually bring any value at all? I feel like it's counterproductive and might lead to possible mistakes if something is overlooked (i.e. are we 100% sure there can be no falsy string in that list, ever under all circumstances and system setups?).

'session_is_registered' => ['bool', 'name'=>'string'],
'session_module_name' => ['string|false', 'newname='=>'string'],
'session_name' => ['string|false', 'newname='=>'string'],
'session_name' => ['non-falsy-string|false', 'newname='=>'string'],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'session_encode' => ['string|false'],
'session_gc' => ['int|false'],
'session_get_cookie_params' => ['array'],
'session_get_cookie_params' => ['array{lifetime:0|positive-int,path:non-falsy-string,domain:string,secure:bool,httponly:bool,samesite:string}'],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zonuexe
Copy link
Contributor Author

zonuexe commented Nov 6, 2023

@ondrejmirtes Sorry to keep you waiting, I've pushed the fix.

@ondrejmirtes ondrejmirtes merged commit c86d4af into phpstan:1.10.x Nov 9, 2023
@ondrejmirtes
Copy link
Member

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants