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

Back
Top