Bug #77310 [Opn]: Variable values incorrect when Opcache enabled

From: Date: Thu, 20 Dec 2018 15:13:02 +0000
Subject: Bug #77310 [Opn]: Variable values incorrect when Opcache enabled
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218532@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77310&edit=1 ID: 77310 Updated by: cmb@php.net Reported by: taylor at laravel dot com Summary: Variable values incorrect when Opcache enabled Status: Open Type: Bug Package: opcache Operating System: Multiple PHP Version: 7.3.0 Block user comment: N Private report: N New Comment: Can you please check with the fix for that bug[1] applied? Instead of applying the fix yourself, you can also test with PHP 7.3.1RC1[2] (announcement including hashes and signatures will follow shortly). Anyhow, this issue might also be related to bug #76937. [1] <http://git.php.net/?p=php-src.git;a=commit;h=93aabf1533bd3af673bb59cf283e6599ced3ab9a> [2] <http://downloads.php.net/~cmb/> Previous Comments: ------------------------------------------------------------------------ [2018-12-20 11:57:17] taylor at laravel dot com Might be duplicate / similar issue as: https://bugs.php.net/bug.php?id=77275 ------------------------------------------------------------------------ [2018-12-17 16:59:26] nikic@php.net Off-topic comment by spam2 at rhsoft dot net deleted. ------------------------------------------------------------------------ [2018-12-17 16:50:43] taylor at laravel dot com We have temporarily worked around this by referencing $this->app within the Closure which is set to the same value that $app was previously. So, Laravel >= 5.7.18 should not be affected by this; however, I am worried the bug could affect other areas of code we haven't discovered yet. ------------------------------------------------------------------------ [2018-12-17 15:08:36] taylor at laravel dot com Wanted to add this has been seen on Ubuntu and Mac. ------------------------------------------------------------------------ [2018-12-17 15:05:57] taylor at laravel dot com Description: ------------ We received multiple bug reports to the Laravel framework Git issue tracker and I was able to confirm the following bug on my own machine as well. GitHub thread is here: https://github.com/laravel/framework/issues/26819 Laravel's dependency injection container uses Closures to resolve objects. We are encountering a bug in the following section of code: https://gist.github.com/taylorotwell/2a0934fcd5bb59e74640c9e451e69ec4 A $mailer instance is created on line 6... However, we when we interact with the mailer on line 11, PHP throws an error that the setQueue method does not exist on the Container object (which is the $app variable). It appears PHP thinks the $mailer variable is the $app variable. I am able to resolve the error by disabling Opcache entirely. With Opcache enabled, I will get the error fairly frequently, although it does seem to sometimes resolve itself. It will always reappear if I restart PHP-FPM and Opcache is enabled. I'm not sure of the best way to create a small, re-producable example of the bug. However, it seems to be affecting many users and be entirely Opcache related. Expected result: ---------------- PHP should call the setQueue method on the $mailer variable which is an instance of Mailer. Actual result: -------------- PHP calls the setQueue method on the value of the $app variable. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77310&edit=1

« previous php.bugs (#218532) next »