[Filebin-general] Using filebin with PHP 5.3

eye eye at eyenx.ch
Sat Feb 15 17:09:13 CET 2014


Hi

I'm using PHP 5.3 on my synology NAS and I'm running filebin on it.

Since I updated last night, I encountered a problem getting the file page
of a textfile I uploaded. Images or other files don't seem to have a
problem. It's only happening when I try to see a textfile in filebin.

PHP tells me:

[Sat Feb 15 01:56:37 2014] [error] [client 192.168.1.10] PHP Fatal error:
Using $this when not in object context in
/volume1/homes/www/filebin/application/controllers/file.php on line 155,
referer: https:/<myhost>/index.php/file/upload_history

Here the code:

141                 // highlight the file and cache the result
142                 $highlit =
cache_function($filedata['hash'].'_'.$lexer, 100, function() use
($file, $lexer){
143                         $ret = array();
144                         if ($lexer == "rmd") {
145                                 ob_start();
146
147                                 echo '<div class="code content
table markdownrender">'."\n";
148                                 echo '<div class="table-row">'."\n";
149                                 echo '<div class="table-cell">'."\n";
150                                 passthru('perl
'.FCPATH.'scripts/Markdown.pl '.escapeshellarg($file),
$ret["return_value"]);
151                                 echo '</div></div></div>';
152
153                                 $ret["output"] = ob_get_clean();
154                         } else {
155                                 $ret = $this->_colorify($file, $lexer);
156                         }
157
158                         if ($ret["return_value"] != 0) {
159                                 $tmp = $this->_colorify($file, "text");
160                                 $ret["output"] = $tmp["output"];
161                         }
162                         return $ret;
163                 });


After searching for a solution, I saw on
http://php.net/manual/en/functions.anonymous.php that using $this in
anonymous functions is not supported with PHP 5.3, see here:
http://i.imgur.com/inbDb6d.png

I tested a filebin installation on a machine with PHP 5.5 - it works.

Could someone help me get a workaround for PHP 5.3 here? I'm not a PHP dev
so my know how is really minimal.

Thanks

eye
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.server-speed.net/archives/filebin-general/attachments/20140215/ab192e24/attachment.html>


More information about the Filebin-general mailing list