diff --git a/howto/wp-cli-stdin-eval-and-wpengine-gateway-quoting.md b/howto/wp-cli-stdin-eval-and-wpengine-gateway-quoting.md new file mode 100644 index 0000000..3ae159b --- /dev/null +++ b/howto/wp-cli-stdin-eval-and-wpengine-gateway-quoting.md @@ -0,0 +1,56 @@ +--- +summary: "How to pipe PHP/SQL to wp-cli over the WP Engine SSH gateway — wp eval - does not read stdin (use wp eval-file - with a 'wp eval-file -' +``` + +## 2. WP Engine gateway strips one quoting layer from argv + +The gateway wraps the ssh command string in an extra `bash -c` evaluation. One layer of quotes/escapes is consumed before the command runs, so argv-embedded PHP/SQL — even `printf %q`-escaped — gets word-split or syntax-errors remotely. Diagnostic signature: + +``` +$ ssh pld 'echo "echo 1;" | wp eval -' +bash: -c: line 1: syntax error near unexpected token `|' +bash: -c: line 1: `echo echo 1; | wp eval -' # ← quotes already gone +``` + +**Rule: payloads ride stdin, never argv.** Stdin passes through untouched: + +```bash +printf '