1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

Error: Undefined variable where in Fabrik list.php at 7833

Discussion in 'Community' started by paulproffitt, Jul 11, 2019.

  1. paulproffitt

    paulproffitt New Member

    Level: Community
    Joomla 3.9.8, Fabrik 3.9, PHP 7.1.30

    While trying to edit and save a record (from a list view, clicking on the Edit icon, modifying and then saving the record). The record edits fine and saves in the database. However, this message is logged in the error_php file:

    [11-Jul-2019 17:21:19 UTC] PHP Notice: Undefined variable: where in /home/evo/public_html/components/com_fabrik/models/list.php on line 7833

    This is with Joomla's error reporting set as Maximum. And the following error is displayed in the record's edit modal window (after saving the changes to the database):
    SyntaxError: Unexpected token < in JSON at position 0

    I found this while trying to test sending an email (email plugin) on edit of an existing record. I don't think this issue is related, but it might be what is hindering the sending of the email (note: the site is properly sending emails otherwise).

    Any questions or suggestions would be appreciated.
     
  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Hmm. Do you have a primary key set for the list in the settings, and is it published, and not ACL protected (such that the user doesn't have write access to it)?

    The only way that warning could arise is if we can't find the primary key's data in the row data being saved.

    It also surprises me that you said the record saves, as without that $where, we don't know which row to update.

    Also, your line numbers don't jive with the latest code. So you might want to do a github update (do a full Akeeba backup first).

    That "Unpexted token" in the modal is a result of the first error, and have error reporting enabled. When doing AJAX calls to the server from Javascript, if the server reports an error, the HTML error msg gets inserted into the JSON response. So when the Javascript attempts to decode that JSON response, which now starts with an HTML tag (hence the <), it blows up because the response is no longer valid JSON.

    -- hugh
     
  3. paulproffitt

    paulproffitt New Member

    Level: Community
    First, yes, there is a defined primary key ('id') on the table and I believe that access is not the issue (famous last words).

    I've downloaded the github version and installed it on my site. I've confirmed that the list.php file mentioned is indeed different now.

    When I try the same save as previously mentioned, I get the same result. Except the error message in the error_log is now:

    [12-Jul-2019 23:09:41 UTC] PHP Notice: Undefined variable: where in /home/evo/public_html/components/com_fabrik/models/list.php on line 7904

    Note the new line number. So maybe I do have an ACL issue that I haven't found as yet.

    The single record being edited was indeed updated in the database, same as before.
     
  4. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    I'm still puzzled by this. If that $where isn't defined, then the database update really shouldn't work. It would be trying to run a MySQL 'UPDATE' with an empty 'WHERE' clause ... 'UPDATE mytable (foo,bar) VALUES (1,2) WHERE'

    -- hugh
     
  5. paulproffitt

    paulproffitt New Member

    Level: Community
    I'm on the way to solving it. I've discovered (remembered) that there was a second group added to the form. If I remove that group from the form, it works fine. So I'm working on remembering why I added the second group and then figuring out why that was an issue. At least now I can complete testing the email plugin tasks that I was trying to add to the form.
     
  6. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Ah, yes ... if you have a joined group (so it's based on another table), that same code will get called again for saving that group. I'm still surprised we don't catch and report a query error though, with a more clear error message. I thought we did.

    -- hugh
     

Share This Page