<table role="table">
<thead>
<tr>
<th>Q</th>
<th>A</th>
</tr>
</thead>
<tbody>
<tr>
<td>Bug report?</td>
<td>yes</td>
</tr>
<tr>
<td>Feature request?</td>
<td>no</td>
</tr>
<tr>
<td>BC Break report?</td>
<td>yes</td>
</tr>
<tr>
<td>RFC?</td>
<td>no</td>
</tr>
<tr>
<td>Symfony version</td>
<td>2.7.39</td>
</tr>
</tbody>
</table>
<p dir="auto">Behat tests started failing because of this issue (see <a href="https://travis-ci.org/Behat/Behat/jobs/324067796#L612" rel="nofollow">here</a>).</p>
<p dir="auto">The following command started displaying a help message, instead of running the test suite:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="behat --no-colors -sbig_brother -fpretty --format-settings='{\&quot;paths\&quot;: true}' features"><pre class="notranslate"><code class="notranslate">behat --no-colors -sbig_brother -fpretty --format-settings='{\"paths\": true}' features
</code></pre></div>
<p dir="auto">The cause of the issue seems to be <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="274419790" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/24987" data-hovercard-type="pull_request" data-hovercard-url="/symfony/symfony/pull/24987/hovercard" href="https://github.com/symfony/symfony/pull/24987">#24987</a> which allowed grouping short options. <code class="notranslate">-sbig_brother</code> contains the "h" letter which is treated as <code class="notranslate">-h</code> and the <code class="notranslate">Application</code> assumes it needs to display a help message:</p>
<p dir="auto"></p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/symfony/symfony/blob/7b4d519885e9a8272c8d8690933e4be352c75954/src/Symfony/Component/Console/Application.php#L164-L172">symfony/src/Symfony/Component/Console/Application.php</a>
    </p>
    <p class="mb-0 color-fg-muted">
        Lines 164 to 172
      in
      <a data-pjax="true" class="commit-tease-sha" href="/symfony/symfony/commit/7b4d519885e9a8272c8d8690933e4be352c75954">7b4d519</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L164" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="164"></td>
          <td id="LC164" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s1"><span class="pl-c1">$</span>name</span> = <span class="pl-s1"><span class="pl-c1">$</span><span class="pl-smi">this</span></span>-&gt;<span class="pl-en">getCommandName</span>(<span class="pl-s1"><span class="pl-c1">$</span>input</span>); </td>
        </tr>

        <tr class="border-0">
          <td id="L165" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="165"></td>
          <td id="LC165" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">if</span> (<span class="pl-c1">true</span> === <span class="pl-s1"><span class="pl-c1">$</span>input</span>-&gt;<span class="pl-en">hasParameterOption</span>(<span class="pl-en">array</span>(<span class="pl-s">'--help'</span>, <span class="pl-s">'-h'</span>))) { </td>
        </tr>

        <tr class="border-0">
          <td id="L166" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="166"></td>
          <td id="LC166" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-k">if</span> (!<span class="pl-s1"><span class="pl-c1">$</span>name</span>) { </td>
        </tr>

        <tr class="border-0">
          <td id="L167" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="167"></td>
          <td id="LC167" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">         <span class="pl-s1"><span class="pl-c1">$</span>name</span> = <span class="pl-s">'help'</span>; </td>
        </tr>

        <tr class="border-0">
          <td id="L168" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="168"></td>
          <td id="LC168" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">         <span class="pl-s1"><span class="pl-c1">$</span>input</span> = <span class="pl-k">new</span> <span class="pl-v">ArrayInput</span>(<span class="pl-en">array</span>(<span class="pl-s">'command'</span> =&gt; <span class="pl-s">'help'</span>)); </td>
        </tr>

        <tr class="border-0">
          <td id="L169" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="169"></td>
          <td id="LC169" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     } <span class="pl-k">else</span> { </td>
        </tr>

        <tr class="border-0">
          <td id="L170" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="170"></td>
          <td id="LC170" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">         <span class="pl-s1"><span class="pl-c1">$</span><span class="pl-smi">this</span></span>-&gt;<span class="pl-c1">wantHelps</span> = <span class="pl-c1">true</span>; </td>
        </tr>

        <tr class="border-0">
          <td id="L171" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="171"></td>
          <td id="LC171" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     } </td>
        </tr>

        <tr class="border-0">
          <td id="L172" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="172"></td>
          <td id="LC172" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> } </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<table role="table">
