php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76937 Drupal tests fail with opcache on
Submitted: 2018-09-26 11:55 UTC Modified: 2021-07-18 04:22 UTC
Votes:3
Avg. Score:4.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:1 (33.3%)
From: alex dot a dot pott at gmail dot com Assigned: cmb (profile)
Status: No Feedback Package: opcache
PHP Version: 7.3.0RC1 OS: OSX
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: alex dot a dot pott at gmail dot com
New email:
PHP Version: OS:

 

 [2018-09-26 11:55 UTC] alex dot a dot pott at gmail dot com
Description:
------------
When running a Drupal test on PHP 7.3 built from PHP-7.3 branch (ie.PHP 7.3.0-dev (cli) (built: Sep 26 2018 11:27:28) ( NTS )) it fails when opcache.enable_cli is 1 and it does not when it is 0.

I've tried to isolate the problem in a smaller script with no Drupal but I've not managed yet.

The script below fails when the opcache settings are:
opcache.enable=1
opcache.enable_cli=1

But passes when they are
opcache.enable=1
opcache.enable_cli=0

Test script:
---------------
git clone --depth 1 --branch 8.7.x https://git.drupal.org/project/drupal.git
cd drupal
composer install
composer run-script drupal-phpunit-upgrade
SIMPLETEST_DB=sqlite://localhost//tmp/drupal.sqlite ./vendor/bin/phpunit -v -c ./core core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-09-26 14:44 UTC] alex dot a dot pott at gmail dot com
If I change code in EntityQueryTest:141  from 

          list($field_name, $langcode, $values) = $units[$key];
          $entity->getTranslation($langcode)->{$field_name}[] = $values;

to

          list($field_name, $langcode, $values) = $units[$key];
          $entity->getTranslation($units[$key][1])->{$units[$key][0]}[] = $units[$key][2];


It works fine. I've tried to produce a snippet that just does the list() and cause the error but I've not been successful yet.
 [2018-12-17 10:02 UTC] matias at avusto dot fi
Also Grav (www.getgrav.org) unit tests fail if opcache is turned on, but run just fine if opcache is turned off. Similar issues can be seen in the sites as well (which also work without opcache just fine).

All the issues seem to be related to Pimple, or offsetGet($id) call which seems to have more or less random value $id passed to it. Sometimes $id = '', sometimes the value of the $id comes from a previous offsetGet() call and once it even had value from the following method call $this->initializeController().. Meaning that the $id = 'initializeController', not $id = 'task' as written in the code. For some reason in the last case making a random change (adding a whitespace) in the affected file fixes the issue until opcache gets cleared.

I'm not sure if the issues are related, is $units an ArrayAccess object?
 [2018-12-17 10:05 UTC] nikic@php.net
@matias: At least in your case, you're probably hitting bug #77275, which will be fixed in the next release.
 [2018-12-17 10:36 UTC] matias at avusto dot fi
Yes, I just confirmed that the issue gets fixed by adding this option to php.ini:

opcache.optimization_level=0x7FFFBBFF

Thank you @nikic!
 [2021-07-08 14:01 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-07-08 14:01 UTC] cmb@php.net
Is the Drupal test still failing with any of the actively
supported PHP versions[1]?

[1] <https://www.php.net/supported-versions.php>
 [2021-07-18 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 09 10:01:28 2024 UTC