Updated php causes 500 error with AJAX field verification

hdouglas

Member
I have a large fabrik form (multi page) which has been running successfully on a php 5.5 install. Fabrik has been updated to latest v3.8. Everything works fine.
On updating PHP to 7.1 as soon as the the first field is verified, the form locks with a spinning ajax waiting icon. Checking the server logs the POST to com_fabrik is returning a 500 error.

Field verification is simply checking for a NOT EMPTY
Joomla 3.8.3
Fabrik 3.8
PHP 7.1.7

I have also tried with PHP 5.6 and 7.0 both show similar results to 7.1, everything works when php is reverted back to 5.5

Further info on the 500 error:
From the developers console, the 500 error is being triggered by mootools-core.js
with:
VM2070:1 Uncaught SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at Object._completeValidaton (form.js:3)
at Object.e.extend.$owner (mootools-core.js?5a27997441d3491aaf3c93cda4baeb70:38)
at Object.<anonymous> (form.js:3)
at Object.<anonymous> (mootools-core.js?5a27997441d3491aaf3c93cda4baeb70:42)
at Array.forEach (<anonymous>)
at Function.forEach (mootools-core.js?5a27997441d3491aaf3c93cda4baeb70:5)
at Array.each (mootools-core.js?5a27997441d3491aaf3c93cda4baeb70:9)
at Object.fireEvent (mootools-core.js?5a27997441d3491aaf3c93cda4baeb70:42)
at Object.e.extend.$owner (mootools-core.js?5a27997441d3491aaf3c93cda4baeb70:38)
 
Last edited:
do you have custom php code e.g. in a condition?
set Joomla s error reporting to max and have a look in your browser's dev tool in the response in the Network tab

Gesendet mit Tapatalk
 
Hi, thanks for the reply
On these elements there is no custom php code in the condition area. The only validation is 'not empty'
Error reporting is set to development and there are no php errors reported

On tabbing out of a field, the network tab on the browser reports:
a 500 error type xhr for index.php with initiator mootools-core.js?.....
 
