Can't submit forms on 5.6.3.4 – Possibly MySQLi related

Permalink Browser Info Environment
Advanced Forms broke under 5.6.3.4 on a client's site. I believe I know the cause, as I was able to change the code and issue a fix. My theory is this:

1. Per the update notes on 5.6.3.4 (https://www.concrete5.org/documentation/background/version_history/5-6-3-4-release-notes/), concrete5 5.6 now uses the MySQLi extension if it's available. This can lead to better performance.
2. The mysqli extension behaves slightly differently in certain situations. I believe the multiple $db->Insert_ID() calls within the answer set create function were returning incorrect results, as this really should have been assigned to a variable and only called once.

I fixed this by changing this code in models/answer_set.php around line 162:

$db->execute("INSERT INTO sixeightformsAnswerSets (asID,fID,dateSubmitted,dateUpdated,ipAddress,creator,editCode,amountCharged,isApproved,cID,recordID) VALUES (0,?,?,?,?,?,?,?,?,?,?)",array($fID,$timestamp,time(),$ipAddress,$uID,$editCode,$totalPrice,$approvalStatus,$cID,$recordID));
   if($recordID == 0) {
      $db->execute("UPDATE sixeightformsAnswerSets SET recordID = ? WHERE asID = ?",array($db->Insert_ID(),$db->Insert_ID()));
   }
   $as = sixeightAnswerSet::getByID($db->Insert_ID(),0,$getAnswers);


to this:

$db->execute("INSERT INTO sixeightformsAnswerSets (asID,fID,dateSubmitted,dateUpdated,ipAddress,creator,editCode,amountCharged,isApproved,cID,recordID) VALUES (0,?,?,?,?,?,?,?,?,?,?)",array($fID,$timestamp,time(),$ipAddress,$uID,$editCode,$totalPrice,$approvalStatus,$cID,$recordID));
$asID = $db->Insert_ID();
if($recordID == 0) {
   $db->execute("UPDATE sixeightformsAnswerSets SET recordID = ? WHERE asID = ?",array($asID,$asID));
}
$as = sixeightAnswerSet::getByID($asID,0,$getAnswers);


I also fixed all other $db->Insert_ID() calls to assign them to a variable first, but I don't know if any others are actually being called multiple times so I don't imagine much else needs to change. This fixed our issue.

Type: Discussion
Status: In Progress
andrew
View Replies:
circ replied on at Permalink Reply
circ
I just posted the exact same thing. I swear I didn't see this.
ebmudcom replied on at Permalink Reply
ebmudcom
I am seeing this issue as well.

concrete5 Environment Information

n/a

Browser User-Agent String

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/601.2.7 (KHTML, like Gecko) Version/9.0.1 Safari/601.2.7

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.