Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in Unsupported. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#52074 - [php] crash with OPCache

Attached to Project: Arch Linux
Opened by Sebastiaan Lokhorst (lonaowna) - Wednesday, 07 December 2016, 20:27 GMT
Last edited by Doug Newgard (Scimmia) - Friday, 13 January 2017, 00:32 GMT
Task Type Bug Report
Category Packages: Testing
Status Closed
Assigned To Pierre Schmitz (Pierre)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Since PHP 7.1, when enabling OPCache, the following trivial piece of code crashes:

function f($x, $y){
if($y<0) $x/$y;

Reproduce by enabling OPCache with the following lines in /etc/php/php.ini:

Create the file mentioned above and run it with "php file.php". (You might need to run it a few times; it seems to matter if it's ran from the cached version or not.)

On PHP 7.0, this runs fine. (gives no output as expected)

On PHP 7.1, the following happens:
Floating point exception (core dumped)
This task depends upon

Closed by  Doug Newgard (Scimmia)
Friday, 13 January 2017, 00:32 GMT
Reason for closing:  Fixed
Additional comments about closing:  php 7.1.1RC1-1
Comment by Jan de Groot (JGC) - Wednesday, 07 December 2016, 22:47 GMT
Your example makes no sense. First of all, opcache destroys its cache when php exits. Besides that, your example only defines a function and doesn't execute anything.
Comment by Sebastiaan Lokhorst (lonaowna) - Wednesday, 07 December 2016, 22:55 GMT
Exactly: the script does nothing, so it should absolutely not crash.

I don't know what opcache.enable_cli=1 does, but this script crashes with it set to 1, and doesn't with it set to 0.
To be clear: it also crashes when I run the same PHP script through Apache (with OPCache enabled), but I thought this was simpler to reproduce.
Comment by Daniel M. Capella (polyzen) - Thursday, 08 December 2016, 10:11 GMT
> Enables the opcode cache for the CLI version of PHP. This is mostly useful for testing and debugging.
Comment by Jan de Groot (JGC) - Thursday, 08 December 2016, 10:44 GMT Comment by Sebastiaan Lokhorst (lonaowna) - Thursday, 08 December 2016, 10:51 GMT
Yes, that seems to be it! Strange I hadn't found those bugs myself...
Comment by Pierre Schmitz (Pierre) - Thursday, 08 December 2016, 19:51 GMT
I have noticed a few issues esp. with Opcache during testing which is why PHP 7.1 was not yet released into [extra] yet. I'll have a look at the recent changes to the Opcache extension and see if it stabilizes.
Comment by Sebastiaan Lokhorst (lonaowna) - Thursday, 12 January 2017, 18:48 GMT
Confirmed fixed in php 7.1.1RC1-1 :)