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

Negative padding #156

Closed
wants to merge 2 commits into from
Closed

Negative padding #156

wants to merge 2 commits into from

Conversation

krzysztofrewak
Copy link

When I switched my application to php:7.4.0-fpm-alpine, I started receiving warnings that completely ruined possibility to use your library. I was using radio() method and after PHP updates these showed up:

Warning: str_repeat(): Second argument has to be greater than or equal to 0 in /application/vendor/league/climate/src/TerminalObject/Dynamic/Checkbox/Checkbox.php on line 177

They've appeared even with the basic implementation:

$cli = new CLImate();
$cli->radio("Test", [1, 2])->prompt();

For some reason calculated length for padding changed to a negative number (-5 for example above). I mapped $length variable to be always non-negative for Checkbox class' padding.

I had no problems with other components, so I'm leaving them as they are.

@duncan3dc duncan3dc added the bug label Dec 1, 2019
@duncan3dc
Copy link
Member

Hi @krzysztofrewak thanks for the pull request, this bug was caused by this code using the system object directly instead of via the utility factory which handles a default value when no terminal width is available.
A fix for this issue has been released in version 3.5.2 now

@duncan3dc duncan3dc closed this Dec 1, 2019
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 this pull request may close these issues.

None yet

2 participants