php-git-deploy icon indicating copy to clipboard operation
php-git-deploy copied to clipboard

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

Open SagePtr opened this issue 6 years ago • 0 comments

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.

SagePtr avatar Mar 26 '19 16:03 SagePtr