go to bug id or search bugs for
1. I am not 100% if I got the right category for that.
2. I was NOT able to reproduce that intentionally but we obsorved that many, many times in production.
3. This only happens in long-running PHP environments. It does NOT happen with PHPFPM as every request creates a separate PHP runtime. Our observations have been made when serving PHP requests with amp/aerys.
4. It does not happen in EVERY long-running process, but WHEN it happens, the current process is affected until it dies
Single-char vars are instantly dropped / unset.
$f = new Foo();
[E_NOTICE] Undefined variable: f
Call to a member function bar() on null
This does never happen when using variable names with a couple of chars. I didn't find out the exact limit, but as of now I have only seen single-char-vars in logs.
Add a Patch
Add a Pull Request
> Our observations have been made when serving PHP requests with
Would it be possible that the strange behavior is caused by
amphp/aerys in the first place?
If a $var is 'null' one line after its creation. How could that be caused by _any_ userland code?
We triggered this bug again today. Now on PHP 7.2.4.
Many long-running processes (to be more specific: Gearman worker running an Amp-loop) started throwing exceptions: "Undefined variable: m" in this source-file: https://github.com/aws/aws-sdk-php/blob/master/src/Api/Serializer/RestSerializer.php#L112
This source-file is obviously completely unrelated to Amp or our custom codebase. Also it can be assumed to be rather battletested as it is part of the AWS SDK for PHP.
We are reasonable sure that the same process ran through the same function multiple times before the error without throwing the exception.
How often are you seeing this issue? Which extensions are you using? In particular interested in anything using shared memory, such as opcache and apcu.
The servers run with the following modules.
root@php1:~# php -v
PHP 7.2.4-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Apr 5 2018 08:53:57) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.4-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
root@php1:~# php -m
Some thoughts about this: OPcache is enabled of course. There are also 5 less common extensions. We build and package (.deb) them ourselves:
Possibly related to https://bugs.php.net/bug.php?id=76281?