8000 [Console] [TableHelper] [SymfonyStyle] - Array to String Conversion when using IO Table · Issue #18573 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Console] [TableHelper] [SymfonyStyle] - Array to String Conversion when using IO Table #18573

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

Closed
lakhman opened this issue Apr 17, 2016 · 0 comments

Comments

@lakhman
Copy link
lakhman commented Apr 17, 2016

I found a bug with the SymfonyStyle Console IO helper relating to the TableHelper.

Let's say we're creating a new table, 2 ways, manually and with the SymfonyStyle Helper.

$headers = array(
    array(new TableCell('Main table title', array('colspan' => 3))),
    array('ISBN', 'Title', 'Author'),
);

$rows = array(
    array(
        '978-0521567817',
        'De Monarchia',
        new TableCell("Dante Alighieri\nspans multiple rows", array('rowspan' => 2)),
    ),
    array('978-0804169127', 'Divine Comedy'),
);

// The following works fine (when creating a regular table via the `Table` class)
$table = new Table($output);
$table->setHeaders($headers)->setRows($rows);
$table->render();

// Notice: Array to string conversion 
$io = new SymfonyStyle($input, $output);
$io->table($headers, $rows);

The issue seems to be down to this line: (looks like an easy fix)

https://github.com/symfony/console/blob/master/Style/SymfonyStyle.php#L216

Hopefully someone can create and apply a patch for future versions.

P.S: I love the SymfonyStyle Helper! Really Awesome DX initiative. I'd love to see a DX initiative to redesign the dev error page!

ping!: @javiereguiluz

fabpot added a commit that referenced this issue Apr 20, 2016
…itboudad)

This PR was merged into the 2.7 branch.

Discussion
----------

[Console] [TableHelper] make it work with SymfonyStyle.

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | no
| Fixed tickets | #18573
| License       | MIT
| Doc PR        | ~

Commits
-------

43cc93c [Console] [TableHelper] make it work with SymfonyStyle.
@fabpot fabpot closed this as completed Apr 20, 2016
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

4 participants
0