Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid table name in queries #238

Open
dschoschu opened this issue Jan 16, 2025 · 0 comments
Open

Invalid table name in queries #238

dschoschu opened this issue Jan 16, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@dschoschu
Copy link

Q A
auditor version 3.3.2
PHP version 8.2
Database PostgreSQL

Summary

In #196 the generation of tables names for the doctrine migrations were fixed. But the issue continues to exist in the viewer and when trying to insert audit data.

Wenn editing an entity:

doctrine.DEBUG: Executing statement: INSERT INTO "user"_audit (type, object_id, discriminator, transaction_hash, diffs, blame_id, blame_user, blame_user_fqdn, blame_user_firewall, ip, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (parameters: array{"1":"update","2":"0192f730-c971-70b0-b08b-4ede7b9e80e8","3":null,"4":"df03e9ca59a2efdd26721e4854be68e7a2b5bdc2 ....

When opening the viewer for an entity with double quotes:

[2025-01-16T12:43:45.094318+01:00] request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\SyntaxErrorException: "An exception occurred while executing a query: SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "at" LINE 1: SELECT * FROM "user"_audit at ORDER BY created_at DESC, id D... ^" at ExceptionConverter.php line 62 {"exception":"[object] (Doctrine\DBAL\Exception\SyntaxErrorException(code: 7): An exception occurred while executing a query: SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "at"\nLINE 1: SELECT * FROM "user"_audit at ORDER BY created_at DESC, id D...\n ^ at /var/www/html/app/vendor/doctrine/dbal/src/Driver/API/PostgreSQL/ExceptionConverter.php:62)\n[previous exception] [object] (Doctrine\DBAL\Driver\PDO\Exception(code: 7): SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "at"\nLINE 1: SELECT * FROM "user"_audit at ORDER BY created_at DESC, id D...\n ^ at /var/www/html/app/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:28)\n[previous exception] [object] (PDOException(code: 42601): SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "at"\nLINE 1: SELECT * FROM "user"_audit at ORDER BY created_at DESC, id D...\n ^ at /var/www/html/app/vendor/doctrine/dbal/src/Driver/PDO/Connection.php:57)"}

Current behavior

No audit data is inserted for entity with special names and the viewer for these entites throws an exception when accessing it.

How to reproduce

Edit an entity with a special name like user or open the viewer for such an entity.

Expected behavior

Audit data is inserted and the viewer is accessible.

@dschoschu dschoschu added the bug Something isn't working label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant