Hinweis: Dieser Artikel wurde ursprünglich veröffentlicht in 2015. Einige Schritte, Befehle oder Softwareversionen haben sich möglicherweise geändert. Überprüfen Sie die aktuelle Dokumentation von Plugins für die neuesten Informationen.

Resolved: Warnung: Parameter 1 to W3_Plugin_TotalCache::ob_callback() expected to be a reference, value given in /wp-includes/functions.php on line 3282

As you probably know (otherwise you would probably not be here), after deciding to move form PHP to HHVM, if you are running a WordPress site and use W3 Total Cache you will encounter an endless number of errors all revolving ob_callback() expecting a reference:

[] \nWarnung: Parameter 1 to W3_Plugin_TotalCache::ob_callback() expected to be a reference, value given in /wp-includes/functions.php on line 3282

I have good and bad news for you. The good news is that there is a fix for this (yay!) The bad news is that next time you update or re-install W3 Total Cache you might or will need to perform this fix again. I know, it is a pain but thus far this is the best answer I could find (or rather, the only one).

So basically what we are going to do is fix some W3 Total Cache php code so that this warning does not show again. I recommend you back up your system just in case something goes wrong; and by system I think just your plugins directory or the file we are going to modify should suffice.

The file we need to modify is located here (relatively speaking, change /var/www/ for your site’s actual www root):

/var/www/wp-content/plugins/w3-total-cache/lib/W3/Plugin/TotalCache.php

Now, one you have opened the file on your favorite text editor (say nano), look for the following line (for me it is on line 512):

function ob_callback(&$buffer) {

The key here is to change the parameter to just $buffer, like so:

function ob_callback($buffer) {

This should take care of the issue. If you look at the error log (/var/log/hhvm/error.log) you’ll notice. In my case I had several messages per second so with tail -f**/var/log/hhvm/error.log** you can tell it is working. Hope this worked for you too!

Zusammenfassung

Verwandte Artikel