as I've said: have a look in your browser's Network respose tab to see the real error message (which is causing the 'unexpected. ..' because it's breaking the expected Json response)
Try with error level max, not dev. Dev may throw notices which will break the Json, too.

Gesendet mit Tapatalk
 
Thanks, error level now at maximum, the image shows what I am getting in the developer tab:
network-error.png
 
and what is in the Response tab? you are showing the Headers tab

Gesendet mit Tapatalk
 
Sorry, the response tab is showing an error page saying page cannot be found:
the last line of the below may be the clue "Error: Call to undefined method Joomla\CMS\Document\RawDocument::addHeadLink(): syntax error, unexpected end of file, expecting ';'"

This is running with the standard protostar template


<!DOCTYPE html>
<html lang="en-gb" dir="ltr">
<head>
<meta charset="utf-8" />
<title>Error: 0 syntax error, unexpected end of file, expecting &#039;;&#039;</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="//fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" />
<style>
h1, h2, h3, h4, h5, h6, .site-title {
font-family: 'Open Sans', sans-serif;
}
</style>
<link href="/templates/protostar/css/template.css" rel="stylesheet" />
<link href="/templates/protostar/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />
<!--[if lt IE 9]><script src="/media/jui/js/html5.js"></script><![endif]-->
</head>
<body class="site com_fabrik view-form no-layout task-form.ajax_validate itemid-433">
<!-- Body -->
<div class="body">
<div class="container">
<!-- Header -->
<header class="header" role="banner">
<div class="header-inner clearfix">
<a class="brand pull-left" href="/">
<span class="site-title" title="eLetref">eLetref</span> </a>
<div class="header-search pull-right">
</div>
</div>
</header>
<div class="navigation">
</div>
<!-- Banner -->
<div class="banner">
</div>
<div class="row-fluid">
<div id="content" class="span12">
<!-- Begin Content -->
<h1 class="page-header">The requested page can't be found.</h1>
<div class="well">
<div class="row-fluid">
<div class="span6">
<p><strong>An error has occurred while processing your request.</strong></p>
<p>You may not be able to visit this page because of:</p>
<ul>
<li>an <strong>out-of-date bookmark/favourite</strong></li>
<li>a <strong>mistyped address</strong></li>
<li>a search engine that has an <strong>out-of-date listing for this site</strong></li>
<li>you have <strong>no access</strong> to this page</li>
</ul>
</div>
<div class="span6">
<p><strong>You may wish to search the site or visit the home page.</strong></p>
<p>Search this site</p>
Error: Call to undefined method Joomla\CMS\Document\RawDocument::addHeadLink(): syntax error, unexpected end of file, expecting ';'
 
Hugh
Fabrik was updated to 3.8 on Joomla 3.7.5 (that all works). I am working on a backup of that instance on a dev server. The dev server was then updated to Joomla 3.8.3 and php raised to 7.1.7
This install now fails being unable to validate, ie AJAX messages are failing.
The files you mentioned were missing, I have added them, however the problem remains.
I have reinstalled Fabrik 3.8 on this install (ie after the J3.8 update) but this has not made any difference.
Any other ideas?

thanks
Hugh
 
'unexpected end of file' sounds strange and I didn't find any addHeadLink in my complete Joomla source

is it possible that some file got corrupted or hacked?
an update won't remove additional files

did you show the complete error message or is there also some
in file xy line z
given?

Gesendet mit Tapatalk
 
Thanks for your continued assistance.

There are 7 occurances of 'addHeadLink' in /components/com_fabrik I have checked this with another site running Joomla 3.8.3/Fabrik 3.8 and that appears the same (although that one works successfully)

I have removed the secure certificate so I can start to see what is going on, then used Wireshark to analyse the http packets
By changing from php 5.5 (working) to php 7.1 the outgoing POST request is identical in both
So it is how this is being processed which is causing the issue. When in php7 and error is being generated

Any ideas?
 
Little more progress???
I am able to create a new form with just a couple of text fields, both of these I set a 'notempty' validation on
This form works OK, so problem has something to do with the old form. My issue here is I have 5 forms each with about 200 elements, multipage across 10-15 groups. Rewriting the forms isn't really an option.

is there anyway to export a form and reimport it? or to examine what might be wrong here?
 
Related to Fabrik I found addHeadLink only in
components\com_fabrik\views\list\view.base.php
There it's related to RSS-link, did you enable the RSS feed in your list?

Where did you find the other 6 ocurrences in com_fabrik?
 
Hi
I am finding 2 occurences in each of:
components/com_fabrik/Document/PartialDocument.php
components/com_fabrik/views/form/tmpl25/iwebkit/default.php
components/com_fabrik/list/form/tmpl25/iwebkit/default.php
and the one you have found in:
components/com_fabrik/views/list/view.base.php
 
I presume you aren't still using the tmpl25 templates?

As troester says, the "unexpected end of file" is worrying, as that almost always means a file has gotten truncated somewhere. Only other cause is usually custom code with a missing ;.

And the only place in the code we still call addHeadLink () is in that RSS link building, but that's when building a list view, so I'm really puzzled as to why that would be running during validation.

Anway ... confirm what template you are using for the form.

-- hugh
 
Thanks Hugh, the template in use is the default template
The site contains about 15 forms, having now tested all of them it is just this one form which is causing the problem, all the others appear to work normally.

So it is looking like something unique to this one form.

I have removed the validation from one of the first elements, then tried adding the notempty validation again, but it makes no difference.

Is there a way I can export and import a form from one site to another? The issue here is that if I recreate the form I will need to migrate it to the live server (akeekabackup isn't an option because the site is in constant use and is receiving customer inputs the whole time, therefore the dev site is rapidly out of sync with the live site)
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top