wp-cli / wp-config-transformer

Programmatically edit a wp-config.php file
MIT License
81 stars 25 forks source link

Fix regex for closing syntax in string #9

Closed frankiejarrett closed 5 years ago

frankiejarrett commented 5 years ago

Long story short of this is that occassionally the ) and ; chars will end up right next to one another during salt generation and this will cause things to blow up badly.

The root of the problem was not preferring string values within quotes first before attempting to match everything within the statement. So this PR improves the regex to do just that.

Consider the following constant value in wp-config.php:

define( 'AUTH_SALT', 'abc);123' ); // <--- a perfectly valid salt value

If you try to run $ wp config shuffle-salts you will get a success in the console but your site will break in dramatic fashion.

schlessera commented 5 years ago

Pushed bugfix to new release v1.2.3.

frankiejarrett commented 5 years ago

Thank you, @schlessera!