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

Set correct serialize_precision for most PHP versions #5092

Closed
1 task done
Kent-N opened this issue Jul 6, 2023 · 5 comments
Closed
1 task done

Set correct serialize_precision for most PHP versions #5092

Kent-N opened this issue Jul 6, 2023 · 5 comments
Milestone

Comments

@Kent-N
Copy link

Kent-N commented Jul 6, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem?

I recently encountered an issue with an ini setting that wasn't set to the expected default for that PHP version. After digging a bit more and talking to @rfay on Discord, the conclusion was that the default config(s) probably haven't been updated for a long time.

Specifically it was the ini "serialize_precision" on PHP 8.0.24, that should default to "-1" from 7.1.0 onwards. DDEV sets that to 17 by default. https://www.php.net/manual/en/ini.core.php

A lot of subtle unexpected behavior can occur, if your production environment uses the current defaults while your local dev with DDEV has outdated settings.

Describe your solution

The solution would be to go through all the configs and updated them to the latest defaults.

Maybe there is a way to automatically pull the defaults from the PHP repo? For example parsing https://github.com/php/php-src/blob/PHP-8.0.24/php.ini-production to generate the config file for 8.0.24 in DDEV.

Describe alternatives

No response

Additional context

No response

@rfay
Copy link
Member

rfay commented Jul 6, 2023

We should probably use the default configs for every PHP version, the ones created by the package install.

@rfay rfay added this to the v1.23 milestone Jul 6, 2023
@rfay rfay changed the title Update php.ini defaults Update php.ini defaults for each PHP version supported Jul 6, 2023
@hanoii
Copy link
Collaborator

hanoii commented Jul 28, 2023

I just stumbled upon a super odd floating point precision issue that shouldn't really be there:

# php -r "var_dump(0.6);"
float(0.59999999999999998)

In talking with @rfay on Discord he pointed me to this issue.

Adding a .ddev/php/fix.ini

witdh

serialize_precision=-1

Fixed it

# php -r "var_dump(0.6);"
float(0.6)

I agree that we should use the defaults, the only thing I might set n top of the defaults no memory limit and a biggish post_max_size as it is now and maybe increase most other limits normally increased for local dev.

ddev v1.22

and

PHP 8.1.21 (cli) (built: Jul 16 2023 11:00:45) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.21, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.21, Copyright (c), by Zend Technologies

@hanoii
Copy link
Collaborator

hanoii commented Jul 28, 2023

I'd say this one is overall pretty critical

@rfay
Copy link
Member

rfay commented Jul 31, 2023

I think the right answer is to remove most of the overrides for most versions of PHP, and use the defaults for that version. Not exactly sure why we added overrides way back in the day.

@rfay rfay changed the title Update php.ini defaults for each PHP version supported Set correct serialize_precision for most PHP versions Aug 2, 2023
@rfay
Copy link
Member

rfay commented Aug 2, 2023

My initial aim here was to update all config to be based on the defaults, #5219 , but I'm going to abandon that and just use the original scope in this issue "Set correct serialize_precision for most PHP versions". The risks in #5219 were just too great.

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

No branches or pull requests

3 participants