• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Fabrik 3.9: Recoverable fatal error in databasejoin.php on line 1522

Roland

Member
Hi there,

after updating to Joomla 3.9 and Fabrik 3.9 I get an PHP error on saving form data in the frontend which contains a databasejoin field. This is the error message:
Recoverable fatal error: Object of class stdClass could not be converted to string in /home/www/neue-politische-literatur.de/plugins/fabrik_element/databasejoin/databasejoin.php on line 1522

All changes on editing the form data are being saved, even changes in the databasejoin field.
I tried to use one of the default forms coming with Fabrik, but I get the same error message.

Do you have an idea?
 
The joined field is added to form by an extra group. The form is about reviewing books. It is possible to add 1 to x reviewed books.
It seems that the problem is not the joined field but my own PHP addon that runs after the form.
The way of selecting the form variable seems not to work anymore. At least there was no error message with Fabrik 3.8.1
This is the code of my addon:
$id_rezensent = $formModel->formData['id_rezensent'][0];
foreach ($formModel->formData['id_buecher'] as $array_value) {
foreach ($array_value as $id_buch) {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->update('#__npl_buecher');
$query->set("RezId = '" . $id_rezensent . "'");
$query->where("id = '" . $id_buch . "' LIMIT 1");
$db->setQuery($query);
$db->execute();
//echo "<br>id_buecher $id_buch: $query\n";
}
}

$formModel->formData['id_rezensent'][0] and
$formModel->formData['id_buecher'] seem not to work.
When I deactivate the addon, I don't get an PHP error.
I changed the code and get the variables now, but still have problems to convert them into text and explode to an array.
I need the raw data of the form with numbers. There can be x instances of jos_npl_buecher_beitraege___id_buecher_raw, so I try to explode $buecher by comma which does not work:

$id_rezensent = '{jos_npl_beitraege___id_rezensent_raw}';
$buecher = strval('{jos_npl_buecher_beitraege___id_buecher_raw}');
$id_buch = explode(',', $buecher);
echo '<pre>Script: beitraege_addon.php<br />';
echo 'id_rezensent: '. $id_rezensent . '<br />';
echo 'buecher: ' $buecher) . '<br />';
echo 'id_buch[0]: '. $id_buch[0] . '<br />';
echo 'id_buch[1]: '. $id_buch[1] . '<br />';
echo '</pre>';


Output:
Script: beitraege_addon.php
id_rezensent: 2573
buecher: 19343,19158
id_buch[0]: 19343,19158
id_buch[1]:

Which way of selecting variables would you suggest?
 
Thank you for the hints for variable names and debugging. I will implement it the suggested way.

I run the script onAfterProcess because I need to save data in another table after the current form is saved.
In mode onAfterProcess even when I activate the simple plugin dump.php or using the PHP code field (echo 'Hello world';) it returns this error message:
"Recoverable fatal error: Object of class stdClass could not be converted to string in /home/www/neue-politische-literatur.de/plugins/fabrik_element/databasejoin/databasejoin.php on line 1522"

Same effect with onBeforeProcess, onBeforeCalculations and onBeforeStore.
There is no PHP error when I activate getBottomContent or getEndContent.

Roland



 
I can replicate meanwhile (i.e. I run into the same issue;))
@cheesegrits : we had this in Skype

php7.2 issue (ok with 7.0)
Recoverable fatal error: Object of class stdClass could not be converted to string in ...plugins/fabrik_element/databasejoin/databasejoin.php on line 1522
To replicate the issue: add a dbjoin to a repeat group,
set "link to joined record" ("add option in frondend" yes/no doesn't matter)

It is throwing this error in the FORM view on Save (although the form doesn't have a "link to joined record"), details view and list view are ok.
Despite the white screen with this error the record is saved correctly.
 
I think prior to 7.2 there was a "magic method" for objects in PHP, if you tried to use them in a string context, which would just concatenate all the object values together into a string.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top