I am using Torrentflux-b4rt on a local home server, has worked fine for the longest time and just today I started getting a blank page from the index.php, however the admin.php and all sections thereof work just fine.

I followed this: http://www.communitymx.com/content/article.cfm?cid=26071 to get the errors to show up on the page by turning display_errors to ON and setting error_reporting to E_STRICT. Here is what my blank page shows now:

Strict Standards: Non-static method Fluxd::initialize() should not be called statically in /home/bobby2/public_html/torrentflux-b4rt/inc/main.internal.php on line 239 Strict Standards: Non-static method FluxdServiceMod::initializeServiceMod() should not be called statically in /home/bobby2/public_html/torrentflux-b4rt/inc/main.internal.php on line 242 Strict Standards: Non-static method FluxdQmgr::initialize() should not be called statically in /home/bobby2/public_html/torrentflux-b4rt/inc/classes/FluxdServiceMod.php(98) : eval()'d code on line 1 Strict Standards: Non-static method Fluxd::modState() should not be called statically, assuming $this from incompatible context in /home/bobby2/public_html/torrentflux-b4rt/inc/classes/FluxdServiceMod.php on line 122 Strict Standards: Non-static method Xfer::setNewday() should not be called statically in /home/bobby2/public_html/torrentflux-b4rt/inc/main.internal.php on line 247 Strict Standards: Non-static method Xfer::initialize() should not be called statically in /home/bobby2/public_html/torrentflux-b4rt/inc/classes/Xfer.php on line 106

