title: OPcache interned strings buffer size lower than "opcache.interned_strings_buffer"
body: <p>I recognised that the interned strings buffer size, reported by <code>opcache_get_status()</code> is always smaller than the assigned value of <code>opcache.interned_strings_buffer</code>, returned also by <code>opcache_get_configuration()</code>. Using the following small script for comparison:</p>
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  $config = opcache_get_configuration();
  $status = opcache_get_status(false);
  echo '&lt;pre&gt;Assigned interned strings buffer: ' . (( $config['directives']['opcache.interned_strings_buffer'] * 1024**2 )) . PHP_EOL;
  echo 'Reported interned strings buffer: ' . $status['interned_strings_usage']['buffer_size'];
  </code></pre>
  <p>I get the following results, increasing the assigned config value in steps:</p>
  <pre><code>Assigned interned strings buffer: 4194304
  Reported interned strings buffer: 3145304
  
  Assigned interned strings buffer: 5242880
  Reported interned strings buffer: 4193880
  
  Assigned interned strings buffer: 7340032
  Reported interned strings buffer: 6291032
  
  Assigned interned strings buffer: 8388608
  Reported interned strings buffer: 6291032
  
  Assigned interned strings buffer: 12582912
  Reported interned strings buffer: 10485336
  
  Assigned interned strings buffer: 13631488
  Reported interned strings buffer: 11533912
  
  Assigned interned strings buffer: 14680064
  Reported interned strings buffer: 12582488
  
  Assigned interned strings buffer: 15728640
  Reported interned strings buffer: 13631064
  
  Assigned interned strings buffer: 16777216
  Reported interned strings buffer: 12582488
  
  Assigned interned strings buffer: 17825792
  Reported interned strings buffer: 13631064
  
  Assigned interned strings buffer: 18874368
  Reported interned strings buffer: 14679640
  
  Assigned interned strings buffer: 20971520
  Reported interned strings buffer: 16776792
  </code></pre>
  <p>Interesting steps are:</p>
  <ul>
  <li><strong>7 to 8 MiB</strong>, where resulting buffer size stays the same 6291032 <strong>bytes</strong></li>
  <li><strong>15 to 16 MiB</strong>, where the resulting status reports a decreasing value, so that <strong>14 and 16 MiB</strong> assigned buffer leads to the same <strong>12582488</strong> bytes and <strong>15 and 17 MiB</strong> match as well with <strong>13631064</strong> bytes.</li>
  </ul>
  <p>Comparing the single MiB steps shows that the reported size is increased by exactly 1 MiB as expected, but when a power of 2 is reached, and internal logic seems to reduce the resulting interned strings buffer size to match quite precisely 75% of the assigned value. For larger values this than means that higher assigned values can lead to a lower buffer size.</p>
  <p>The overall OPcache size btw is 128 MiB with plenty of free space during these tests, so an impact of that is basically ruled out.</p>
  <p>I observe this on PHP7.3, PHP7.4, PHP8.0 and PHP8.1, the builds shipped by the Debian repository. I guess this is an expected behaviour across all PHP OPcache implementations, as it follows quite some logic, but I couldn't find it documented anywhere and it might cause quite some confusion, at least it did for me.</p>
  <p>Another mismatch of the max accelerated files is explained in the PHP documentation (not the assigned value, but the next larger match of a set of prime numbers is used), but for the interned strings buffer, there is no additional explanation: <a href="https://www.php.net/manual/opcache.configuration.php#ini.opcache.interned-strings-buffer" rel="nofollow noreferrer">https://www.php.net/manual/opcache.configuration.php#ini.opcache.interned-strings-buffer</a></p>
  <p><strong>Probably someone can better explain the logic and intention behind this?</strong> If so, we could extend the PHP documentation to cover this case, or request a different logic which does not involve the negative (numerical) impact of higher assigned <code>opcache.interned_strings_buffer</code> values.</p>