BoldGrid / w3-total-cache

GNU General Public License v2.0
153 stars 86 forks source link

Cannot access offset of type string lib/Minify/Minify/Cache/File.php:164 #759

Closed jamieburchell closed 1 year ago

jamieburchell commented 1 year ago

Occasionally, when I deploy a website which has W3TC installed and run wp w3-total-cache flush all I end up with blank CSS files being referenced in the HTML and this PHP fatal exception:

PHP Fatal error:  Uncaught TypeError: Cannot access offset of type string on string in /var/www/web/app/plugins/w3-total-cache/lib/Minify/Minify/Cache/File.php:164
Stack trace:
#0 /var/www/web/app/plugins/w3-total-cache/lib/Minify/Minify/Cache/File.php(69): W3TCL\Minify\Minify_Cache_File->fetch('f2c56.js')
#1 /var/www/web/app/plugins/w3-total-cache/lib/Minify/Minify.php(313): W3TCL\Minify\Minify_Cache_File->store('f2c56.js', Array)
#2 /var/www/web/app/plugins/w3-total-cache/Minify_MinifiedFileRequestHandler.php(236): W3TCL\Minify\Minify::serve(Object(W3TCL\Minify\Minify_Controller_MinApp), Array)
#3 /var/www/web/app/plugins/w3-total-cache/Minify_Plugin.php(97): W3TC\Minify_MinifiedFileRequestHandler->process('f2c56.js')
#4 /var/www/web/wp/wp-includes/class-wp-hook.php(310): W3TC\Minify_Plugin->init('')
#5 /var/www/web/wp/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters(NULL, Array)
#6 /var/www/web/wp/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#7 /var/www/web/wp/wp-settings.php(632): do_action('init')
#8 /var/www/web/wp-config.php(9): require_once('/var/www/vhosts...')
#9 /var/www/web/wp/wp-load.php(55): require_once('/var/www/vhosts...')
#10 /var/www/web/wp/wp-blog-header.php(13): require_once('/var/www/vhosts...')
#11 /var/www/web/index.php(6): require('/var/www/vhosts...')
#12 {main}
  thrown in /var/www/web/app/plugins/w3-total-cache/lib/Minify/Minify/Cache/File.php on line 164
mavas84 commented 1 year ago

Hello @jamieburchell

Thank you for taking the time to report this. As you can see, the fix is in place and this will be added in the upcoming release. It would be great if you could test this and let us know if the fix works for you!

Thanks!