The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 909 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1370 fetch_forum_permissions
/printthread.php 76 forum_permissions
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Form Tools
Escape Characters and Quotation Marks - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1)
+--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5)
+--- Thread: Escape Characters and Quotation Marks (/showthread.php?tid=2999)



Escape Characters and Quotation Marks - grahame - Apr 22nd, 2014

Hi

I am sure this is a problem common to many PHP installations but I was wondering how to fix it specifically in a form-tools installation?

I have a text area on a form. If I add
Quote:this is a quote by me; "why do I keep getting escape characters repeated?"

each time the submission is updated I get extra escape characters
Quote:this is a quote by me; \\\"why do I keep getting escape characters repeated?\\\"
then, after 3 or 4 updates
Quote:this is a quote by me; \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"why do I keep getting escape characters repeated?\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"

To get around storage of this I use stripslashes and str_replace functions in a hook in ft_update_submission, start. But although it is getting stored correctly in MYSQL it still insists on displaying them as above?

Is there is a global variable or whatever that I can set to prevent this behaviour rather than use code hooks?




RE: Escape Characters and Quotation Marks - grahame - Apr 23rd, 2014

I have solved this problem but it took some finding.

I have a code hook in ft_update_submission,start. Although it appeared to be working there must have been a problem with it. However this problem was not flagged in edit_submission.php i.e.
Code:
list($g_success, $g_message) = ft_update_submission($form_id, $submission_id, $request);

  // if there was any problem udpating this submission, make a special note of it: we'll use that info to merge the current POST request
  // info with the original field values to ensure the page contains the latest data (i.e. for cases where they fail server-side validation)
  if (!$g_success)
  {
      $failed_validation = true;
  }

Both $g_success and $g_message were being returned as NULL. Later in edit_submission.php there is a call thus:-
Code:
$grouped_fields = ft_get_grouped_view_fields($view_id, $tab_number, $form_id, $submission_id);
if ($failed_validation)
{
    $grouped_fields = ft_merge_form_submission($grouped_fields, $_POST);
}

Because $failed_validation was true, the merge code here (I think) just kept adding the POST'd values to themselves and (I think) was causing the multiple slashes to appear.

I corrected my hook and everything behaved itself again

I wonder if this should be flagged up to Ben/Joe??





RE: Escape Characters and Quotation Marks - Joe - Apr 25th, 2014

Hey Grahame,

Thanks for posting your solution. We'll take a closer look at this. Could you post into our bug tracker please? Thanks so much.

Cheers,

Joe


RE: Escape Characters and Quotation Marks - grahame - Apr 27th, 2014

Hi

Would be happy to but, actually, I have done a little more digging around on this.

I had code in the hooks manager for 'ft_update_submission, start' and 'end'. When ft_update_submission was called by edit_submission.php thus
Code:
list($g_success, $g_message) = ft_update_submission($form_id, $submission_id, $request);
the variables $g_success and $g_message were being returned as NULLs. This then resulted in the $failed_validation being true. This was irrespective of the failure or success of my code.

Now although my code was actually working, there are two override variables in the hook manager... $success and $message which I was not manipulating. They were defaulting to NULL.

So I don't think this is a bug per se but rather my misunderstanding that there was a requirement for $success and $message to be set to true by the code in the hook??