Skip to content

Conversation

@ejulen
Copy link
Contributor

@ejulen ejulen commented Oct 26, 2022

See #601. This adds a new flag, --log-level, to the octane:roadrunner command.

Was asked to provide an explanation as to why this broke; it was, simply put, due to an operator precedence issue added in the second commit.

'logs.level='.$this->option('log-level') ?: (app()->environment('local') ? 'debug' : 'warn')

Will result in logs.level= (no actual level) if no --log-level option is given instead of falling back to the old behaviour, due to . having higher precedence than ?:.

Adding parentheses fixes this:

'logs.level='.($this->option('log-level') ?: (app()->environment('local') ? 'debug' : 'warn'))

It's perhaps easiest to see with a simpler example:

'foo' . null ?: 'bar'

Results in foo, while

'foo' . (null ?: 'bar')

Results in foobar.

@taylorotwell taylorotwell merged commit 82a5b68 into laravel:1.x Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants