Array to string conversion with subtable/form-repeat

OS info

  • Operating System : Windows 10.0.19044
  • Wappler Version : 5.0.0-beta.10

Problem description

XAMPP
PHP Version 8.0.19

In my own form and with this tutorial when submitting form.

file: \dmxConnectLib\modules\dbupdater.php
line: 131
message: Array to string conversion

The value of name index in the original code should not be an array.

\dmxConnectLib\modules\dbupdater.php (line 116)

Original Code:

						$current = (object)array(
							$sub->key => $identity,
							$sub->values[0]->column => $current
						);

Output:

stdClass Object
(
    [user_id] => 11
    [name] => Array
        (
            [name] => John
            [email] => john@example.com
            [phone] => 411
        )

)

Suggested Code:

							$current = (object)array_merge(
								array($sub->key => $identity),
								$current
							);

Output:

stdClass Object
(
    [user_id] => 12
    [name] => John
    [email] => john@example.com
    [phone] => 411
)

Thx for the fix, there were also some other issues fixed, the latest update can be found at formRepeat not working with PHP

Fixed in Wappler 5.0.3

This topic was automatically closed after 32 hours. New replies are no longer allowed.