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

PHP Warning: Array to string conversion - using the fileUpload field #1004

Open
daUhradone opened this issue Mar 27, 2024 · 3 comments
Open
Labels

Comments

@daUhradone
Copy link

daUhradone commented Mar 27, 2024

PHP Warning: Array to string conversion in /html/typo3-composer/vendor/typo3fluid/fluid/src/Core/ViewHelper/TagBuilder.php line 200

It seems to be connected to the dismantling of the file attributes:
Line 200 is "if(trim ..."

        foreach ($attributeValue as $name => $value) {
              $this->addAttribute($attributeName . '-' . $name, $value, $escapeSpecialCharacters);
          }
      } else {
          if (trim((string)$attributeValue) === '' && $this->ignoreEmptyAttributes) {
              return;
          }
          if ($escapeSpecialCharacters) {
              $attributeValue = htmlspecialchars((string)$attributeValue);

at TYPO3Fluid\Fluid\Core\ViewHelper\TagBuilder->addAttribute('value', array('name' => 'IMG_6420.JPG', 'type' => 'image/jpeg', 'error' => 0, 'size' => 5182688, 'tmp_name' => '/tmp/phps3at0y'))

In Production Mode I get:
Core: Exception handler (WEB): Uncaught TYPO3 Exception: strtolower(): Argument #1 ($string) must be of type string, null given | TypeError thrown in file /html/typo3-composer/vendor/in2code/powermail/Classes/Domain/Service/UploadService.php in line 134.

But types are set in Constants or TypoScript

PHP 8.3
TYPO3 12.4.3
powermail 12.3.0

only when I use the fileupload field

@daUhradone
Copy link
Author

Hello Mr. Schwemer,
I see you got permission from the bosses to fix some issues just before Vatertag.
Could this one also get a chance?

THANX

@mschwemer mschwemer added the v12 label May 21, 2024
@vnc-jboe
Copy link

The following change worked for me:

As the template Form/Confirmation.html has been overridden by an own extension since powermail v11, changes have to be make in the section Hiddenfields to run in powermail v12.

The markup for that section has to be replaced with the following. After replacement forms with file uploads do work again.

<f:section name="HiddenFields">
	<f:for each="{mail.answers}" as="answer">
		<f:if condition="{vh:condition.isArray(val:answer.value)}">
			<f:then>
				<f:for each="{answer.value}" as="subvalue" iteration="i">
					<f:form.hidden property="{answer.field.marker}.{i.index}" value="{subvalue}" respectSubmittedDataValue="false"  />
				</f:for>
			</f:then>
			<f:else>
				<f:form.hidden property="{answer.field.marker}" value="{answer.value}" respectSubmittedDataValue="false"  />
			</f:else>
		</f:if>
	</f:for>

	<f:form.hidden name="mail[form]" value="{mail.form.uid}" class="powermail_form_uid" />
</f:section>

@daUhradone
Copy link
Author

Looks like it is working here too!
Thanks a lot!

Would not have searched for difficulties with file-upload inside th Confirmation-Template.

Thomas

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

3 participants