Bug #15930
closedImporting/installing skin_grey_2 in 4.0 RC2 reports Invalid argument supplied for foreach() .. class.em_index.php
0%
Description
As the extension itself has not changed since I successfully loaded it into 4.0 RC1, and as I did not run into this error in RC1, I am reporting this for the Extension Manager.
Importing skin_grey_2 version 0.0.1 (according to http://typo3.org/extensions/repository/search/skin_grey_2/0.0.1/details/ that is created 25.03.2006 - 18:47) from TER into 4.0 RC2 gives me
Warning: Invalid argument supplied for foreach() in [...]/typo3_src-4.0rc2/typo3/mod/tools/em/class.em_index.php on line 3956
Next, installing it yields the same error. It seems that the end result is fine though (the skin looks good). Even uninstalling gives the same error.
I uninstalled and removed the extension, cleared temp_CACHED files in typo3conf and imported and installed again -- with the same error.
The error occurs in:
3950 function checkDependencies($extKey, $conf, $instExtInfo) {
:
3956 foreach($conf['constraints']['depends'] as $depK => $depV) {
It might very well only apply to extensions that have no dependencies, as the generated ext_emconf.php for skin_grey_2 shows (partially copied)
'title' => 'Gray/orange skin for TYPO3 4.0',
'constraints' => array(
'' => array(
'' => '',
),
),
The "constraints" item looks different from, for example, t3skin:
'title' => 'TYPO3 skin',
'constraints' => array(
'depends' => array(
'php' => '4.3.0-5.9.0',
'typo3' => '3.9.0-4.0',
),
'conflicts' => array(
),
'suggests' => array(
),
),
Likewise, tipafriend (which has no depencies either) shows:
'title' => 'Tip-A-Friend',
'constraints' => array(
'depends' => array(
),
'conflicts' => array(
),
'suggests' => array(
),
),
So maybe the extension is wrong, but again: I did not get this error in 4.0 RC1 and maybe more (erroneous) extensions will now suddenly show the same error. To avoid this, an additional check for a value for
$conf['constraints']['depends']
might avoid existing extensions from breaking?
(issue imported from #M3033)
Updated by Marc Bastian Heinrichs over 18 years ago
confirm
If dependencies field of the EXT is empty, $conf['constraints']['depends'] is empty and the foreach produces the warning.
Updated by Karsten Dambekalns over 18 years ago
If the dependencies are empty and there are no constraints, the constrainst get set to an empty array, the warning will not be trigerred.
I can reproduce this error, but the emconf as contained in the download already has a broken constraints array. I added a stricter check to fixEMCONF() so it'll fix such a broken constraints array, too. In addition I changed arrayToCode() to skip empty keys (this where the broken constraints come from).
As soon as the constraints entry is an array and has one of the keys depends, conflicts, suggests the corresponding fix/check will be skipped, as it is assumed the thing is correct!
Anyway, it works here now without any warnings.