Again, the issue is that a semi-colon somewhere in the string of a value fools the transformer into thinking that's the end of the key-value declaration which results in a corrupt wp-config.php file and winds up taking down a Wordpress site.
Is this just a matter of including the ending newline character at the end of each search string (e.g. after the semi-colon) so it matches right to the end of the line instead of stopping part-way? Then including a newline character at the end of the replace? Any other implications here?
Duplicate of https://github.com/wp-cli/config-command/issues/83 but entered into appropriate repo for tracking.
Again, the issue is that a semi-colon somewhere in the string of a value fools the transformer into thinking that's the end of the key-value declaration which results in a corrupt wp-config.php file and winds up taking down a Wordpress site.
WPConfigTransformer.php - Line 199-203 $contents = preg_replace( sprintf( '/(?<=^|;|<\?php\s|<\?\s)(\s*?)%s/m', preg_quote( trim( $old_src ), '/' ) ), '$1' . str_replace( '$', '\$', trim( $new_src ) ), $this->wp_config_src );
Is this just a matter of including the ending newline character at the end of each search string (e.g. after the semi-colon) so it matches right to the end of the line instead of stopping part-way? Then including a newline character at the end of the replace? Any other implications here?