Project

General

Profile

Actions

Bug #46611

closed

4.5 EM crashes, if ext_emconf entry is string instead of array

Added by Kay Strobach over 11 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Extension Manager
Target version:
-
Start date:
2013-03-23
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
5.4
Tags:
Complexity:
Is Regression:
Sprint Focus:

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.


Related issues 1 (0 open1 closed)

Is duplicate of TYPO3 Core - Bug #46642: Fatal error: Cannot unset string offsets in typo3/sysext/em/classes/tools/class.tx_em_tools.php on line 382ClosedMichael Stucki2013-03-25

Actions
Actions #1

Updated by Oliver Hader over 11 years ago

  • Target version set to 2222
Actions #2

Updated by Oliver Hader over 11 years ago

  • Project changed from 2269 to TYPO3 Core
Actions #3

Updated by Oliver Hader over 11 years ago

  • Category set to Extension Manager
Actions #4

Updated by Oliver Hader over 11 years ago

  • Target version deleted (2222)
Actions #5

Updated by Franz Holzinger over 11 years ago

The same blocker of the EM in TYPO3 4.7.7. Nothing goes any more with the EM:

Fatal error: Cannot unset string offsets in /var/www/html/demo-franz/typo3_src-4.7.7/typo3/sysext/em/classes/tools/class.tx_em_tools.php on line 382

Here the backtrace and the parameters debugged:

________
[11-Apr-2013 06:39:16 Europe/Berlin] depToString $dep: Array
(
[depends] => Array
(
[php] => 4.1.2-6.0.2
[typo3] => 3.6.2-0.0.0
)

[conflicts] => 
[suggests] => Array
(
)

)

[11-Apr-2013 06:39:16 Europe/Berlin] depToString $type: conflicts
[11-Apr-2013 06:39:16 Europe/Berlin] Backtrace: Array
(
[0] => Array
(
[file] => ajax.php
[line] => 73
[function] => callUserFunction
)

[1] => Array
(
[file] => class.t3lib_div.php
[line] => 4664
[function] => call_user_func_array
)
[2] => Array
(
[file] =>
[line] =>
[function] => route
)
[3] => Array
(
[file] => class.t3lib_extjs_extdirectrouter.php
[line] => 106
[function] => processRpc
)
[4] => Array
(
[file] => class.t3lib_extjs_extdirectrouter.php
[line] => 183
[function] => call_user_func_array
)
[5] => Array
(
[file] =>
[line] =>
[function] => getExtensionList
)
[6] => Array
(
[file] => class.tx_em_connection_extdirectserver.php
[line] => 116
[function] => getInstalledExtensions
)
[7] => Array
(
[file] => class.tx_em_extensions_list.php
[line] => 94
[function] => getFlatInstExtList
)
[8] => Array
(
[file] => class.tx_em_extensions_list.php
[line] => 168
[function] => singleExtInfo
)
[9] => Array
(
[file] => class.tx_em_extensions_list.php
[line] => 187
[function] => includeEMCONF
)
[10] => Array
(
[file] => class.tx_em_tools.php
[line] => 312
[function] => fixEMCONF
)
[11] => Array
(
[file] => class.tx_em_tools.php
[line] => 267
[function] => depToString
)
[12] => Array
(
[file] => class.tx_em_tools.php
[line] => 384
[function] => getTraceArray
)

)
--------------------------------

/**
 * 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)) {
error_log ('depToString $dep: ' . print_r($dep, TRUE));
error_log ('depToString $type: ' . $type);
error_log ('Backtrace: ' . print_r(tx_fhdebug::getTraceArray(), TRUE));
unset($dep[$type]['php']);
unset($dep[$type]['typo3']);
$s = (count($dep[$type])) ? implode(',', array_keys($dep[$type])) : '';
return $s;
}
return '';
}
Actions #6

Updated by Franz Holzinger over 11 years ago

Check your installations of irfaq!

The file ext_emconf.php contains the line:

'conflicts' => '',

This must be set to an array.

array (
'depends' =>
array (
'php' => '4.1.2-6.0.2',
'typo3' => '3.6.2-0.0.0',
),
'conflicts' => array(),
'suggests' =>
array (
),
),
Actions #7

Updated by Kay Strobach over 11 years ago

as i added the patch above it would be nice, if one could push it to gerrit ;)

Actions #8

Updated by Chris topher over 11 years ago

Hi Kay, I just tested your patch, but it causes some warnings regarding incorrect usages of implode() and array_keys().

Actions #9

Updated by Kay Strobach over 11 years ago

can you add the warnings here?

thanks

Actions #10

Updated by Wouter Wolters over 11 years ago

  • Status changed from New to Under Review

This is under review. See #46642 or https://review.typo3.org/#/c/22657/

Actions #11

Updated by Wouter Wolters over 11 years ago

  • Status changed from Under Review to Closed
Actions

Also available in: Atom PDF