Bug #79729 [Opn]: Strings missing last character (Apache + OPcache)
| From: | nikic@php.net | Date: | Wed, 24 Jun 2020 10:30:09 +0000 |
| Subject: | Bug #79729 [Opn]: Strings missing last character (Apache + OPcache) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-227620@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79729&edit=1
ID: 79729
Updated by: nikic@php.net
Reported by: ca at lsp dot net
Summary: Strings missing last character (Apache + OPcache)
Status: Open
Type: Bug
Package: opcache
Operating System: Windows 10
PHP Version: 7.3.19
Block user comment: N
Private report: N
New Comment:
Does opcache.optimization_level=0 fix the issue?
Previous Comments:
------------------------------------------------------------------------
[2020-06-24 10:18:17] ca at lsp dot net
Description:
------------
I observed a very strange behaviour in combination with Apache + OPcache today.
My colleague was using the test instance of our PHP application this morning (no deployment since
yesterday), and it was working fine, until suddenly the following error appeared (and didn't
disappear anymore):
```
Error: Uncaught --> Smarty: Plugin 'cut_hea' not callable
```
The string "cut_hea" doesn't exist in our code base, but instead comes from a class
constant string array containing the element "cut_head":
```
class SmartyModifiers
{
const MODIFIERS = [
"cut_head",
...
];
public static function cut_head( ... )
{
...
}
}
```
This class constant is being used as follows:
```
foreach (SmartyModifiers::MODIFIERS as $modifier) {
$ref = SmartyModifiers::class . '::' . $modifier;
$this->registerPlugin("modifier", $modifier, $ref);
}
```
The error was logged inside the
registerPlugin method, because
SmartyModifiers::cut_hea (without the "d") doesn't exist and is
therefore not callable.
Now, as if this wasn't strange enough, the corresponding Sentry event also contained the same
anomaly:
```
There was 1 error encountered while processing this event
* environmen: Discarded unknown attribute
```
(Note the missing "t" in "environmen" vs. "environment".)
To mitigate the issue, I tried to opcache_reset() and restart the Apache server, but
both didn't solve the issue. The only solution I found was to disable
zend_extension=php_opcache.dll temporarily (disable, restart, enable, restart).
Our OPcache configuration is as follows, following the recommendations from [1]:
```
[opcache]
zend_extension=php_opcache.dll
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1
```
[1] https://www.php.net/manual/de/opcache.installation.php
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79729&edit=1