Dynamic Caching does not work with latest update (1.4.1)
-
I just updated super cache to 1.4.1 and I found my eshop websites broken.
My eshops are using dynamic caching for displaying a not-cached cart.
I am using the technique that is explained in this article:
http://z9.io/2013/10/21/shiny-new-dynamic-content-wp-super-cache/
Did anyone encounter this problem?
-
Have you used the debug log to track what the plugin is doing?
Hi @luxcav have you tested version 1.4.2?
Regards
I find no errors on the cache log, but my php reports this:
[10-Aug-2014 07:41:59 UTC] PHP Warning: Parameter 1 to dynamic_output_buffer_test() expected to be a reference, value given in D:\WebSite Development\AllaboutMobile\Public_HTML\wp-includes\plugin.php on line 470
I am using 1.4.2 now but the problem continues.
I got some reports on the plugin log. Here they are:
07:54:29 / Supercache Late Init: add wp_cache_serve_cache_file to init 07:54:29 / Supercache Late Loader running on init 07:54:29 / wp_cache_get_cookies_values: /^wp-postpass|^comment_author_|^wordpress_logged_in_bfc8e68bc7a5dda64b9ab16e1b3172da/ Cookie detected: wordpress_logged_in_bfc8e68bc7a5dda64b9ab16e1b3172da 07:54:29 / wp-cache file exists: D:\WebSite Development\AllaboutMobile\Public_HTML\wp-content\cache\wp-cache-3d2417f590cc88dcbdd0eb0ddb8f329e.html 07:54:29 / Serving wp-cache dynamic file 07:54:29 / exit request 07:54:32 /wp-admin/admin-ajax.php Supercache Late Init: add wp_cache_serve_cache_file to init 07:54:33 /wp-admin/admin-ajax.php Supercache Late Loader running on init 07:54:33 /wp-admin/admin-ajax.php wp_cache_get_cookies_values: /^wp-postpass|^comment_author_|^wordpress_logged_in_bfc8e68bc7a5dda64b9ab16e1b3172da/ Cookie detected: wordpress_logged_in_bfc8e68bc7a5dda64b9ab16e1b3172da 07:54:33 /wp-admin/admin-ajax.php supercache dir: D:\WebSite Development\AllaboutMobile\Public_HTML/wp-content/cache/supercache/allaboutmobile.copy/wp-admin/admin-ajax.php/ 07:54:33 /wp-admin/admin-ajax.php No Super Cache file found for current URL: D:\WebSite Development\AllaboutMobile\Public_HTML/wp-content/cache/supercache/allaboutmobile.copy/wp-admin/admin-ajax.php/index.html 07:54:33 /wp-admin/admin-ajax.php In WP Cache Phase 2 07:54:33 /wp-admin/admin-ajax.php Setting up WordPress actions 07:54:33 /wp-admin/admin-ajax.php Not caching wp-admin requests.
How are you calling dynamic_output_buffer_test? Are you using add_filter?
Check out how it’s called in the dynamic-cache-test.php, it’s a cacheaction there.
Also, I fixed a bug in that file, grab the development version and copy into wp-super-cache/plugins/
Hello,
I am also having this issue.. The warning doesn’t appear on the local setup of the site.
But once I push the changes to the live site, I get the warning.
It doesn’t appear to affect the function of the dynamic plugin however :S
Any ideas what I may need to do?
luxcav did you get this sorted?
Cheers,
J
I changed the constants which the old script was suggesting (DYNAMIC_OUTPUT_BUFFER_TAG, DYNAMIC_OB_TEXT) to something else and everything worked perfectly.
See below:
define( 'DYN_TAG', 'CONST_TAG' ); // Change this to a secret placeholder tag if ( DYN_TAG != '' ) { if (!function_exists(dynamic_output_buffer_test)) { function dynamic_output_buffer_test( $cachedata = 0) { if ( defined( 'DYN_OB_TEXT' ) ) return str_replace( DYN_TAG, DYN_OB_TEXT, $cachedata ); ob_start(); {do your thing here and you will get dynamic results} ob_end_clean(); if ( $cachedata === 0 ) { define( 'DYN_OB_TEXT', $text ); } else {return str_replace( DYN_TAG, $text, $cachedata );} } } add_cacheaction( 'wpsc_cachedata', 'dynamic_output_buffer_test' ); if (!function_exists(dynamic_output_buffer_init)) { function dynamic_output_buffer_init() { add_action( 'wp_footer', 'dynamic_output_buffer_test' ); } } add_cacheaction( 'add_cacheaction', 'dynamic_output_buffer_init' ); if (!function_exists(dynamic_output_buffer_test_safety)) { function dynamic_output_buffer_test_safety( $safety ) { if ( defined( 'DYN_OB_TEXT' ) ) {return 1;} else {return 0;} } } add_cacheaction( 'wpsc_cachedata_safety', 'dynamic_output_buffer_test_safety' ); }
Cool!
Thanks very much for your response luxcav, did you leave this script in the dynamic_cache_test.php file in the plugins directory for wp-super-cache or did you move it to your themes functions.php?
I will give it a try and let you know how it goes.
Thanks again.
J
Just as an update; I changed the constants as you suggested but I am still receiving the php warning on the live site.
Weird.
Fixed! I realised that in the example script there’s an error..
In the line function dynamic_output_buffer_test( &$cachedata = 0) {
I had to remove the &.
I was having the same problem and also removed the “&” in from the of the
$cachedata
parameter which fixed my issue. It seemed counter intuitive since the error indicates it’s expecting a reference (which the “&” does), but the dynamic caching is working and the error is no longer appearing on my page.Thank you so much, jakus!
hey jakus,
Is it possible where “{do your thing here and you will get dynamic results}” is located to call a file, such as example.php?
Thank you!
Or is there a way to use ajax to do this? Not sure which would be better.
Hi Jay,
I don’t see why you couldn’t use an ‘include example.php’ as the dynamic content?
e.g
<?php include('nameoffile.php'); ?>
For Ajax; you would need to write a bit of additional javascript.
yup that worked, thanks jakus! For some reason i can not run any if statements in the php file that I call. Same goes for if I check if the page is_single or is_home.
Any ideas as to why and any suggested workarounds?
Code example:
if ( is_single() ) {
echo “here”;
}
- The topic ‘Dynamic Caching does not work with latest update (1.4.1)’ is closed to new replies.