Repository navigation
ini_get() of a core setting no longer includes false - #14809
Merged
alies-dev merged 3 commits intoNov 24, 2026
Merged
Conversation
ini_get() returns false only for a setting nothing has registered, so
the call map's false|string made code like
`$limit ??= ini_get('memory_limit')` report PossiblyFalse* issues.
Same settings PHPStan's IniGetReturnTypeExtension narrows.
Contributor
✅ Performance: unchanged · Types: decreased
How to read this table
✅ laravel: issues +1 −2Memory 1 747 → 1 747 MB (+0.0 %) · Wall 59.7 → 59.2 s (−0.7 %) Weighted 53 055 → 53 052 (−3, −0.01 %): L3 −1
Changed in place (1) @@ src/Illuminate/Queue/Worker.php:1087 @@
- ArgumentTypeCoercion: Argument 1 of ini_parse_quantity expects non-empty-string, but parent type false|string provided
- PossiblyFalseArgument: Argument 1 of ini_parse_quantity cannot be false, possibly non-empty-string value expected
+ ArgumentTypeCoercion: Argument 1 of ini_parse_quantity expects non-empty-string, but parent type string provided✅ symfony: issues +0 −1Memory 3 619 → 3 619 MB (+0.0 %) · Wall 212.9 → 219.0 s (+2.9 %) Weighted 100 490 → 100 487 (−3, <0.01 %): L3 −1
Removed (1)
✅ drupal: issues +1 −4Memory 4 767 → 4 767 MB (<0.1 %) · Wall 166.9 → 155.5 s (−6.8 %) Weighted 169 282 → 169 274 (−8, <0.01 %): L2 −1 · L3 −2
Changed in place (1) @@ core/modules/migrate_drupal_ui/src/Batch/MigrateUpgradeImportBatch.php:87 InvalidPropertyAssignmentValue @@
- …declared type 'int' cannot be assigned type 'false|string'
+ …declared type 'int' cannot be assigned type 'string'Removed (3)
✅ wordpress: issues +3 −7Memory 2 012 → 2 012 MB (<0.1 %) · Wall 126.9 → 119.1 s (−6.1 %) Weighted 678 369 → 678 358 (−11, <0.01 %): L2 −1 · L3 −3
Changed in place (3) @@ src/wp-admin/includes/class-wp-site-health.php:23 MissingPropertyType @@
- …does not have a declared type - consider false|string
+ …does not have a declared type - consider string
@@ src/wp-includes/ID3/getid3.php:417 PossiblyInvalidPropertyAssignmentValue @@
- …cannot be assigned possibly different type 'false|float|int|string'
+ …cannot be assigned possibly different type 'float|int|string'
@@ src/wp-includes/functions.php:8778 PossiblyInvalidArgument @@
- …expects int|null, but possibly different type false|float|int|string provided
+ …expects int|null, but possibly different type float|int|string providedRemoved (4)
head 76427d6 · base 90dd884 (merge-base) · workflow run |
ini_get() of a core setting no longer includes false
ini_get() returns the raw INI text, so ini_set('max_execution_time', '30s') or php -d max_input_time=30s leave a non-numeric value behind.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Psalm reports
PossiblyFalsePropertyAssignmentValue,FalsableReturnStatementandInvalidFalsableReturnType, because the call map typesini_get()asfalse|stringfor any setting. It returnsfalseonly for a setting nothing has registered, andmemory_limitis always registered. PHPStan already knows this (IniGetReturnTypeExtension), so the usual workarounds conflict: a=== falsecheck or a(string)cast satisfies Psalm, but PHPStan reports it as always false or as a useless cast.Solution
ini_get()of a literal core setting now returnsstring, so the example above has no issues. The settings are the ones PHPStan narrows:date.timezone,default_socket_timeout,max_execution_time,max_input_time,memory_limitandprecision, plusmax_memory_limitwhen analysing for PHP 8.5+. Any other setting, or a non-literal argument, keepsfalse|string.Unlike PHPStan, the numeric settings are not
numeric-string:ini_get()returns the raw INI text, so afterini_set('max_execution_time', '30s')orphp -d max_input_time=30sit returns"30s".The two
(string) ini_get('memory_limit')casts in Psalm's own code became redundant and are removed.