Avoid warnings due to unmatched capture groups

If the non-capturing group which contains the last two capture groups of
the expression is not matched, the indexes are not defined in the match
result, causing a warning.  Avoid this using isset() before access.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
This commit is contained in:
Kevin Locke
2016-06-30 15:39:15 -07:00
parent 5b7e9a80ff
commit ac43107187

View File

@ -57,8 +57,8 @@
$logto = 'SHOWCOLUMN';
$full = $matches[1];
$table = $matches[2];
$like = $matches[3];
$where = $matches[4];
$like = isset($matches[3]) ? $matches[3] : FALSE;
$where = isset($matches[4]) ? $matches[4] : FALSE;
// Wrap as sub-query to emulate WHERE behavior
$sql = ($where ? 'SELECT * FROM (' : '').
'SELECT column_name as "Field",