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

From: Date: Mon, 17 Dec 2018 15:05:57 +0000
Subject: Bug #77310 [NEW]: Variable values incorrect when Opcache enabled
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218495@lists.php.net to get a copy of this message
From: taylor at laravel dot com Operating system: Multiple PHP version: 7.3.0 Package: opcache Bug Type: Bug Bug description:Variable values incorrect when Opcache enabled 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 bug report at https://bugs.php.net/bug.php?id=77310&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77310&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77310&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77310&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=77310&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=77310&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=77310&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=77310&r=needscript Try newer version: https://bugs.php.net/fix.php?id=77310&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=77310&r=support Expected behavior: https://bugs.php.net/fix.php?id=77310&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=77310&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=77310&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=77310&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77310&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=77310&r=dst IIS Stability: https://bugs.php.net/fix.php?id=77310&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=77310&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=77310&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=77310&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=77310&r=mysqlcfg

« previous php.bugs (#218495) next »