<thead>
<tr>
<th>Q</th>
<th>A</th>
</tr>
</thead>
<tbody>
<tr>
<td>Bug report?</td>
<td>yes</td>
</tr>
<tr>
<td>Feature request?</td>
<td>no</td>
</tr>
<tr>
<td>BC Break report?</td>
<td>yes</td>
</tr>
<tr>
<td>RFC?</td>
<td>yes</td>
</tr>
<tr>
<td>Symfony version</td>
<td>3.4.2 (and others)</td>
</tr>
</tbody>
</table>
<p dir="auto"><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="274419790" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/24987" data-hovercard-type="pull_request" data-hovercard-url="/symfony/symfony/pull/24987/hovercard" href="https://github.com/symfony/symfony/pull/24987">#24987</a> introduced a bug in hasParameterOption. If a short option has a value, then hasParameterOption will search the value for additional short options.</p>
<p dir="auto"><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="281859208" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/25487" data-hovercard-type="pull_request" data-hovercard-url="/symfony/symfony/pull/25487/hovercard" href="https://github.com/symfony/symfony/pull/25487">#25487</a> submitted a fix for this bug, but the fix appears to be incorrect.</p>
<p dir="auto">The current implementation of <code class="notranslate">parseShortOption</code> is as follows:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    /**
     * Parses a short option.
     *
     * @param string $token The current token
     */
    private function parseShortOption($token)
    {
        $name = substr($token, 1);

        if (strlen($name) &gt; 1) {
            if ($this-&gt;definition-&gt;hasShortcut($name[0]) &amp;&amp; $this-&gt;definition-&gt;getOptionForShortcut($name[0])-&gt;acceptValue()) {
                // an option with a value (with no space)
                $this-&gt;addShortOption($name[0], substr($name, 1));
            } else {
                $this-&gt;parseShortOptionSet($name);
            }
        } else {
            $this-&gt;addShortOption($name, null);
        }
    }"><pre class="notranslate"><code class="notranslate">    /**
     * Parses a short option.
     *
     * @param string $token The current token
     */
    private function parseShortOption($token)
    {
        $name = substr($token, 1);

        if (strlen($name) &gt; 1) {
            if ($this-&gt;definition-&gt;hasShortcut($name[0]) &amp;&amp; $this-&gt;definition-&gt;getOptionForShortcut($name[0])-&gt;acceptValue()) {
                // an option with a value (with no space)
                $this-&gt;addShortOption($name[0], substr($name, 1));
            } else {
                $this-&gt;parseShortOptionSet($name);
            }
        } else {
            $this-&gt;addShortOption($name, null);
        }
    }
</code></pre></div>
<p dir="auto">In particular, note the <code class="notranslate">substr($name, 1)</code>. If there is a short option <code class="notranslate">-e</code> that takes a value, then <code class="notranslate">-etest</code> will provide the value <code class="notranslate">test</code> to the <code class="notranslate">-e</code> option. See also the implementation of <code class="notranslate">parseShortOptionSet</code>, which has similar logic. No <code class="notranslate">=</code> is assumed or accounted for.</p>
<p dir="auto"><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="281859208" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/25487" data-hovercard-type="pull_request" data-hovercard-url="/symfony/symfony/pull/25487/hovercard" href="https://github.com/symfony/symfony/pull/25487">#25487</a> fixed the bug of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="274419790" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/24987" data-hovercard-type="pull_request" data-hovercard-url="/symfony/symfony/pull/24987/hovercard" href="https://github.com/symfony/symfony/pull/24987">#24987</a> by assuming that the value of a short option was formatted as <code class="notranslate">-e=test</code>; however, this is inconsistent with the implementation of the parsing functions.</p>
<p dir="auto">My testing seems to uphold these observations, but please LMK if I have made an error somewhere. I'm not sure if there is a better solution than reverting <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="274419790" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/24987" data-hovercard-type="pull_request" data-hovercard-url="/symfony/symfony/pull/24987/hovercard" href="https://github.com/symfony/symfony/pull/24987">#24987</a>.</p>