Skip to content

Allow all scalar types in ini_set() #6680

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

Closed
wants to merge 1 commit into from
Closed

Conversation

nikic
Copy link
Member

@nikic nikic commented Feb 11, 2021

This changes ini_set() to accept all scalar types (string|int|float|bool|null) for the new value. The idea here is that while the INI system ultimately works with strings, its value interpretation is designed to be consistent with PHP's casting rules, e.g. "1" and "" are interpreted as boolean true and false respectively.

I personally believe that writing ini_set('precision', 10) makes more sense than ini_set('precision', '10'), and find strict_types to be unnecessarily pedantic here.

@nikic
Copy link
Member Author

nikic commented Feb 11, 2021

@kocsismate @Girgias @cmb69 Any thoughts on this?

This is partially motivated by #6475, which will bring the null case to strict_types=0 as well.

@cmb69
Copy link
Member

cmb69 commented Feb 11, 2021

Makes sense to me.

@kocsismate
Copy link
Member

Yes, I also find it a reasonable change.

Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

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

Looks sensible to me

var_dump(ini_get('html_errors'));
ini_set('precision', 6);
var_dump(ini_get('precision'));
// Are there any float options?
Copy link
Member

Choose a reason for hiding this comment

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

"opcache.jit_prof_threshold" and "session.upload_progress.min_freq" seem to be the only ones looking at https://heap.space/s?refs=OnUpdateReal&project=php-src

Copy link
Member Author

Choose a reason for hiding this comment

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

Heh, I search for OnUpdateDouble and OnUpdatFloat ... didn't expect it to be called OnUpdateReal!

Copy link
Member Author

Choose a reason for hiding this comment

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

Both are part of optional exts and session.upload_progress.min_freq is PERDIR :/

@php-pulls php-pulls closed this in 070e24d Feb 11, 2021
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

Successfully merging this pull request may close these issues.

4 participants