Hi, I couldn't install piwigo on my mysql 5.6 server that has sql_mode ANSI_QUOTES activated (I need it for other databases). The SQL select * from piwigo_plugins where id="TakeATour" raised an error because of the double quotes and halted the entire installation. I modified the faulty method in include/functions_plugins.inc.php as below to fix the issue, and then had been able to finish the installation.
Regards
Bruno
SELECT * FROM '.PLUGINS_TABLE;
$clauses = array();
if (!empty($state))
{
$clauses[] = 'state=\''.$state.'\'';
}
if (!empty($id))
{
**$clauses[] = "id='".$id."'";**
}
if (count($clauses))
{
$query .= '
WHERE '. implode(' AND ', $clauses);
}
Hi, I couldn't install piwigo on my mysql 5.6 server that has sql_mode ANSI_QUOTES activated (I need it for other databases). The SQL select * from piwigo_plugins where id="TakeATour" raised an error because of the double quotes and halted the entire installation. I modified the faulty method in include/functions_plugins.inc.php as below to fix the issue, and then had been able to finish the installation.
Regards
Bruno
```
SELECT * FROM '.PLUGINS_TABLE;
$clauses = array();
if (!empty($state))
{
$clauses[] = 'state=\''.$state.'\'';
}
if (!empty($id))
{
**$clauses[] = "id='".$id."'";**
}
if (count($clauses))
{
$query .= '
WHERE '. implode(' AND ', $clauses);
}
```
<!-- github-sync-id:231818585 -->
I'm pretty sure this is not the only place where Piwigo does a where field="value". So it would be better to find a "global" solution. Can you open file include/dblayer/functions_mysqli.inc.php and replace line 83:
I'm pretty sure this is not the only place where Piwigo does a `where field="value"`. So it would be better to find a "global" solution. Can you open file include/dblayer/functions_mysqli.inc.php and replace line 83:
```
$sql_mode_altered = implode(',', array_diff(explode(',', $sql_mode_current), array('ONLY_FULL_GROUP_BY')));
```
by
```
$sql_mode_altered = implode(',', array_diff(explode(',', $sql_mode_current), array('ONLY_FULL_GROUP_BY', 'ANSI_QUOTES')));
```
and tell me if it works any better.
<!-- github-comment-id:305798208 -->
Before i applied your fix, i had found 3 other places in piwigo code where I had to replace double quotes with single quotes to avoid mysql errors due to queries not compliant with ANSI_QUOTES (If you need the details for these 3 queries, let me know).
Then I applied your fix on a new 2.9 install and didn't had no occurence of this problem again while setting up a complete site. Therefore, I think this issue is closed by the $sql_mode_altered fix, thanks.
Bonjour Pierrick,
Before i applied your fix, i had found 3 other places in piwigo code where I had to replace double quotes with single quotes to avoid mysql errors due to queries not compliant with ANSI_QUOTES (If you need the details for these 3 queries, let me know).
Then I applied your fix on a new 2.9 install and didn't had no occurence of this problem again while setting up a complete site. Therefore, I think this issue is closed by the $sql_mode_altered fix, thanks.
<!-- github-comment-id:306725241 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Hi, I couldn't install piwigo on my mysql 5.6 server that has sql_mode ANSI_QUOTES activated (I need it for other databases). The SQL select * from piwigo_plugins where id="TakeATour" raised an error because of the double quotes and halted the entire installation. I modified the faulty method in include/functions_plugins.inc.php as below to fix the issue, and then had been able to finish the installation.
Regards
Bruno
I'm pretty sure this is not the only place where Piwigo does a
where field="value". So it would be better to find a "global" solution. Can you open file include/dblayer/functions_mysqli.inc.php and replace line 83:by
and tell me if it works any better.
Bonjour Pierrick,
Before i applied your fix, i had found 3 other places in piwigo code where I had to replace double quotes with single quotes to avoid mysql errors due to queries not compliant with ANSI_QUOTES (If you need the details for these 3 queries, let me know).
Then I applied your fix on a new 2.9 install and didn't had no occurence of this problem again while setting up a complete site. Therefore, I think this issue is closed by the $sql_mode_altered fix, thanks.