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

Error returns code 0 #2392

Closed
garak opened this issue Jan 28, 2021 · 4 comments · Fixed by #2402
Closed

Error returns code 0 #2392

garak opened this issue Jan 28, 2021 · 4 comments · Fixed by #2402
Labels

Comments

@garak
Copy link
Contributor

garak commented Jan 28, 2021

  • Deployer version: 7.0.0-beta.13
  • Deployment OS: Ubuntu 20.04

I'm getting following error

TypeError in Stringify.php on line 67:
Argument 1 passed to Deployer\Support\Stringify::escape() must be of the type string, bool given, called in phar:///home/circleci/app/bin/dep/src/Support/Stringify.php on line 35

See attached image:
Schermata da 2021-01-28 11-17-55

apart from weird error, I would expect that such case would return a code different from zero (otherwise I'm not able to notice that something went wrong)

@antonmedv
Copy link
Member

Can you show you deploy.php? Or provide some example?

@antonmedv antonmedv added the bug label Jan 28, 2021
@garak
Copy link
Contributor Author

garak commented Jan 28, 2021

I'm not sure my config can be relevant (apart from the error on escape, that's secondary).
The main problem here is that deployer is not taking into account exceptions/errors to give a proper return code.

@cafferata
Copy link
Contributor

It's in the Deployer options --no-ansi, --ansi, --no-interaction

<?php

namespace Deployer;

require_once __DIR__.'/vendor/deployer/deployer/recipe/symfony.php';

set('repository', '[email protected]:deployphp/deployer.git');

$host = host('deployer.org');
$host->setRemoteUser('test');
$host->setDeployPath('/var/www/');
./vendor/bin/dep deploy --no-ansi
Deployer\Support\Stringify::escape(): Argument #1 ($token) must be of type string, bool given, called in /Users/cafferata/jcid/deployphp/deployer/vendor/deployer/deployer/src/Support/Stringify.php on line 35
./vendor/bin/dep deploy --ansi
Deployer\Support\Stringify::escape(): Argument #1 ($token) must be of type string, bool given, called in /Users/cafferata/jcid/deployphp/deployer/vendor/deployer/deployer/src/Support/Stringify.php on line 35
./vendor/bin/dep deploy --no-interaction
Deployer\Support\Stringify::escape(): Argument #1 ($token) must be of type string, bool given, called in /Users/cafferata/jcid/deployphp/deployer/vendor/deployer/deployer/src/Support/Stringify.php on line 35

@cafferata
Copy link
Contributor

cafferata commented Feb 5, 2021

I can't (yet) oversee the impact of this commit 18bdfc8#diff-b872a77de62f6d05e055c5c2c19e0175ad4b9f4075531eee37dcba67a6d3cea8R63

Dump of $input->getOptions():

array:18 [
  "tag" => null
  "revision" => null
  "branch" => null
  "option" => []
  "limit" => null
  "no-hooks" => false
  "plan" => false
  "start-from" => null
  "log" => null
  "profile" => null
  "help" => false
  "quiet" => false
  "verbose" => false
  "version" => false
  "ansi" => true
  "no-ansi" => false
  "no-interaction" => true
  "file" => null
]
            foreach ($option as $value) {
+                if(is_bool($value)){
+                    $options[] = "--$name";
+                    continue;
+                }
+
                $options[] = "--$name " . self::escape((string)$value);
            }

Output of Stringify::options() before/after:

-"--ansi 1 --decorated"
+"--ansi --decorated"

antonmedv added a commit that referenced this issue Mar 6, 2021
…2402)

* Boolean options should not go through the `self::escape` function.

> Deployer\Support\Stringify::escape(): Argument #1 ($token) must be of type string, bool given

Fixes #2392.

* Update StringifyTest.php

* Update StringifyTest.php

Co-authored-by: Anton Medvedev <[email protected]>
ostrolucky pushed a commit to ostrolucky/deployer that referenced this issue Mar 6, 2021
…eployphp#2402)

* Boolean options should not go through the `self::escape` function.

> Deployer\Support\Stringify::escape(): Argument deployphp#1 ($token) must be of type string, bool given

Fixes deployphp#2392.

* Update StringifyTest.php

* Update StringifyTest.php

Co-authored-by: Anton Medvedev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants