Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1: PHP Warning: array_intersect_key(): #12

Closed
lisardo2 opened this issue Aug 30, 2016 · 17 comments
Closed

#1: PHP Warning: array_intersect_key(): #12

lisardo2 opened this issue Aug 30, 2016 · 17 comments
Labels
Milestone

Comments

@lisardo2
Copy link

I installed mask in TYPO3 7.6.9 (clean introduction package), made 1 CE with mask. Then i installed mask_export (last version from GIT). When i click on Code Export - mask_example - Save then nothing happens. When i click on download i get a corrupt zip-archive with 0 bytes in it. After activating developer mode i got this Error:
#1: PHP Warning: array_intersect_key(): Argument #2 is not an array in /Volumes/DATEN/sites/typo3_76/typo3conf/ext/mask_export/Classes/Aggregate/AbstractOverridesAggregate.php line 49 (More information)

TYPO3\CMS\Core\Error\Exception thrown in file
/Volumes/DATEN/src/typo3_src-7.6.last/typo3/sysext/core/Classes/Error/ErrorHandler.php in line 111.

24 TYPO3\CMS\Core\Error\ErrorHandler::handleError(2, "array_intersect_key(): Argument #2 is not an array", "/Volumes/DATEN/sites/typo3_76/typo3conf/ext/mask_e…t/Classes/Aggregate/AbstractOverridesAggregate.php", 49, array)
23 array_intersect_key(array, NULL)

/Volumes/DATEN/sites/typo3_76/typo3conf/ext/mask_export/Classes/Aggregate/AbstractOverridesAggregate.php:
00047: {
00048: $newTableFields = array_intersect_key($tableConfiguration['columns'],
00049: $this->maskConfiguration[$this->table]['tca']);
00050:
00051: if (empty($newTableFields)) {

22 CPSIT\MaskExport\Aggregate\AbstractOverridesAggregate::addTableColumns(array)

/Volumes/DATEN/sites/typo3_76/typo3conf/ext/mask_export/Classes/Aggregate/TtContentOverridesAggregate.php:
00049:
00050: $tableConfiguration = $GLOBALS['TCA'][$this->table];
00051: $this->addTableColumns($tableConfiguration);
00052: $this->addTableTypes($tableConfiguration);
00053: }

21 CPSIT\MaskExport\Aggregate\TtContentOverridesAggregate::process()

/Volumes/DATEN/sites/typo3_76/typo3conf/ext/mask_export/Classes/Aggregate/AbstractAggregate.php:
00052: {
00053: $this->maskConfiguration = $maskConfiguration;
00054: $this->process();
00055: }
00056:

20 CPSIT\MaskExport\Aggregate\AbstractAggregate::__construct(array)

/Volumes/DATEN/src/typo3_src-7.6.last/typo3/sysext/core/Classes/Utility/GeneralUtility.php:
04534: break;
04535: case 2:
04536: $instance = new $className($arguments[1]);
04537: break;
04538: case 3:

@IchHabRecht
Copy link
Owner

Can you please attach your mask.json file and tell which version of mask you are using. Thank you!

@lisardo2
Copy link
Author

Of course ... :-)

json:
{
"tt_content": {
"elements": {
"name": {
"label": "Name",
"key": "name",
"shortLabel": "name",
"description": "Irgend ein Name. ",
"icon": "fa-star",
"color": "#b36b09",
"columns": [
"header",
"bodytext",
"image"
],
"labels": [
"My Header",
"My Bodytext",
"My Image"
],
"options": {
"1": "rte"
}
}
}
}
}

i use the last version of mask from TER 2.1.1.

Thanks!

@IchHabRecht IchHabRecht added this to the 0.3.1 milestone Aug 31, 2016
@IchHabRecht IchHabRecht added bug and removed feedback labels Aug 31, 2016
@IchHabRecht
Copy link
Owner

Would you mind to checkout the branch https://github.com/CPS-IT/TYPO3-mask_export/tree/restore-file-generation and re-try

@lisardo2
Copy link
Author

This fixes the problem! Now I can export the extension. Only one minor problem remains: after installing the exported extension all content elements in the common tab are gone and only the new CE is present. It seems more or less a problem of the bootstrap package ... Benny rewrote the whole wizard and added all content elements in the end with show = * ... i presume this syntax is not campatible with your "show := addToList(myNewElement)". When i delete the line show := addToList(myNewElement) all works as expected.

Thanks!
GREAT WORK!!!
Peter

@IchHabRecht
Copy link
Owner

Hi Peter,

