Reviewed: https://reviews.mahara.org/6219 Committed: https://git.mahara.org/mahara/mahara/commit/d4029997c8c4d0d741af6bd4cffadc264937808c Submitter: Robert Lyon ([email protected]) Branch: 15.10_STABLE
commit d4029997c8c4d0d741af6bd4cffadc264937808c Author: Gary Leydon <[email protected]> Date: Wed Sep 30 07:57:56 2015 +1300 Bug 1499572: Avoid array to string conversion in ADODB errors behatnotneeded: error appears in error log Change-Id: Ic816248ee56bcae7daa1f13c768afdab92c95b23 Signed-off-by: Robert Lyon <[email protected]> -- You received this bug notification because you are a member of Mahara Contributors, which is subscribed to Mahara. Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it! https://bugs.launchpad.net/bugs/1499572 Title: array to string conversion on SQLExceptions/ADODB_Exceptions Status in Mahara: Fix Committed Status in Mahara 1.10 series: In Progress Status in Mahara 15.04 series: In Progress Status in Mahara 15.10 series: Fix Committed Status in Mahara 16.04 series: Fix Committed Bug description: This bug has been reported from other code (#1486766) but I think the issue is perhaps better addressed in the code for class ADODB_Exception constructor. I got the Array to string conversion warning in my logs when catching a Postgres 9.4 SQLException for trying to add a record that would break a unique key constraint. The problem was argument $p2 in ADODB_Exception constructor was an array and when the string was created on line 43: it generated the warning in my logs: Array to string conversion error 43: $s = "$dbms error: [$errno: $errmsg] in $fn($p1,$p2)\n"; a fix I put into my local development copy was as follows and may not be appropriate, but this worked for me line 30 before switch statement if is_array($p1){ $p1 = implode(":",$p1); } if is_array($p2){ $p2 = implode(":",$p2); } it could be that the p1 check is never needed. If $p2 is a monsterous array this might be problematic as well, but this array guard means that you don't have to hunt down every ADODB_Exception in the code to be filtered to make sure $p2 is never an array. To manage notifications about this bug go to: https://bugs.launchpad.net/mahara/+bug/1499572/+subscriptions _______________________________________________ Mailing list: https://launchpad.net/~mahara-contributors Post to : [email protected] Unsubscribe : https://launchpad.net/~mahara-contributors More help : https://help.launchpad.net/ListHelp

