Buy Now
Sign in

Submitting form now results in error T_ENCAPSED_AND_WHITESPACE

MaestroC , November 14 2018, 02:06
MaestroC 69
November 14 2018, 02:06 #381496
We've had a pretty complex form done in V5 for several years now. Recently it has started throwing errors when a user submits it. Exact error is:
 0 - syntax error, unexpected ''/chronoforms/pdfs/SurveyForm/' (T_ENCAPSED_AND_WHITESPACE)
I've turned on debugging but it doesn't show me anything additional so I don't know where this is coming from. It appears to be saving the data to the database but it is not sending out the emails that it should after a user submits the form. Example of the form is here:
Is this error due to something in the TCPDF creation code or is it somewhere else? In any case if no changes to the code of the form have been made is it possible an update to CF or TCPDF could be the cause of this error?
EDIT- I thought it might be related to TCPDF so I tried to install the action again with the version available in the CF downloads area. When I try to install the TCPDF action I get the error "Class ZipArchive not found".
SOLUTION FOUND? I had to turn my PHP on that entire account back down to 5.6. When I did so the error went away Is CF 5.0.17 not PHP7 compatible?
healyhatman 8
November 14 2018, 07:58 #381498
CF5 is getting pretty old now and yes there are increasing reports of incompatibilities with PHP7
Web developer at - I DO NOT work for ChronoEngine!
Professional Work:
Custom CF / CC Plugins and Extensions:
GreyHead 64
November 14 2018, 09:34 #381502
Hi MaestroC,
I am only seeing one irritating PHP Notice with PHP 7.
The error message looks as though it might be coming somehow from the name of the TCPDF file being saved. Could that be it?
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
MaestroC 69
May 12 2019, 14:42 #386807
Sorry to reopen this but I am finally getting around to trying to fix this as I really need to get this site running on PHP7.1.
GreyHead, you mention you think it might be related to saving the file name. Would that be related to the TCPDF action or would it be somewhere else in the form?
Is there anything you can think of that is different between PHP5.6 and 7.1 that would affect that? The form saves just fine when I have it switched back to php5.6 but gives the (T_ENCAPSED_AND_WHITESPACE) error when I turn it up to 7.1.
GreyHead 64
May 13 2019, 15:57 #386827
Hi MaestroC,
It's probably due to some extra spaces somewhere - maybe in a file name or from some Custom Code.
I suggest that you make a copy of your form and try removing any custom code around the TCPDF action - that should help you pind down exactly what is causing this.
Note: I haven't seen this reported elsewhere so it probably isn't arising directly from the CF code.
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
MaestroC 69
November 01 2019, 00:46 #389827
Sorry to bring this one back up but still trying to figure it out. I'll paste below the custom code that might be causing the issue, however I have no idea what is wrong with it if it is. Does this look like something that might cause that issue?
This is the first one. It takes the data from the form and puts it into an email that is sent to a coach:
$mailer = JFactory::getMailer();
$config = JFactory::getConfig();
$sender = array(
$config->get( 'mailfrom' ),
$config->get( 'fromname' )
$userid = $form->data['coachnum'];
$user = JFactory::getUser($userid);
$recipient = $form->data['Client']['coachemail'];
$subject = 'GPS Survey Form Response from '.$form->data['Client']['firstName'].' '.$form->data['Client']['lastName'];
/* $mailer->setSubject('Survey Form Response'); */
$body = '<h2>Survey Form Response</h2>'
. '<div>A client has submitted a survey with your Coach ID #. Please refer to the attached PDF.';
$mailer->Encoding = 'base64';
$send = $mailer->Send();
if ( $send !== true ) {
echo 'Error sending email: ' . $send->__toString();
} else {
//echo 'Mail sent';
This is the second custom code action and the only one that actually mentions something that we see in the error. The full error actually reads:
0 - syntax error, unexpected ''/chronoforms/pdfs/SurveyForm/' (T_ENCAPSED_AND_WHITESPACE)
$form->files["cf_pdf_file"]["path"] = JPATH_COMPONENT.'/chronoforms/pdfs/SurveyForm/;?><?php echo "{cf_pdf_file}"; ?>
Any idea if either of these are the actual culprits?
GreyHead 64
November 03 2019, 15:04 #389848
Hi MaestroC,
The last piece of PHP you posted is missing a ‘ after Form/ That might be the problem.
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much