Appreciate any help, thanks.

    with specific third party scripts you are better of posting on there own forum

      Yes but the forum for torrentflux has been dead for some time, so I thought I'd try here. Just wondering if there's anything from that output that can possibly be diagnosed by PHP experts.

        colbert;10976595 wrote:

        Yes but the forum for torrentflux has been dead for some time, so I thought I'd try here. Just wondering if there's anything from that output that can possibly be diagnosed by PHP experts.

        well as the error says don't call Fluxd::initialize statically, i may be an expert, but i lack psychic powers.

          Damn internet, I had a feeling that might appear sarcastic, didn't intend it at all. Thanks for your help, I reckon it's likely with the script and outside of PHP.

            I doubt he found your post sarcastic. However, if you know a little about object oriented programming, the error message is self explanatory. Yet, without having code to look at, there is nothing enabling us to tell you exactly what's wrong, or rather, how to go about fixing it, except for the aforementioned psychic powers.

            For example, let's say I asked you what's wrong here, and that you understood exactly what this error message meant. What could you tell me, without looking at my code, other than the exact same thing that the error message did?

            Strict Standards: Non-static method A::func() should not be called statically in /path/to/script.php on line 47

            Now, let's say I provide you with some code as well...

            error_reporting(-1);
            class A
            {
            	public static function static_func() { echo "I'm static<br/>";}
            	public function func() { echo "I'm non-static<br/>"; }
            }
            
            $a = new A;
            
            A::static_func();		# static method called statically - ok
            $a->static_func();	# static method called non-statically - ok
            
            $a->func();		# non-static method called non-statically - ok
            A::func();			# non-static method called statically - strict standards message  (this is line 47)
            

            Now, you could say the exact same thing again, since A:: implies that I am statically accessing something of class A, and here it happens to be func(), which in the class definition clearly is declared without the static keyword, which means non-statically. You'd just be repeating back to me the same thing that the error message stated, and you'd be right.

            You could however also argue that the function should be declared as static since it does not operate on an instance of A (which is why the above code does execute), as opposed to the following piece of code

            error_reporting(-1);
            class A
            {
            	private static $s = 'static';
            	private $n = 'non-static';
            
            x	public static function static_func() { echo "I'm ".self::$s.'<br/>'; }
            	public function func() { echo "I'm ".$this->n.'<br/>'; }
            }
            
            $a = new A;
            
            A::static_func();	# static method called statically - ok
            $a->static_func();	# static method called non-statically - ok
            
            $a->func();			# non-static method called non-statically - ok
            A::func();			# non-static method called statically - fatal error!
            

            Fatal error: Using $this when not in object context in /path/to/script.php on line 38. Line 38 contains $this->n, and $this refers to this particular object (aka instance of the class) for which we called func(). When you call func as $a->func(), $this refers to object $a. But when you call A::func() there is no object. So $this refers to nothing, or in other words, using $this when not in object context, and "when not in object context" could also be worded "when in static context".

            Now that you do know what my code looks like, it's possible to tell me how to correct things. For example
            1) make func in code example 1 static

            2) do not call it statically (possible solution for code example 1, and the only solution for code example 2).
            Well, at least assuming you cannot change A::$n from non-static to static etc.

              I'm sorry, I'm just not a programmer of any sort and so simple things are eluding me in this respect, hehe. Here is the error I am getting at this point:

              Strict Standards: Non-static method Xfer::setNewday() should not be called statically in /home/bobby2/public_html/torrentflux-b4rt/inc/main.internal.php on line 247 Strict Standards: Non-static method Xfer::initialize() should not be called statically in /home/bobby2/public_html/torrentflux-b4rt/inc/classes/Xfer.php on line 106

              First here is the main.internal.php:

              // schedule next internal maintenance if needed
              if (empty($_SESSION['next_int_maintenance']))
              	$_SESSION['next_int_maintenance'] = time() + 2 * 3600 + mt_rand(-1200, 1200);	// 2h (+/- 20m)
              
              // free space in MB var
              $cfg["free_space"] = @disk_free_space($cfg["path"]) / 1048576;
              
              // drive space var
              $cfg['driveSpace'] = getDriveSpace($cfg["path"]);
              
              // free space formatted var
              $cfg['freeSpaceFormatted'] = formatFreeSpace($cfg["free_space"]);
              
              // Fluxd
              //Fluxd::initialize();
              
              // Qmgr
              //FluxdServiceMod::initializeServiceMod('Qmgr');
              
              // xfer
              if (($cfg['enable_xfer'] == 1) && ($cfg['xfer_realtime'] == 1)) {
              	//set xfer-newday
              	Xfer::setNewday();
              }
              
              // vlib
              require_once("inc/lib/vlib/vlibTemplate.php");
              
              ?>

              Near the bottom there is that setNewday part. Here is the Xfer.php (2nd part of error):

              	/**
              	 * gets new-day
              	 *
              	 * @return int
              	 */
              	function getNewday() {
                  	global $instanceXfer;
                  	return (isset($instanceXfer))
                  		? $instanceXfer->xfer_newday
                  		: 0;
              	}
              
              /**
               * sets new-day
               */
              function setNewday() {
              	global $instanceXfer, $db;
              	// initialize if needed
              	if (!isset($instanceXfer))
              		Xfer::initialize();
              	// set new-day
              	$instanceXfer->xfer_newday = 0;
              	$instanceXfer->xfer_newday = !$db->GetOne('SELECT 1 FROM tf_xfer WHERE date = '.$db->DBDate(time()));
              }

              5th line from bottom of that is the Xfer::initialize(); part.

                Well, I'm not going to fix an entire application. If you can't program, you'd have to either learn to do so, and when you can, I wouldn't mind helping you if you get stuck. Else, I recommend either paying someone to fix the script for you, or even better get a working script somehwere else, and preferably one which is still in production so that you can actually tell the devs about bugs etc and possibly get help as well.

                You should be aware that there are several issues in this short piece of code alone which tells me there's likely to be a lot of work fixint the script.
                Functions making use of globals instead of taking them as arguments is one. Static calls that (seems to be) initializing a global for use on the next line, rather than taking this variable as a return value for use on the next line is another. Incorrect use of static calls to non-static functions is another.

                To summarize, the code is likely to be a real mess since different pieces of code is dependent on other pieces of code through no obvious ways, which will make it painful to debug.

                  Write a Reply...