typoscript_rendering icon indicating copy to clipboard operation
typoscript_rendering copied to clipboard

Fix PHP Warning: Undefined array key 0

Open codegm opened this issue 3 years ago • 4 comments

codegm avatar Aug 19 '22 13:08 codegm

@codegm Thanks a lot for taking the time to create this PR. Can you elaborate in what scenario this header is not sent and you run into issues? Could be that something else also needs to be fixed.

helhum avatar Aug 20 '22 06:08 helhum

It is a redirect response after submiting an ext:form with redirect as last finisher.

TYPO3\CMS\Core\Http\RedirectResponseprototypeobject statusCode => protected303 (integer) reasonPhrase => protected'See Other' (9 chars) availableStatusCodes => protectedarray(64 items) protocolVersion => protected'1.1' (3 chars) headers => protectedarray(1 item) location => array(1 item) 0 => 'https://www....' (49 chars) lowercasedHeaderNames => protectedarray(1 item) body => protectedTYPO3\CMS\Core\Http\Streamprototypeobject

Hope this helps...

codegm avatar Aug 20 '22 07:08 codegm

Hey @helhum I get this warning also with php 8.1 on my forms. The form is a programmatically created ext:form form with a redirect finisher:

public function build(array $configuration, string $prototypeName = null): FormDefinition
{
    [...]
    $form->createFinisher('Redirect', ['pageUid' => 366]);
    $this->triggerFormBuildingFinished($form);
    return $form;
}

image

schliesser avatar Aug 25 '22 06:08 schliesser

And I can confirm that the patch works :-)

schliesser avatar Aug 25 '22 07:08 schliesser

@schliesser @codegm @oliverklee I pushed now a third alternative approach to #88

Can you verify this would work for you as well? Thanks!

helhum avatar Nov 17 '22 06:11 helhum