Issue Bug Closed

#466114.5 EM crashes, if ext_emconf entry is string instead of array

Kay Strobach 03/23/13, 21:17 updated 07/30/13, 23:02

Description

prerequisites:

switch to old em in 4.5

install browser_manuel_en or any other extension which has:

$EM_CONF[$_EXTKEY] = array (
    'title' => 'Browser Manual (en)',
    'description' => 'Browser - TYPO3 without PHP - the manual. Develop your TYPO3 extensions eight times faster!',
    'category' => 'doc',
    'shy' => 0,
    'version' => '4.4.3',
    'dependencies' => '',
    'conflicts' => '',
    'priority' => '',
    'loadOrder' => '',
    'module' => '',
    'state' => 'stable',
    'uploadfolder' => 0,
    'createDirs' => '',
    'modify_tables' => '',
    'clearcacheonload' => 0,
    'lockType' => '',
    'author' => 'Dirk Wildt - Die Netzmacher',
    'author_email' => 'http://wildt.at.die-netzmacher.de',
    'author_company' => '',
    'CGLcompliance' => NULL,
    'CGLcompliance_note' => NULL,
    'constraints' => 
    array (
        'depends' => 
        array (
        ),
        'conflicts' => '',
        'suggests' => 
        array (
        ),
    ),
);

the last conflicts key is assumed to be an array and throws and exception.
Use the following changed function tx_em_Tools::depToString

    /**
     * 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(is_array($dep[$type])) {
                unset($dep[$type]['php']);
                unset($dep[$type]['typo3']);
            }
            $s = (count($dep[$type])) ? implode(',', array_keys($dep[$type])) : '';
            return $s;
        }
        return '';
    }

Should be a no brainer, please push it o gerrit and review it.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.