← Back to team overview

mahara-contributors team mailing list archive

[Bug 623536] Re: SQL syntax error when copying a view

 

** Changed in: mahara
       Status: Triaged => Fix Committed

-- 
SQL syntax error when copying a view
https://bugs.launchpad.net/bugs/623536
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.

Status in Mahara ePortfolio: Fix Committed

Bug description:
Using Mahara 1.3 beta 4:

When I try to copy a view I get the following error: 

"Mahara: Site unavailable. A nonrecoverable error occurred. This probably means you have encountered a bug in the system "

I took a look at the php error logs and it looked like a malformed SQL statement.  I did some searching and found the problem.  The contactinfo and profileinfo blocktype lib.php files were escaping quotes improperly when building a SQL query.  They were escaping double quotes when encapsulated in single quotes, which meant \"owner\" was taken literally and was generating a syntax error.

Files:
/artefact/internal/blocktype/contactinfo/lib.php  lines 152 to 154

$artefactids = get_column_sql('
SELECT id FROM {artefact}
WHERE \"owner\" = ? AND artefacttype IN (' . join(',', array_map('db_quote', $artefacttypes)) . ')', array($view->get('owner')));

/artefact/internal/blocktype/profileinfo/lib.php  lines 227 to 229

$artefactids = get_column_sql('
SELECT id FROM {artefact}
WHERE \"owner\" = ? AND artefacttype IN (' . join(',', array_map('db_quote', $artefacttypes)) . ')', array($view->get('owner')));





References