Hi,

I think I found the issue. The autoloader did not seem to be called at
all for the code path I mentioned. After digging around I found that
lib/phpmailer also uses the autoloader. The autoloader in phpmailer
replaces the one from tt-rss, so it stops working. Using the
spl_autoload_register() to register the autoloading function makes
them coexist and fixes the problem for me. The simple attached patch
changes this.

This is actually unrelated to the original bugreport, but on my system
phpmailer was updated about the same time as php7 was installed, so
they were triggered at the same time.

Med vänliga hälsningar
/Fredrik

2016-03-07 13:26 GMT+01:00 Sebastian Reichel <[email protected]>:
> Hi,
>
> On Fri, Mar 04, 2016 at 10:52:55AM +0100, Fredrik Olofsson wrote:
>> Thanks, the dependencies works better now :-)
>>
>> But I still get the following error when trying to start the daemon.
>> Looks like some kind o search path issue, but I don't know PHP well
>> enough to fix it.
>
> mh... I cannot reproduce your bug (It works for me).
>
>> ...
>> PHP Fatal error:  Uncaught Error: Class 'Db_Prefs' not found in
>> /usr/share/tt-rss/www/include/db-prefs.php:5
>> Stack trace:
>> #0 /usr/share/tt-rss/www/include/digest.php(29):
>> get_pref('DIGEST_ENABLE', '1', false)
>> #1 /usr/share/tt-rss/www/include/rssfuncs.php(219): 
>> send_headlines_digests(true)
>> #2 /usr/share/tt-rss/www/update.php(187): update_daemon_common(50)
>> #3 {main}
>>   thrown in /usr/share/tt-rss/www/include/db-prefs.php on line 5
>> ...
>
> So classes/db/prefs.php is not loaded. It should be autoloaded
> by the __autoload() function in include/autoload.php. Could you
> add some debug prints in there? E.g. replace this part:
>
> ---
> if (file_exists($file)) {
>     require $file;
> }
> ---
>
> with
>
> ---
> if (file_exists($file)) {
>     _debug("autoload class: $file");
>     require $file;
> } else {
>     _debug("cannot find class: $file");
> }
> ---
>
> -- Sebastian
From c90aba3e857f50964abc565fa2b77c0c87c487f7 Mon Sep 17 00:00:00 2001
From: Fredrik Olofsson <[email protected]>
Date: Mon, 7 Mar 2016 19:27:03 +0100
Subject: [PATCH] Use spl_autoload_register() for autoloading.

---
 include/autoload.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/autoload.php b/include/autoload.php
index 505b444..9833c5f 100644
--- a/include/autoload.php
+++ b/include/autoload.php
@@ -1,7 +1,7 @@
 <?php
 	require_once "functions.php";
 
-	function __autoload($class) {
+	spl_autoload_register(function ($class) {
 		$class_file = str_replace("_", "/", strtolower(basename($class)));
 
 		$file = dirname(__FILE__)."/../classes/$class_file.php";
@@ -10,5 +10,5 @@
 			require $file;
 		}
 
-	}
+	})
 ?>
-- 
2.7.0

Reply via email to