Issue Bug Closed

#52045Warning in extensionmanager if constraints are not an array

Kay Strobach 09/16/13, 17:15 updated 10/02/18, 12:10

Description

Warning: array_keys() expects parameter 1 to be array, string given in /mnt/hgfs/!%serverData/www/t3-sources/typo3_src-4.5.27/typo3/sysext/em/classes/tools/class.tx_em_tools.php on line 397 Warning: implode(): Invalid arguments passed in /mnt/hgfs/!%serverData/www/t3-sources/typo3_src-4.5.27/typo3/sysext/em/classes/tools/class.tx_em_tools.php on line 397

-> Solution:

    /**
     * Checks whether the passed dependency is TER2-style (array) and returns a single string for displaying the dependencies.
     *
     * It leaves out all version numbers and the "php" and "typo3" dependencies, as they are implicit and of no interest without the version number.
     *
     * @param    mixed        $dep Either a string or an array listing dependencies.
     * @param    string        $type The dependency type to list if $dep is an array
     * @return    string        A simple dependency list for display
     */
    public static function depToString($dep, $type = 'depends') {
        if (is_array($dep)) {
            if (isset($dep[$type]['php'])) {
                unset($dep[$type]['php']);
            }
            if (isset($dep[$type]['typo3'])) {
                unset($dep[$type]['typo3']);
            }
            if(is_array($dep[$type])) {
                $s = (count($dep[$type])) ? implode(',', array_keys($dep[$type])) : '';
                return $s;
            }
        }
        return '';
    }

-> if is_array added
-> please make a patch and send it for review to 4.5

Reviews 5