Closed olivierbicler closed 2 years ago
This package is considered feature-complete, and is now in security-only maintenance mode, following a decision by the Technical Steering Committee. If you have a security issue, please follow our security reporting guidelines. If you wish to take on the role of maintainer, please nominate yourself
If you are looking for an actively maintained package alternative, we recommend:
Looks like the wrong platform was configured? The component does quoting based on the configured platform: https://github.com/laminas/laminas-log/blob/4f70c0c5db5066474a240635be188ce6d0337eb3/src/Writer/Db.php#L144
Thanks for your response.
As far I understood, this method returns quoteIdentifier attribute, which is hard coded :
https://github.com/laminas/laminas-db/blob/42e842100ec56501eba4926abcdc57f6da2c9312/src/Adapter/Platform/Mysql.php#L19
protected $quoteIdentifier = ['
', ''];
I'm obviously reluctant to alter code in Laminas, and I wonder if adding Mariadb as a new platform with the proper configuration would not be a nicer solution ? At this time, there is no mariadb platform configured in Laminas.
As you can see from your error message:
check the manual that corresponds to your MariaDB server version for the right syntax to use near '"log" ("created","severity","message","owner_id","context") VALUES ('2022-04-...' at line
So it is using "
instead of the MySQL backticks that you linked: this is because the Mysql
platform is not in use at all in your scenario.
It's probably using the base platform: https://github.com/laminas/laminas-db/blob/42e842100ec56501eba4926abcdc57f6da2c9312/src/Adapter/Platform/Sql92.php
Bug Report
If I try to log something using Laminas library (embedded in Omeka S software), I end up with an exception (Omeka store logs in a database table).
Summary
Current behavior
An exception is thrown
How to reproduce
Log any message.
Expected behavior
Log should be stored in database without any issue.
Identified causes and Workaround
This issue is caused because Mariadb only accepts backtick ` around identifiers by default. Double quote " needs to be specified in SQL_MODE (source) to be accepted. A way (the only way I found, actually) to get rid of this issue is to set SQL_MODE to ANSI_QUOTES.