Can you check the order of the extensions in your PackageStates.php? Maybe the bootstrap_package overrides the wizard items. In my example installtion bootstrap_package is loaded before the mask export.

@IchHabRecht
Copy link
Owner

Reopened to get feedback

@IchHabRecht IchHabRecht reopened this Sep 5, 2016
@lisardo2
Copy link
Author

lisardo2 commented Sep 5, 2016

Hi Nicole,

in my installation too:

        'bootstrap_package' => [
            'composerName' => 'bootstrap_package',
            'state' => 'active',
            'packagePath' => 'typo3conf/ext/bootstrap_package/',
            'suggestions' => [],
        ],
        'introduction' => [
            'composerName' => 'introduction',
            'state' => 'active',
            'packagePath' => 'typo3conf/ext/introduction/',
            'suggestions' => [],
        ],
        'mask_example' => [
            'composerName' => 'mask_example',
            'state' => 'active',
            'packagePath' => 'typo3conf/ext/mask_example/',
            'suggestions' => [],
        ],

If i force the the order the other way round (fürst mask_example) and then bootstrap_package it works.

the bootstrap package includes its content elements with: show = *
if show := addToList(name) follows after show = * then only name remains. The other way round:

    show := addToList(name)
    show = *

will work. There is a kind of logic behind it ... the method addToList cannot add himself to * ...

This code in class TypoScriptParser: `

           case 'addToList':
                $newValue = ((string)$currentValue !== '' ? $currentValue . ',' : '') . $modifierArgument;
                break;

ends in $newValue = '*,name'
which is likely not interpreted as "all" anymore.

@lisardo2
Copy link
Author

lisardo2 commented Sep 5, 2016

Well, i found this piece of code in class NewContentElementController:

                foreach ($wizards as $groupKey => $wizardGroup) {
                    $groupKey = rtrim($groupKey, '.');
                    $showItems = GeneralUtility::trimExplode(',', $wizardGroup['show'], true);
                    $showAll = $wizardGroup['show'] === '*';
                    $groupItems = array();
                    if (is_array($appendWizards[$groupKey . '.']['elements.'])) {
                        $wizardElements = array_merge((array)$wizardGroup['elements.'], $appendWizards[$groupKey . '.']['elements.']);
                    } else {
                        $wizardElements = $wizardGroup['elements.'];
                    }

This line ist responsible:
$showAll = $wizardGroup['show'] === '*';

@IchHabRecht
Copy link
Owner

But this code is taken from mask extension, isn't it? This has nothing to do with the export then.

@IchHabRecht
Copy link
Owner

Are you using mask and your export extension in the same installation?

@lisardo2
Copy link
Author

lisardo2 commented Sep 5, 2016

No, these are core classes - in the end it is a problem of the core, the typoscript renderer. if you put together "*,ce1,ce2" only ce1 and ce2 remains because this term fails: $showAll = $wizardGroup['show'] === '*';
bootstrap_package uses "*" and you use "ce1,ce1". Depending on the order of the extensions you end with: "*" (bootstrap_package loaded after the mask_export) or "*,ce1" (bootstrap before mask_export). The second will fail: all CEs from bootstrap_package are lost.

@IchHabRecht
Copy link
Owner

This is really strange as in my setup with bootstrap_package everythink works fine. Can you just give me the version of bootstrap_package and your TYPO3 version again? Is there any other extension dealing with the new content element wizard?

@lisardo2
Copy link
Author

lisardo2 commented Sep 7, 2016

TYPO3 7.6.9
introduction 2.3.0
bootstrap_package 7.0.2
mask_export 0.3.0 (from GIT)
mask 2.1.1 (from TER)
mask_example 0.1.0
thats it - no further extension except the necessary extensions from core.
Standard Installation of introduction package without any alterings.

@IchHabRecht
Copy link
Owner

With a fresh installation and your extension information, I'm able to reproduce the problem now. Will have a look what happens here.

@IchHabRecht
Copy link
Owner

Problem should be solved by the core with bugfix https://forge.typo3.org/issues/77877 Please consider to test and vote this patch.

@lisardo2
Copy link
Author

lisardo2 commented Sep 7, 2016

I tested the patch in TYPO3 7.6.9 in my test installation. It works as expected: independent from the installation order of mask_example and bootstrap_package all CEs are preserved. I looked in the code itself too and it looks straight forward for me. Well, it seems to be a pretty easy patch. So I voted for it.

@IchHabRecht
Copy link
Owner

Thanks for testing and voting. I'm closing this issue now as the mask_export issue is solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants