Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal variables bleed over and cause conflicts #41

Open
WPprodigy opened this issue Oct 7, 2019 · 2 comments
Open

Internal variables bleed over and cause conflicts #41

WPprodigy opened this issue Oct 7, 2019 · 2 comments

Comments

@WPprodigy
Copy link

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"
@schlessera
Copy link
Member

$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.

@schlessera schlessera transferred this issue from wp-cli/wp-cli Oct 8, 2019
@schlessera schlessera changed the title WP Shell: $line is overwritten, or something. Internal variables bleed over and cause conflicts Oct 8, 2019
@deepyes02
Copy link

deepyes02 commented Aug 22, 2022

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants