Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Right, so, taking a further look at this, it seems the following is the proper fix instead of simply commenting-out line 23 of:

    wp-content/plugins/w3-total-cache/inc/functions/plugin.php

    Thereby restoring partial functionality to W3 Total Cache, do this instead:

    1)
    Make sure the old fix is in-place:

    https://www.itnota.com/fixing-php7-compatibility-issue-w3-total-cache/

    2)
    Update the following files:

    wp-content/plugins/w3-total-cache/lib/W3/PgCache.php:    function ob_callback(&$buffer) {
    wp-content/plugins/w3-total-cache/lib/W3/Plugin/NewRelic.php:    function ob_callback(&$buffer) {
    wp-content/plugins/w3-total-cache/lib/W3/Plugin/Cdn.php:    function ob_callback(&$buffer) {
    wp-content/plugins/w3-total-cache/lib/W3/Plugin/BrowserCache.php:    function ob_callback(&$buffer) {
    wp-content/plugins/w3-total-cache/lib/W3/Plugin/Minify.php:    function ob_callback(&$buffer) {

    Such that:

    function ob_callback(&$buffer) {

    becomes:

    function ob_callback($buffer) {

    If you’re paying attention, this is the exact same fix the original itnota.com fix applies, just extending it to everything else in the wp-content/plugins/w3-total-cache/lib/W3 directory and Plugin subdirectory. I have no idea why this is necessary specifically with PHP 7.0.9 and not with 7.0.8 and earlier PHP 7 minor versions, but it appears to be the case.

    At any rate, once you’ve transposed everything in wp-content/plugins/w3-total-cache/lib/W3 and the Plugin subdirectory as noted above, and restarted php-fpm (etc.), W3 Total Cache appears to function as expected, persisting cache as expected as well.

    Same issue with PHP 7.0.9 as supplied by dotdeb on Debian Jessie. I did this:

    Make sure the old fix is in-place:

    https://www.itnota.com/fixing-php7-compatibility-issue-w3-total-cache/

    Then, on line 23 of:

    wp-content/plugins/w3-total-cache/inc/functions/plugin.php

    Just comment it out:

    #$value = call_user_func($callback, $value);

    Restart php-fpm, etc. The whitescreen issue should be resolved. W3 Total Cache appears to be functional as well. For instance I’m using memcache with it and it’s clearly caching objects in memcached. The page source footer is also in-place indicating it’s functioning as expected:

    <!– Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

    Page Caching using memcached
    Database Caching using memcached
    Object Caching 2299/2590 objects using memcached

    There may be a more desirable fix, I’m not aware of the full implications of commenting that line out, but the plugin does appear to work just doing that. Hopefully this plugin gets properly updated for PHP 7 some time in the near future, piecemeal fixes are getting old.

    Edit: On further inspection, this “fix” appears to resolve the whitescreen issue and the plugin functions and populates the cache, but doesn’t actually persist the cache on subsequent page loads. In other words, at least the Page Cache is regenerated on each page load. Still, better than nothing for the time being. Hopefully there is a better solution someone else chimes-in with.

Viewing 2 replies - 1 through 2 (of 2 total)