Skip to content

Migrated references from Leafo to ScssPhp cause Fatal error - Version 2.0.0 #157

@kinsky-org

Description

@kinsky-org

Hi there! Just spotted an issue after the upgrade to [email protected].
#156 and changing the vendor prefixes from "Leafo" in option keys (qualified class names) in commit 9b7bc1b5d8250580be585cdb1525239ee7ecca1d can cause following consequences:

  1. user already has the old vendor name saved in database as a part of a class name;
  2. user upgrades WP-SCSS plugin to the latest version;
  3. things stop working after reload because the get_option call is still getting that old vendor name as a part of a qualified class name but class doesn't exist anymore.
PHP Fatal error:  Uncaught Error: Class 'Leafo\ScssPhp\Formatter\Crunched' not found in /www/doc/www.example.cz/www/wp-content/plugins/wp-scss_invalid/scssphp/src/Compiler.php:243
Stack trace:
#0 /www/doc/www.example.cz/www/wp-content/plugins/wp-scss_invalid/class/class-wp-scss.php(79): ScssPhp\ScssPhp\Compiler->compile('@import "common...', '/www/doc/www.ex...')
#1 /www/doc/www.example.cz/www/wp-content/plugins/wp-scss_invalid/class/class-wp-scss.php(112): compiler('/www/doc/www.ex...', '/www/doc/www.ex...', Object(Wp_Scss))
#2 /www/doc/www.example.cz/www/wp-content/plugins/wp-scss_invalid/wp-scss.php(196): Wp_Scss->compile()
#3 /www/doc/www.example.cz/www/wp-content/plugins/wp-scss_invalid/wp-scss.php(180): wp_scss_compile()
#4 /www/doc/www.example.cz/www/wp-includes/class-wp-hook.php(287): wp_scss_needs_compiling('')
#5 /www/doc/www.example.cz/www/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array)
#6 /www/doc/www.example.cz/www/wp-includes/plugin.php(484): WP_Hook->do_action(Array)
#7 /www/doc/www.example.cz/www in /www/doc/www.example.cz/www/wp-content/plugins/wp-scss_invalid/scssphp/src/Compiler.php on line 243

If anyone needs it hotfixed it might be done ie. by changing the old option_value in wp_options in the database (option_name='wpscss_options' and option_value LIKE '%Leafo\ScssPhp\Formatter%' => option_value should be changed to 'ScssPhp\ScssPhp\Formatter') or using a filter hook "option_wpscss_options" etc.

Thanks for this plugin and for all your work. I'm sorry I can't help more at the moment, just have to deal with something else too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions