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:
to this:
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.
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 |