Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive: ini_set error when value is not string #4806

Closed
mdeweerd opened this issue Sep 27, 2023 · 0 comments
Closed

False positive: ini_set error when value is not string #4806

mdeweerd opened this issue Sep 27, 2023 · 0 comments

Comments

@mdeweerd
Copy link

According to the PHP documentation, ini_set allows simple types for the $value argument:
https://www.php.net/manual/en/function.ini-set.php

But phan complains when the value is a float for instance.

Phan 5.4.2
php-ast version 1.0.16
PHP version used to run Phan: 8.1.13

Test file:

<?php
ini_set("A","1");
ini_set("B",1);
ini_set("C",1.0);
ini_set("D",true);
ini_set("E",false);
ini_set("F",null);
tests\test_iniset.txt:3 PhanTypeMismatchArgumentInternal Argument 2 ($value) is 1 of type 1 but \ini_set() takes string
tests\test_iniset.txt:4 PhanTypeMismatchArgumentInternal Argument 2 ($value) is 1.0 of type 1.0 but \ini_set() takes string
tests\test_iniset.txt:5 PhanTypeMismatchArgumentInternal Argument 2 ($value) is true of type true but \ini_set() takes string
tests\test_iniset.txt:6 PhanTypeMismatchArgumentInternal Argument 2 ($value) is false of type false but \ini_set() takes string
tests\test_iniset.txt:7 PhanTypeMismatchArgumentInternalProbablyReal Argument 2 ($value) is null of type null but \ini_set() takes string
tests\test_staticassumednull.txt:10 PhanTypeMismatchProperty Assigning static::T of type null to property but \test_sc_A->type is int
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant