Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
EntityResourceTestBase tests fail randomly. See https://www.drupal.org/pift-ci-job/564977. I think this has only been seen on PHP7.
Comments
Comment #2
alexpottOne thing I've noticed that has changed is that we're seeing
in the logs. This will be because the browser is run by root and can write anywhere so now it's doing browser output for functional php unit tests and just dumping the stuff in the root. oh boy.
Comment #3
Wim LeersThis is probably related to #2832853: Random fail in hal EntityTestHalJsonAnonTest::testPost via rest EntityResourceTestBase::testPost. I closed that because I hadn't seen it happen in more than two weeks. EDIT: but that was on PHP 5.5, so perhaps not.
Comment #4
alexpottOn a local CI I can get the fail all the time. Adding some var_dumps() to:
Output
Request:
Response
Response body:
Comment #5
alexpottSo there are two apache error logs here is what is in them:
And
The second looks like the error but weird...
Comment #6
Wim LeersEh… wtf. If I search for the string
or the string , I find absolutely nothing. Where is this coming from? :OApparently it's an Apache thing: https://duckduckgo.com/?q=%22The+server+encountered+an+internal+error+or...
Can you check your Apache error log?
Comment #7
alexpottLooking at how Guzzle sends JSON from the client...
We're missing
$options['_conditional']['Content-Type'] = 'application/json';
Comment #8
alexpottSo this fixes
Drupal\Tests\hal\Functional\EntityResource\Block\BlockHalJsonCookieTest
and the other tests using the \Drupal\Tests\rest\Functional\CookieResourceTestTrait::initAuthentication().Now we just have a problem when we send unparseable bodies... these issues are all being caused by a recent addition to PHP7 see https://github.com/php/php-src/commit/9b65a10256e244a6d80027c943b163dd16... and https://github.com/php/php-src/pull/2180
Comment #9
alexpottSo when I run
Drupal\Tests\rest\Functional\EntityResource\User\UserJsonAnonTest
I get the same issue being reported in the error log:This time the test is doing this:
It's the last request here that is failing and that is because
$unparseable_request_body;
contains!{>}<
which ain't JSONComment #11
Wim LeersBut it's intentionally not JSON, hence
$unparseable_request_body
.Comment #12
axot CreditAttribution: axot commentedDoes this unparseable json test does not used POST method?
I create a patch for this case, could you test this?
Comment #13
alexpott@axot - yes it uses the PATCH method!
Comment #14
alexpottMore info available on https://github.com/php/php-src/pull/2180#issuecomment-270602678
Comment #15
axot CreditAttribution: axot as a volunteer commentedI tested the patch, it passed this test case, anyway the bugged commit was revert.
Thank you for reporting the issue, I will commit a new PR to PHP community soon.
Comment #16
Wim LeersThanks @axot!
Comment #17
catchSo are we just waiting for the PHP 7 bot on DrupalCI to refresh with the latest commit?
Comment #18
Wim LeersYep.
Comment #19
Wim LeersComment #20
alexpottWell we should still commit #8 but maybe once PHP7 is rebuilt it won't be critical.
Comment #21
Wim LeersYes, #8 looks great: it's a small correction. But I don't yet understand why this worked fine before and is only now a problem.
Comment #22
alexpott@Wim Leers well obviously something in the PHP7 change made the PHP SAPI stricter.
Comment #23
catchComment #24
Wim LeersIt looks like @catch has re-queued the test patch in #8.
If it comes back green, it's RTBC.
Comment #25
Wim LeersI also added a 8.3.x test. Just making sure it passes there too.
Comment #26
Wim LeersComment #27
axot CreditAttribution: axot as a volunteer commentedHi, I pushed a new PR to PHP community, (https://github.com/php/php-src/pull/2323)
It is great if we could retest this PR, is it possible?
Thank you.
Comment #28
Wim LeersDone: re-testing with PHP 7, against 8.2.x (https://www.drupal.org/pift-ci-job/580021) and 8.3.x (https://www.drupal.org/pift-ci-job/580022)
Comment #29
Berdir@Wim: That's not what axot asked for. He asked to compile PHP based on his PR and then run the tests against *that*. Locally, not on testbot, as testbot obviously can't do that.
Comment #30
Wim LeersIIRC testbot is frequently updated to PHP 7 HEAD. I don't know how frequently though.
Comment #31
BerdirIt doesn't matter how recent HEAD is, it will not contain a PR that has not yet been merged :)
Comment #32
Wim LeersD'oh, I overlooked that! My bad. Sorry for the noise.
Comment #33
axot CreditAttribution: axot as a volunteer commentedThank you guys to follow up this,
I don't know how testbot works, if it could test the git HEAD of php,
Is it possible test a PR use these git commands?
Comment #34
alexpott@axot I've built PHP7 including your PR and the tests that were failing now pass. That's not to say there might be some other effect but at least this issue won't happen again.
Comment #35
axot CreditAttribution: axot as a volunteer commentedThanks to test the PR @alexpott, could you test all the cases to confirm there are no more other side effects. Then we can merge this to PHP side.
Thank you.
Comment #36
alexpott@axot if it was simple to run all test cases locally I would but it's not. We have far too many tests for that.
Comment #37
Wim Leers@axot: if #36 sounds strange, here's a clarification: our test suite takes 26.5 minutes to run at concurrency 31 on the most powerful AWS machines: https://dispatcher.drupalci.org/job/default/308340/consoleFull. Running it locally takes hours.
Comment #38
axot CreditAttribution: axot as a volunteer commented@alexpott @wim-leers That makes sense to me, so let we waiting for code review then.
Thank you.
Comment #41
catchCommitted/pushed to 8.4.x and 8.3.x, thanks!
@axot closing this issue since it deals with the Drupal part of this, thanks for the attention to the PHP bug!
Comment #43
xjm