[TYPO3-english] sp_bettercontact in Typo 4.6.x - Form labels not rendered, shows "Array"

Alexander Dick alex at dick.at
Tue Dec 6 08:50:13 CET 2011


Hi Denyer,

you are not the only one who is having this problem.
I had the exact same issue with ve_guestbook.

There must have been a change to the localization handling,
unfortunately I did not have the time to find the root of the problem 
so I made a dirty hack in the meantime.

It seems like there were the indexes 'source' and 'target' added 
somewhere,
and that results in $value being an array rather than (as expexted) a 
string.

change
$markerArray ['###' . strtoupper ( $key ) . '###'] = $value;

to

if(is_array($value)) {

     if(t3lib_div::_GP('L') > 0)
         $value = $value[0]['source'];
     else
         $value = $value[0]['target'];

}

$markerArray ['###' . strtoupper ( $key ) . '###'] = $value;


this is not a clean solution because I just check for language > 0 
(which is english on my site), but it works.


HTH
kind regards
Alex


On Mon, 05 Dec 2011 23:38:07 -0000, Den Denyer wrote:
> Hi all,
> Attempting to use sp_bettercontact 2.4.4 with Typo3 4.6.1 on PHP 5.3,
> along with the latest version of templateVoila.
>
> When rendering the frontend form instead of my form labels (Default
> template) I see:
>
> Array Array
>
> Instead of something such as:
>
> First Name
>
> I looked in the admin console and saw the following error:
>
> Error handler (FE): PHP Warning: md5() expects parameter 1 to be
> string,  array given in
> 
> /typo3conf/ext/sp_bettercontact/pi1/class.tx_spbettercontact_pi1_template.php
>  line 310
>
> I took a look, and mitigated this error by adding the following
> tmpval (I  was far too tired at the time to look into WHY the code
> didn't work in its  original form, so excuse the brutal hack)
>
> Original:
> $aMultiNames['[' . $aField['labelName'] . ']'] =
> md5($this->aMarkers[$aField['labelName']]);
>
> Hack:
> $tmpval = isset($this->aMarkers[$aField['labelName']][0][target]) ?
> $this->aMarkers[$aField['labelName']][0][target] : '';
> $aMultiNames['[' . $aField['labelName'] . ']'] = md5($tmpval);
>
>
> This removed the error message, but still the field names show as
> "Array"  rather than "Name" etc.
> Clearly somewhere the output routine is expecting strings and is
> getting  arrays. The only question is why, followed by "How do I
> resolve it" ?
>
> Searching on google suggest that so far I am the only person with
> this  issue, it's a fairly popular extension so I'm wondering if it
> really is a  problem with the extension, or a problem with my
> particular installation.
>
> I must point out, that on a different site I have used version 2.3.5
> in  its completely default configuration without errors. 2.3.5 does
> not,  however, work with Typo 4.6.1
>
> Any and all help appreciated,
> Denyer
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english



More information about the TYPO3-english mailing list