For any fellow SimpleInvoices users – here is a godawful monkeypatch which works around the “blank reports” problem in SI.
A little background: the issue is that phpreports, which is long obsolete code SI uses to generate reports, does call by references in a couple of places. Worse, it does it using the eval() function on a variable populated from an object. I threw up in my mouth a little bit just typing that.
I frankly couldn’t be stuffed to chase everything ALL the way down to the end to find the object method which populates the string and fix IT, but I DID write a simple six line “monkey patch” which at least fixes the output so that reports would work.
In library/phpmaker/PHPReportMaker.php, find the following line:
$sRst = $this->_oProc->run();
And IMMEDIATELY after that line, insert these lines:
// this is a godawful monkeypatch to keep the eval($sRst) line from // trying to do pass-by-reference function calls. This is awful and // I am not proud, but it does at least get reports working again. $pcre_pattern = '/\&\$_o/'; // jrs $pcre_replace = '\$_o'; // jrs $sRst = preg_replace ($pcre_pattern,$pcre_replace,$sRst); // jrs $pcre_pattern = '/\&\$o/'; // jrs $pcre_replace = '\$o'; // jrs $sRst = preg_replace ($pcre_pattern,$pcre_replace,$sRst); // jrs // print $sRst; //jrs debug
This changes the function calls eval()’ed in $sRst from pass-by-reference – which looks like myFunc(&$variable) – to pass-by-value – which looks like myFunc($variable). Simple stuff, and somebody should REALLY chase down the actual code which POPULATES $sRst in the first place and fix it in phpreportmaker, but for the moment, this was enough to get reports working again in my SI.
Hope this helped somebody else.