Closed barbayellow closed 1 month ago
@barbayellow could you provide the complete log line please? There should be a stack trace.
Here is the full output:
root@hostname:/var/www/nextcloud# sudo -u www-data php occ tables:remove 2
An unhandled exception has been thrown:
TypeError: OCA\Tables\Db\Row2Mapper::getFilterExpression(): Argument #2 ($column) must be of type OCA\Tables\Db\Column, null given, called in /var/www/nextcloud/apps/tables/lib/Db/Row2Mapper.php on line 286 and defined in /var/www/nextcloud/apps/tables/lib/Db/Row2Mapper.php:310
Stack trace:
#0 /var/www/nextcloud/apps/tables/lib/Db/Row2Mapper.php(286): OCA\Tables\Db\Row2Mapper->getFilterExpression()
#1 /var/www/nextcloud/apps/tables/lib/Db/Row2Mapper.php(263): OCA\Tables\Db\Row2Mapper->getFilter()
#2 /var/www/nextcloud/apps/tables/lib/Db/Row2Mapper.php(241): OCA\Tables\Db\Row2Mapper->getFilterGroups()
#3 /var/www/nextcloud/apps/tables/lib/Db/Row2Mapper.php(143): OCA\Tables\Db\Row2Mapper->addFilterToQuery()
#4 /var/www/nextcloud/apps/tables/lib/Db/Row2Mapper.php(825): OCA\Tables\Db\Row2Mapper->getWantedRowIds()
#5 /var/www/nextcloud/apps/tables/lib/Service/RowService.php(535): OCA\Tables\Db\Row2Mapper->countRowsForView()
#6 /var/www/nextcloud/apps/tables/lib/Service/ViewService.php(413): OCA\Tables\Service\RowService->getViewRowsCount()
#7 /var/www/nextcloud/apps/tables/lib/Service/ViewService.php(90): OCA\Tables\Service\ViewService->enhanceView()
#8 /var/www/nextcloud/apps/tables/lib/Service/ViewService.php(462): OCA\Tables\Service\ViewService->findAll()
#9 /var/www/nextcloud/apps/tables/lib/Service/TableService.php(420): OCA\Tables\Service\ViewService->deleteAllByTable()
#10 /var/www/nextcloud/apps/tables/lib/Command/RemoveTable.php(67): OCA\Tables\Service\TableService->delete()
#11 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(298): OCA\Tables\Command\RemoveTable->execute()
#12 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run()
#13 /var/www/nextcloud/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#14 /var/www/nextcloud/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#15 /var/www/nextcloud/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run()
#16 /var/www/nextcloud/console.php(100): OC\Console\Application->run()
#17 /var/www/nextcloud/occ(11): require_once('...')
@barbayellow thank you for reporting =)
Quick fix in https://github.com/nextcloud/tables/pull/1196
Hi thx for the fix. I applied it manually (wget the modified files directly on github + change owner and rights afterwards on our nextcloud instance). Unfortunately, I still have the same error :
sudo -u www-data php /var/www/nextcloud/occ tables:remove 2
An unhandled exception has been thrown:
TypeError: OCA\Tables\Db\Row2Mapper::getFilterExpression(): Argument #2 ($column) must be of type OCA\Tables\Db\Column, null given, called in /var/www/nextcloud/apps/tables/lib/Db/Row2Mapper.php on line 286 and defined in /var/www/nextcloud/apps/tables/lib/Db/Row2Mapper.php:310
Stack trace:
#0 /var/www/nextcloud/apps/tables/lib/Db/Row2Mapper.php(286): OCA\Tables\Db\Row2Mapper->getFilterExpression()
#1 /var/www/nextcloud/apps/tables/lib/Db/Row2Mapper.php(263): OCA\Tables\Db\Row2Mapper->getFilter()
#2 /var/www/nextcloud/apps/tables/lib/Db/Row2Mapper.php(241): OCA\Tables\Db\Row2Mapper->getFilterGroups()
#3 /var/www/nextcloud/apps/tables/lib/Db/Row2Mapper.php(143): OCA\Tables\Db\Row2Mapper->addFilterToQuery()
#4 /var/www/nextcloud/apps/tables/lib/Db/Row2Mapper.php(825): OCA\Tables\Db\Row2Mapper->getWantedRowIds()
#5 /var/www/nextcloud/apps/tables/lib/Service/RowService.php(535): OCA\Tables\Db\Row2Mapper->countRowsForView()
#6 /var/www/nextcloud/apps/tables/lib/Service/ViewService.php(413): OCA\Tables\Service\RowService->getViewRowsCount()
#7 /var/www/nextcloud/apps/tables/lib/Service/ViewService.php(90): OCA\Tables\Service\ViewService->enhanceView()
#8 /var/www/nextcloud/apps/tables/lib/Service/ViewService.php(462): OCA\Tables\Service\ViewService->findAll()
#9 /var/www/nextcloud/apps/tables/lib/Service/TableService.php(420): OCA\Tables\Service\ViewService->deleteAllByTable()
#10 /var/www/nextcloud/apps/tables/lib/Command/RemoveTable.php(67): OCA\Tables\Service\TableService->delete()
#11 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(298): OCA\Tables\Command\RemoveTable->execute()
#12 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run()
#13 /var/www/nextcloud/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#14 /var/www/nextcloud/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#15 /var/www/nextcloud/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run()
#16 /var/www/nextcloud/console.php(100): OC\Console\Application->run()
#17 /var/www/nextcloud/occ(11): require_once('...')
Hope it helps.
@barbayellow May I ask how you replaced the files? Also, would you be comfortable running a database query?
@blizzz I could run a database query, just had this problem happen to me, some users are now unable to load tables and im unable to delete these affected tables
Here's the error log when trying to access:
{"reqId":"IWQUKugpKOnrxoovMdpp","level":3,"time":"2024-07-16T16:54:53+00:00","remoteAddr":"x.x.x.x","user":"admin","app":"index","method":"GET","url":"/apps/tables/view","message":"OCA\\Tables\\Db\\Row2Mapper::getFilterExpression(): Argument #2 ($column) must be of type OCA\\Tables\\Db\\Column, null given, called in /var/www/html/custom_apps/tables/lib/Db/Row2Mapper.php on line 286 in file '/var/www/html/custom_apps/tables/lib/Db/Row2Mapper.php' line 310","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:124.0) Gecko/20100101 Firefox/124.0","version":"29.0.3.4","exception":{"Exception":"Exception","Message":"OCA\\Tables\\Db\\Row2Mapper::getFilterExpression(): Argument #2 ($column) must be of type OCA\\Tables\\Db\\Column, null given, called in /var/www/html/custom_apps/tables/lib/Db/Row2Mapper.php on line 286 in file '/var/www/html/custom_apps/tables/lib/Db/Row2Mapper.php' line 310","Code":0,"Trace":[{"file":"/var/www/html/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Tables\\Controller\\ViewController"],"indexSharedWithMe"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":338,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Tables\\Controller\\ViewController","indexSharedWithMe",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["tables.view.indexsharedwithme"]]},{"file":"/var/www/html/lib/base.php","line":1050,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/tables/view"]},{"file":"/var/www/html/index.php","line":49,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","Line":170,"Previous":{"Exception":"TypeError","Message":"OCA\\Tables\\Db\\Row2Mapper::getFilterExpression(): Argument #2 ($column) must be of type OCA\\Tables\\Db\\Column, null given, called in /var/www/html/custom_apps/tables/lib/Db/Row2Mapper.php on line 286","Code":0,"Trace":[{"file":"/var/www/html/custom_apps/tables/lib/Db/Row2Mapper.php","line":286,"function":"getFilterExpression","class":"OCA\\Tables\\Db\\Row2Mapper","type":"->","args":[["OC\\DB\\QueryBuilder\\QueryBuilder"],null,null,""]},{"file":"/var/www/html/custom_apps/tables/lib/Db/Row2Mapper.php","line":263,"function":"getFilter","class":"OCA\\Tables\\Db\\Row2Mapper","type":"->","args":[["OC\\DB\\QueryBuilder\\QueryBuilder"],[[null,null,""]]]},{"file":"/var/www/html/custom_apps/tables/lib/Db/Row2Mapper.php","line":241,"function":"getFilterGroups","class":"OCA\\Tables\\Db\\Row2Mapper","type":"->","args":[["OC\\DB\\QueryBuilder\\QueryBuilder"],[[[null,null,""]]]]},{"file":"/var/www/html/custom_apps/tables/lib/Db/Row2Mapper.php","line":143,"function":"addFilterToQuery","class":"OCA\\Tables\\Db\\Row2Mapper","type":"->","args":[["OC\\DB\\QueryBuilder\\QueryBuilder"],[[[null,null,""]]],"admin"]},{"file":"/var/www/html/custom_apps/tables/lib/Db/Row2Mapper.php","line":825,"function":"getWantedRowIds","class":"OCA\\Tables\\Db\\Row2Mapper","type":"->","args":["admin",3,[[[null,null,""]]]]},{"file":"/var/www/html/custom_apps/tables/lib/Service/RowService.php","line":535,"function":"countRowsForView","class":"OCA\\Tables\\Db\\Row2Mapper","type":"->","args":[["OCA\\Tables\\Db\\View",4],"admin",[["OCA\\Tables\\Db\\Column",14],["OCA\\Tables\\Db\\Column",15],["OCA\\Tables\\Db\\Column",16],["OCA\\Tables\\Db\\Column",17],["OCA\\Tables\\Db\\Column",18]]]},{"file":"/var/www/html/custom_apps/tables/lib/Service/ViewService.php","line":413,"function":"getViewRowsCount","class":"OCA\\Tables\\Service\\RowService","type":"->","args":[["OCA\\Tables\\Db\\View",4],"admin"]},{"file":"/var/www/html/custom_apps/tables/lib/Service/ViewService.php","line":139,"function":"enhanceView","class":"OCA\\Tables\\Service\\ViewService","type":"->","args":[["OCA\\Tables\\Db\\View",4],"admin"]},{"file":"/var/www/html/custom_apps/tables/lib/Service/ViewService.php","line":171,"function":"find","class":"OCA\\Tables\\Service\\ViewService","type":"->","args":[4,false,"admin"]},{"file":"/var/www/html/custom_apps/tables/lib/Controller/ViewController.php","line":62,"function":"findSharedViewsWithMe","class":"OCA\\Tables\\Service\\ViewService","type":"->","args":["admin"]},{"file":"/var/www/html/custom_apps/tables/lib/Controller/Errors.php","line":16,"function":"OCA\\Tables\\Controller\\{closure}","class":"OCA\\Tables\\Controller\\ViewController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/custom_apps/tables/lib/Controller/ViewController.php","line":61,"function":"handleError","class":"OCA\\Tables\\Controller\\ViewController","type":"->","args":[["Closure"]]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":232,"function":"indexSharedWithMe","class":"OCA\\Tables\\Controller\\ViewController","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":138,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Tables\\Controller\\ViewController"],"indexSharedWithMe"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Tables\\Controller\\ViewController"],"indexSharedWithMe"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":338,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Tables\\Controller\\ViewController","indexSharedWithMe",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["tables.view.indexsharedwithme"]]},{"file":"/var/www/html/lib/base.php","line":1050,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/tables/view"]},{"file":"/var/www/html/index.php","line":49,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/custom_apps/tables/lib/Db/Row2Mapper.php","Line":310},"message":"OCA\\Tables\\Db\\Row2Mapper::getFilterExpression(): Argument #2 ($column) must be of type OCA\\Tables\\Db\\Column, null given, called in /var/www/html/custom_apps/tables/lib/Db/Row2Mapper.php on line 286 in file '/var/www/html/custom_apps/tables/lib/Db/Row2Mapper.php' line 310","exception":[],"CustomMessage":"OCA\\Tables\\Db\\Row2Mapper::getFilterExpression(): Argument #2 ($column) must be of type OCA\\Tables\\Db\\Column, null given, called in /var/www/html/custom_apps/tables/lib/Db/Row2Mapper.php on line 286 in file '/var/www/html/custom_apps/tables/lib/Db/Row2Mapper.php' line 310"},"id":"6696a74ae2040"}
And when trying to remove directly with occ:
An unhandled exception has been thrown:
TypeError: OCA\Tables\Db\Row2Mapper::getFilterExpression(): Argument #2 ($column) must be of type OCA\Tables\Db\Column, null given, called in /var/www/html/custom_apps/tables/lib/Db/Row2Mapper.php on line 286 and defined in /var/www/html/custom_apps/tables/lib/Db/Row2Mapper.php:310
Stack trace:
#0 /var/www/html/custom_apps/tables/lib/Db/Row2Mapper.php(286): OCA\Tables\Db\Row2Mapper->getFilterExpression(Object(OC\DB\QueryBuilder\QueryBuilder), NULL, NULL, '')
#1 /var/www/html/custom_apps/tables/lib/Db/Row2Mapper.php(263): OCA\Tables\Db\Row2Mapper->getFilter(Object(OC\DB\QueryBuilder\QueryBuilder), Array)
#2 /var/www/html/custom_apps/tables/lib/Db/Row2Mapper.php(241): OCA\Tables\Db\Row2Mapper->getFilterGroups(Object(OC\DB\QueryBuilder\QueryBuilder), Array)
#3 /var/www/html/custom_apps/tables/lib/Db/Row2Mapper.php(143): OCA\Tables\Db\Row2Mapper->addFilterToQuery(Object(OC\DB\QueryBuilder\QueryBuilder), Array, '')
#4 /var/www/html/custom_apps/tables/lib/Db/Row2Mapper.php(825): OCA\Tables\Db\Row2Mapper->getWantedRowIds('', 3, Array)
#5 /var/www/html/custom_apps/tables/lib/Service/RowService.php(535): OCA\Tables\Db\Row2Mapper->countRowsForView(Object(OCA\Tables\Db\View), '', Array)
#6 /var/www/html/custom_apps/tables/lib/Service/ViewService.php(413): OCA\Tables\Service\RowService->getViewRowsCount(Object(OCA\Tables\Db\View), '')
#7 /var/www/html/custom_apps/tables/lib/Service/ViewService.php(90): OCA\Tables\Service\ViewService->enhanceView(Object(OCA\Tables\Db\View), '')
#8 /var/www/html/custom_apps/tables/lib/Service/ViewService.php(462): OCA\Tables\Service\ViewService->findAll(Object(OCA\Tables\Db\Table), '')
#9 /var/www/html/custom_apps/tables/lib/Service/TableService.php(420): OCA\Tables\Service\ViewService->deleteAllByTable(Object(OCA\Tables\Db\Table), '')
#10 /var/www/html/custom_apps/tables/lib/Command/RemoveTable.php(67): OCA\Tables\Service\TableService->delete(3, '')
#11 /var/www/html/3rdparty/symfony/console/Command/Command.php(298): OCA\Tables\Command\RemoveTable->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/html/3rdparty/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /var/www/html/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Tables\Command\RemoveTable), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /var/www/html/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /var/www/html/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /var/www/html/console.php(102): OC\Console\Application->run()
#17 /var/www/html/occ(11): require_once('/var/www/html/c...')```
Listing all tables via OCC does list all of them
Sure, I pulled the modified files directly from github using wget and copied it in their destination directory. I then gave the ownership back to www-data, gave the according rights, delete the previous files and renamed the newly downloaded files with the original names.
No pb to run a database query. We don't have any sensitive data (yet) in the tables application.
@PlaryWasTaken Could you run select id, filter from oc_tables_views where id = 4;
?
@barbayellow and could you run select id, filter from oc_tables_views where table_id = 2;
?
If there is stuff in the result you do not want public it is totally fine to obfuscate it. Just keep the data types in place, please :)
@PlaryWasTaken Could you run
select id, filter from oc_tables_views where id = 4;
?@barbayellow and could you run
select id, filter from oc_tables_views where table_id = 2;
?If there is stuff in the result you do not want public it is totally fine to obfuscate it. Just keep the data types in place,
I couldnt let the company just stop, so i ended up deleting the offending view directly in the database, although i have the result of the query select * from oc_tables_views
would that be fine?
id | columns | sort | filter
----+---------------------+---------------------------------+---------------------------------------------------------
1 | [1,2,3,4] | [] | []
2 | [17,14,15,-4,16,18] | [] | [[{"columnId":-2,"operator":"is-equal","value":"@me"}]]
4 | [17,16,18,14,15,-1] | [{"columnId":-4,"mode":"DESC"}] | [[{"columnId":null,"operator":null,"value":""}]]
Heres the result with all the views included and some of the columns removed (But id and filter are still there)
@PlaryWasTaken the issue is the empty column in the filter of id 4. This should definitely be fixed with https://github.com/nextcloud/tables/pull/1196 however.
MariaDB [mynextclouddatabasename]> select id, filter from oc_tables_views where table_id = 2;
+----+--------------------------------------------------+
| id | filter |
+----+--------------------------------------------------+
| 6 | [[{"columnId":null,"operator":null,"value":""}]] |
| 7 | [[{"columnId":null,"operator":null,"value":""}]] |
+----+--------------------------------------------------+
2 rows in set (0,000 sec)
Sure, I pulled the modified files directly from github using wget and copied it in their destination directory. I then gave the ownership back to www-data, gave the according rights, delete the previous files and renamed the newly downloaded files with the original names. No pb to run a database query. We don't have any sensitive data (yet) in the tables application.
Okay, please try this:
https://patch-diff.githubusercontent.com/raw/nextcloud/tables/pull/1196.diff
cd /path/to/nextcloud/apps/tables/
patch -p1 < /path/to/1196.diff
Steps to reproduce
OCA\Tables\Db\Row2Mapper::getFilterExpression(): Argument #2 ($column) must be of type OCA\Tables\Db\Column, null given
Expected behavior
The table should be erased and new tables should be able to be created
Actual behavior
When trying to erase a table using using occ:tables:erase tableid, I get stuck with an error : OCA\Tables\Db\Row2Mapper::getFilterExpression(): Argument #2 ($column) must be of type OCA\Tables\Db\Column, null given
Tables app version
0.7.4
Browser
Firefox 127.0.2
Client operating system
Linux Elementary OS
Operating system
Ubuntu 20.04.6 LTS
Web server
Apache
PHP engine version
PHP 8.1
Database
MySQL
Additional info
No response