For months now I?ve had this error (see attachment) show at the top of a list after being redirected after a form is submitted and couldn't figure out why. Others have mentioned this same issue in these forums. So today I spent some time trying to debug. But after a few hours I gave up.
I know the cause of the problem ? I just don?t know how to fix it ?the right way?.
What happens is the function getEmailValue() in /plugins/fabrik_element/user/user.php is being called repetitively.
I?m not sure why ? but I assume it is either because I have a user element in both the parent and joined group in the form ? or because there is 2 joined rows linked to the parent .
Below is a var dump of the values of $userid in each of the ?If? statements in the getEmailValue function. (the line numbers are off, of course, because I inserted the debugging var_dump code)?
/plugins/fabrik_element/user/user.php 959 - userid is array(1) { [0]=> string(2) "55" }
/plugins/fabrik_element/user/user.php 963 - userid is array(1) { [0]=> string(2) "55" }
/plugins/fabrik_element/user/user.php 973 - userid is array(1) { [0]=> string(2) "55" }
/plugins/fabrik_element/user/user.php 975 - userid is int(55) /plugins/fabrik_element/user/user.php 989 - userid is int(55)
I also inserted this Backtrace just before the return at the end of the function :
1. /server_path/public_html/index.php 40 calling execute()
2. /server_path/public_html/libraries/cms/application/cms.php 255 calling doExecute()
3. /server_path/public_html/libraries/cms/application/site.php 208 calling dispatch()
4. /server_path/public_html/libraries/cms/application/site.php 178 calling renderComponent()
5. /server_path/public_html/libraries/cms/component/helper.php 332 calling executeComponent()
6. /server_path/public_html/libraries/cms/component/helper.php 352 calling require_once()
7. /server_path/public_html/components/com_fabrik/fabrik.php 185 calling execute()
8. /server_path/public_html/libraries/legacy/controller/legacy.php 722 calling process()
9. /server_path/public_html/components/com_fabrik/controllers/form.php 231 calling process()
10. /server_path/public_html/components/com_fabrik/models/form.php 1221 calling runPlugins()
11. /server_path/public_html/components/com_fabrik/models/pluginmanager.php 636 calling onAfterProcess()
12. /server_path/public_html/plugins/fabrik_form/php/php.php 250 calling _runPHP()
13. /server_path/public_html/plugins/fabrik_form/php/php.php 329 calling getProcessData()
14. /server_path/public_html/components/com_fabrik/models/plugin-form.php 192 calling getEmailData()
THEN, AS APPARENTLY THE FUNCTION IS CALLED A 2ND TIME, the screen continues echoing these results?
/plugins/fabrik_element/user/user.php 959 - userid is array(2) { [0]=> array(1) { [0]=> string(2) "55" } [1]=> array(1) { [0]=> string(2) "55" } }
/plugins/fabrik_element/user/user.php 963 - userid is array(2) { [0]=> array(1) { [0]=> string(2) "55" } [1]=> array(1) { [0]=> string(2) "55" } }
/plugins/fabrik_element/user/user.php 973 - userid is array(2) { [0]=> array(1) { [0]=> string(2) "55" } [1]=> array(1) { [0]=> string(2) "55" } }
NOTE HOW THE USER ARRAY IS NOW DOUBLED.
Note the var_dump result right after the line $userid = (int) array_shift($userid); (which is supposed to take care of a single array)...
/plugins/fabrik_element/user/user.php 975 - userid is int(1) /plugins/fabrik_element/user/user.php 989 - userid is int(1)
SO ? back in /libraries/joomla/user/user.php - line 800 - user id is now 1
And that is what throws the error.
My fix was to add another 'if' before the array_shift function...
I'm sure that is not the optimal way to 'fix' this (the function shouldn't be called repetitively to begin with) - but until then , it works for me.
I know the cause of the problem ? I just don?t know how to fix it ?the right way?.
What happens is the function getEmailValue() in /plugins/fabrik_element/user/user.php is being called repetitively.
I?m not sure why ? but I assume it is either because I have a user element in both the parent and joined group in the form ? or because there is 2 joined rows linked to the parent .
Below is a var dump of the values of $userid in each of the ?If? statements in the getEmailValue function. (the line numbers are off, of course, because I inserted the debugging var_dump code)?
/plugins/fabrik_element/user/user.php 959 - userid is array(1) { [0]=> string(2) "55" }
/plugins/fabrik_element/user/user.php 963 - userid is array(1) { [0]=> string(2) "55" }
/plugins/fabrik_element/user/user.php 973 - userid is array(1) { [0]=> string(2) "55" }
/plugins/fabrik_element/user/user.php 975 - userid is int(55) /plugins/fabrik_element/user/user.php 989 - userid is int(55)
I also inserted this Backtrace just before the return at the end of the function :
1. /server_path/public_html/index.php 40 calling execute()
2. /server_path/public_html/libraries/cms/application/cms.php 255 calling doExecute()
3. /server_path/public_html/libraries/cms/application/site.php 208 calling dispatch()
4. /server_path/public_html/libraries/cms/application/site.php 178 calling renderComponent()
5. /server_path/public_html/libraries/cms/component/helper.php 332 calling executeComponent()
6. /server_path/public_html/libraries/cms/component/helper.php 352 calling require_once()
7. /server_path/public_html/components/com_fabrik/fabrik.php 185 calling execute()
8. /server_path/public_html/libraries/legacy/controller/legacy.php 722 calling process()
9. /server_path/public_html/components/com_fabrik/controllers/form.php 231 calling process()
10. /server_path/public_html/components/com_fabrik/models/form.php 1221 calling runPlugins()
11. /server_path/public_html/components/com_fabrik/models/pluginmanager.php 636 calling onAfterProcess()
12. /server_path/public_html/plugins/fabrik_form/php/php.php 250 calling _runPHP()
13. /server_path/public_html/plugins/fabrik_form/php/php.php 329 calling getProcessData()
14. /server_path/public_html/components/com_fabrik/models/plugin-form.php 192 calling getEmailData()
THEN, AS APPARENTLY THE FUNCTION IS CALLED A 2ND TIME, the screen continues echoing these results?
/plugins/fabrik_element/user/user.php 959 - userid is array(2) { [0]=> array(1) { [0]=> string(2) "55" } [1]=> array(1) { [0]=> string(2) "55" } }
/plugins/fabrik_element/user/user.php 963 - userid is array(2) { [0]=> array(1) { [0]=> string(2) "55" } [1]=> array(1) { [0]=> string(2) "55" } }
/plugins/fabrik_element/user/user.php 973 - userid is array(2) { [0]=> array(1) { [0]=> string(2) "55" } [1]=> array(1) { [0]=> string(2) "55" } }
NOTE HOW THE USER ARRAY IS NOW DOUBLED.
Note the var_dump result right after the line $userid = (int) array_shift($userid); (which is supposed to take care of a single array)...
/plugins/fabrik_element/user/user.php 975 - userid is int(1) /plugins/fabrik_element/user/user.php 989 - userid is int(1)
SO ? back in /libraries/joomla/user/user.php - line 800 - user id is now 1
And that is what throws the error.
My fix was to add another 'if' before the array_shift function...
PHP:
if (is_array($userid))
{
if(count($userid)>1 ) $userid = $userid[0];
$userid = (int) array_shift($userid);
}
I'm sure that is not the optimal way to 'fix' this (the function shouldn't be called repetitively to begin with) - but until then , it works for me.