shell-command
shell-command copied to clipboard
Internal variables bleed over and cause conflicts
I haven't had the chance to dig into this further, but just wanted to log this somewhere to prevent forgetting about it.
Assigning a value to $line in wp shell gives very unexpected results, causing some pretty confusing behavior and bugs.
Behavior:
wp shell
wp> $line = 'this wont work';
=> string(14) 'this wont work'
wp> $line;
=> string(13) "return $line;"
wp> $linetest = 'this will';
=> string(9) "this will"
wp> $linetest;
=> string(9) "this will"
$line is one of the variables that bleed over from the context that evaluates the code that was typed in.
While I don't think we can provide a completely clean context with eval(), we can certainly make sure we're not using something that is as easy to run into conflicts with than $line.
well it looks like this was 3 years ago This is working perfectly fine in mine.
WP-CLI 2.6.0
>>> $line = 'this wont work';
=> "this wont work"
>>> $line;
=> "this wont work"