Migration to new ttrss instance: OPML export fails on old instance

I am still using an old ttrss instance where the README.md files explains the installation as follows:

git clone https://git.tt-rss.org/fox/ttrss-docker-compose.git ttrss-docker && cd ttrss-docker

Today I decided to set up a new ttrss instance on a fresh Debian 12.5 server. I followed the steps of the current Installation Guide: create .env and docker-compose.yml and set up an nginx reverse proxy. Everything worked perfectly, withoud the slightest problem.

My plan was to then do an OPML export on the old instance and import that on the new instance. But unfortunately the export does not work on the old instance.

The ttrss UI shows the following error in its “event log”:

  • Error: E_ERROR (1)

  • Filename: classes/feeds.php:1367

  • Message:

Uncaught TypeError: Feeds::_get_cat_title(): Argument #1 ($cat_id) must be of type int, null given, called in /var/www/html/tt-rss/classes/feeds.php on line 1225 and defined in /var/www/html/tt-rss/classes/feeds.php:1367
Stack trace:
#0 /var/www/html/tt-rss/classes/feeds.php(1225): Feeds::_get_cat_title()
#1 /var/www/html/tt-rss/classes/opml.php(211): Feeds::_get_title()
#2 /var/www/html/tt-rss/classes/opml.php(18): OPML->opml_export()
#3 /var/www/html/tt-rss/backend.php(136): OPML->export()
#4 {main}
  thrown

The information about the old instance where the problem occurs is:

  • tt-rss version (including git commit id):
    Tiny Tiny RSS https://tt-rss.org/ v21.12-97baf3e8b © 2005-2024 Andrew Dolgov

  • Platform (i.e. Linux distro, PHP, PostgreSQL, etc) versions:
    Debian 10.13 (Buster) with docker 24.0.6 and docker-compose 1.29.2, PHP Version 8.0.13

I understand that it may be difficult to help me because my problem occurs on an old version of ttrss. However, perhaps someone has some advice on how I can transfer my feeds and settings to the new instance?

Quick and dirty, you could update line 211 of classes/opml.php:

diff --git a/classes/opml.php b/classes/opml.php
index b9f5f2eab..cf1e43990 100644
--- a/classes/opml.php
+++ b/classes/opml.php
@@ -208,7 +208,7 @@ class OPML extends Handler_Protected {
 					if (!$tmp_line["match_on"]) {
 						if ($cat_filter && $tmp_line["cat_id"] || $tmp_line["feed_id"]) {
 							$tmp_line["feed"] = Feeds::_get_title(
-								$cat_filter ? $tmp_line["cat_id"] : $tmp_line["feed_id"],
+								$cat_filter && $tmp_line["cat_id"] ? $tmp_line["cat_id"] : $tmp_line["feed_id"],
 								$cat_filter);
 						} else {
 							$tmp_line["feed"] = "";

Alternatively, not including settings in the export should also work.

Looks like there’s some legacy stuff involving filter rules and categories that should probably be cleaned up at some point.

Hi @wn_name, you are my hero! :+1:

Thank you very much. After applying your patch, the OPML export worked as one would normally expect.

Problem solved. Now I can use my new instance of ttrss.