wp-cli / shell-command

Opens an interactive PHP console for running and testing PHP code.
MIT License
20 stars 16 forks source link

Path to REPL.php is displayed for any wp shell command #45

Closed GaryJones closed 1 year ago

GaryJones commented 4 years ago

Bug Report

Describe the current, buggy behavior

When doing any command in wp shell when SSH'd into a remote server, I get a path to the WP-CLI REPL file returned to me before the correct output.

Describe how other contributors can replicate this bug

wp> wp_revisions_to_keep( get_post( 3451690 ) );
=> phar:///root/roles/docker-container-web/usr/local/bin/wp/vendor/wp-cli/shell-command/src/WP_CLI/Shell/REPL.php:52:
int(50)

Describe what you would expect as the correct outcome

That this path should not appear when using the simplistic REPL.

wp> wp_revisions_to_keep( get_post( 3451690 ) );
int(50)

Let us know what environment you are running this on

OS: Linux 4.9.0-11-amd64 #1 SMP Debian 4.9.189-3+deb9u1 (2019-09-20) x86_64
Shell:  /bin/bash
PHP binary: /root/roles/nginx-php/usr/local/php7.3/bin.stretch/php
PHP version:    7.3.16
php.ini used:   /usr/local/php7.3/conf/php.ini
WP-CLI root dir:    phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:  phar://wp-cli.phar/vendor
WP_CLI phar path:   /home/vipdev
WP-CLI packages dir:    /home/{redacted}/.wp-cli/packages/
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.4.0

Provide a possible solution

Maybe remove or fix this var_dump()?

eduwass commented 3 years ago

@GaryJones I know this is outdated but this happens to me to.

@schlessera curious to know if that var_dump is in there for a particular reason?

danielbachhuber commented 1 year ago

curious to know if that var_dump is in there for a particular reason?

Here's where it was added: https://github.com/wp-cli/shell-command/commit/4a7f30a36482d4ef2b034ab14bc4eda61b905974

It seems like it was intentional.

I can't get the behavior to reproduce in my shell, though... is there some clear way to reproduce?

eduwass commented 1 year ago

curious to know if that var_dump is in there for a particular reason?

Here's where it was added: 4a7f30a

It seems like it was intentional.

I can't get the behavior to reproduce in my shell, though... is there some clear way to reproduce?

I'm not really sure, posted this a while ago, I tried to reproduce it now without success.

danielbachhuber commented 1 year ago

@GaryJones Any ideas on how to reproduce?

GaryJones commented 1 year ago

I can't recreate this now (even with schlessera/wp-cli-psysh package uninstalled, which is what I have usually now).