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

Allow multiple array formats in config in addition to serialize(array()) #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SagePtr
Copy link
Contributor

@SagePtr SagePtr commented Mar 26, 2019

This change allows to use multiple array formats in config file.

Previously, the only one notation was this:
define('OPTION', serialize(array('value1', 'value2', 'value3')));
Now it's allowed to also define array directly (PHP 7.0+):
define('OPTION', ['value1', 'value2', 'value3']);
Or use JSON notation:
define('OPTION', "['value1', 'value2', 'value3']");
Or use comma-separated list:
define('OPTION', 'value1, value2, value3');
Or if array has the only one value, use it directly (if it doesn't contain comma):
define('OPTION', 'value');

Empty string is automatically converted to empty array:
define('OPTION', '');

Serialize(array()) is also allowed and checked first (if string is passed), so backward compatibility with older configs isn't broken.

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.

1 participant