• 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.

Error "Cannot access empty property"

_Pascal13950_

New Member
Hi all

I have an error when saving a form.
I looked the code and the problem seems to be in lib_fabrik\fabrik\Helpers\ArrayHelper.php

See the function :
public static function toObject(&$array, $class = 'stdClass', $recurse = true)
foreach ($array as $k => $v)
{
$obj->$k = self::toObject($v, $class);
}

In my case, $k refers to an empty string and so the error is launched.

Could someone tells me why it's possible to have an no named key here ?

Thanks in advance
 
No idea.

Can you get a stack trace, so you can actually see what is called toObject()? Enable J! debug might do it, although I think you may need to have xdebug installed, come to think of it.

-- hugh
 
Yes:

0 /plugins/fabrik_element/databasejoin/databasejoin.php(2052): Fabrik\Helpers\ArrayHelper::toObject(Array)
1 /components/com_fabrik/models/plugin-form.php(412): PlgFabrik_ElementDatabasejoin->getEmailValue(Array, Array, 0)
2 /components/com_fabrik/models/plugin-form.php(214): PlgFabrik_Form->getEmailData()
3 /plugins/fabrik_form/email/email.php(87): PlgFabrik_Form->getProcessData()
4 /components/com_fabrik/models/pluginmanager.php(676): PlgFabrik_FormEmail->onAfterProcess(Array)
5 /components/com_fabrik/models/form.php(1303): FabrikFEModelPluginmanager->runPlugins('onAfterProcess', Object(FabrikFEModelForm))
6 /components/com_fabrik/controllers/form.php(313): FabrikFEModelForm->process()
7 /libraries/src/MVC/Controller/BaseController.php(710): FabrikControllerForm->process()
8 /components/com_fabrik/fabrik.php(181): Joomla\CMS\MVC\Controller\BaseController->execute('process')
9 /libraries/src/Component/ComponentHelper.php(402): require_once('/home/...')
10 /libraries/src/Component/ComponentHelper.php(377): Joomla\CMS\Component\ComponentHelper::executeComponent('/home/...')
11 /libraries/src/Application/SiteApplication.php(194): Joomla\CMS\Component\ComponentHelper::renderComponent('com_fabrik')
12 /libraries/src/Application/SiteApplication.php(233): Joomla\CMS\Application\SiteApplication->dispatch()
13 /libraries/src/Application/CMSApplication.php(196): Joomla\CMS\Application\SiteApplication->doExecute()
14 /index.php(49): Joomla\CMS\Application\CMSApplication->execute()
 
Hmm, strange. That's the form data being passed in to getEmailData, and there shouldn't be any empty properties in that.

Can you try sticking a line of debug in there ... just before line 2052 (so on the line before the toObject() call) in .plugins/fabrik_element/databasejoin/databasejoin.php, do ...

var_dump($data);exit;

... which (assuming you aren't submitting through AJAX) should dump out an array of data and exit.

See if you see an empty property, and if so, what the value is. See if that gives us any clues.

Or paste it here.

Then delete the debug line.
'
-- hugh
 
That's done.
But I cannot paste it here because it 's too long. I added a file.
 

Attachments

  • traces.log.txt
    24.9 KB · Views: 84
Yup, sure enough, there's an empty property at the end of that array.

[""]=> array(0) { } ["_raw"]=> array(0) { }

Which means for some reason Fabrik thinks it has an element with no name.

Rather than try and debug this, I'll just add some defensive coding to the toObject method.

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

Thank you.

Members online

No members online now.
Back
Top