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

Warning: Undefined array key 0 - n #22

Open
hh-com opened this issue Aug 4, 2023 · 2 comments
Open

Warning: Undefined array key 0 - n #22

hh-com opened this issue Aug 4, 2023 · 2 comments

Comments

@hh-com
Copy link

hh-com commented Aug 4, 2023

Contao 5.1.11
MCW: 3.6.2
PHP: 8.1.21

Das Problem tritt auf, wenn es sich um Pflichtfelder handelt.
Löscht man eine Zeile oder mehrere passt etwas mit dem Index nicht mehr.
Beim Speichern kommt die Warnung:

Warning: Undefined array key 0 (bzw. 1,2,3...)

'label'     => ['Termine','Termine.'],  
'exclude'   => true,  
'inputType' => 'multiColumnWizard',  
'eval'      => [  
	'tl_class'=>'w50 clr',  
	'columnFields' => [  
		'tag'      => [  
			'label'     => ['Tag',''],  
			'exclude'   => true,  
			'inputType' => 'text',  
			'eval'      => [  
				'style'              => 'width: 100px;',  
				'mandatory' => true,  
				'rgxp'=>'date',  
				'datepicker'=>true,  
			]  
		],
	],
],
Stack trace: 
ErrorException:
Warning: Undefined array key 0

  at vendor/menatwork/contao-multicolumnwizard-bundle/src/Contao/Widgets/MultiColumnWizard.php:726
  at MenAtWork\MultiColumnWizardBundle\Contao\Widgets\MultiColumnWizard->validator()
     (vendor/contao/core-bundle/contao/library/Contao/Widget.php:729)
  at Contao\Widget->validate()
     (vendor/contao/core-bundle/contao/classes/DataContainer.php:483)
  at Contao\DataContainer->row()
     (vendor/contao/core-bundle/contao/drivers/DC_Table.php:2082)
  at Contao\DC_Table->edit()
     (vendor/contao/core-bundle/contao/classes/Backend.php:546)
  at Contao\Backend->getBackendModule()
     (vendor/contao/core-bundle/contao/controllers/BackendMain.php:148)
  at Contao\BackendMain->run()
     (vendor/contao/core-bundle/src/Controller/BackendController.php:44)
  at Contao\CoreBundle\Controller\BackendController->mainAction()
     (vendor/symfony/http-kernel/HttpKernel.php:166)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:74)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:197)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (public/index.php:44)           

Bsp:
Es werden 3 Zeilen gespeichert.
Jetzt wir eine Zeile gelöscht. -> die Warning kommt.
Wenn ich mir in der Zeile 725 die var_dump($varInput); ausgebe, sind hier noch 3 Arrays enthalten, eines mit leeren Values.

@tsarma
Copy link

tsarma commented Mar 5, 2024

The warning appears only when you delete a row from the top, not the last row. The last row can be deleted. So if you want to delete a row first sort it to the bottom and then delete it.

@zonky2
Copy link
Collaborator

zonky2 commented Apr 9, 2024

@hh-com bitte gib die Stelle im Quelltext immer mit einem Permalink an - so wie der

$this->arrWidgetErrors = $newWidgetError;

an der Stelle kann ich kein Array mit Key sehen

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

No branches or pull requests

3 participants