cast(): fix strpos(): Passing null to parameter #1 () of type string is deprecated
This commit is contained in:
parent
e9fb4cf504
commit
88b22ca22b
1 changed files with 4 additions and 4 deletions
|
@ -91,15 +91,15 @@ function ensure_is_array($value) {
|
|||
* Get a specific configuration variable value
|
||||
*
|
||||
* @param mixed $value The value to cast
|
||||
* @param string $type The type of expected value. The configuration variable
|
||||
* value will be cast as this type. Could be : bool, int,
|
||||
* float or string.
|
||||
* @param string|null $type The type of expected value. The configuration variable
|
||||
* value will be cast as this type. Could be : bool, int,
|
||||
* float or string.
|
||||
* @param bool $split If true, $type=='array' and $value is a string, split
|
||||
* the value by comma (optional, default: false)
|
||||
* @return mixed The cast value
|
||||
**/
|
||||
function cast($value, $type, $split=false) {
|
||||
if (strpos($type, 'array_of_') === 0) {
|
||||
if (is_string($type) && strpos($type, 'array_of_') === 0) {
|
||||
$type = substr($type, 9);
|
||||
$values = array();
|
||||
foreach(ensure_is_array($value) as $key => $value)
|
||||
|
|
Loading…
Reference in a new issue