Changeset View
Changeset View
Standalone View
Standalone View
src/utils/utils.php
| Show First 20 Lines • Show All 870 Lines • ▼ Show 20 Lines | function array_mergev(array $arrayv) { | ||||
| if (!$arrayv) { | if (!$arrayv) { | ||||
| return array(); | return array(); | ||||
| } | } | ||||
| foreach ($arrayv as $key => $item) { | foreach ($arrayv as $key => $item) { | ||||
| if (!is_array($item)) { | if (!is_array($item)) { | ||||
| throw new InvalidArgumentException( | throw new InvalidArgumentException( | ||||
| pht( | pht( | ||||
| 'Expected all items passed to `%s` to be arrays, but '. | 'Expected all items passed to "array_mergev()" to be arrays, but '. | ||||
| 'argument with key "%s" has type "%s".', | 'argument with key "%s" has type "%s".', | ||||
| __FUNCTION__.'()', | |||||
| $key, | $key, | ||||
| gettype($item))); | gettype($item))); | ||||
| } | } | ||||
| } | } | ||||
| // See T13588. In PHP8, "call_user_func_array()" will attempt to use | |||||
| // "unnatural" array keys as named parameters, and then fail because | |||||
| // "array_merge()" does not accept named parameters . Guarantee the list is | |||||
| // a "natural" list to avoid this. | |||||
| $arrayv = array_values($arrayv); | |||||
| return call_user_func_array('array_merge', $arrayv); | return call_user_func_array('array_merge', $arrayv); | ||||
| } | } | ||||
| /** | /** | ||||
| * Split a corpus of text into lines. This function splits on "\n", "\r\n", or | * Split a corpus of text into lines. This function splits on "\n", "\r\n", or | ||||
| * a mixture of any of them. | * a mixture of any of them. | ||||
| * | * | ||||
| ▲ Show 20 Lines • Show All 1,111 Lines • Show Last 20 Lines | |||||