Skip to content

CoW involved sometimes /w opcache #18600

Closed as not planned
Closed as not planned
@mvorisek

Description

@mvorisek

Description

The following code:

minimal repro repo: https://github.com/atk4/core/tree/debug_ref_change_with_opcache_and_coverage

It contains 2 files.

  • .github/workflows/test-unit.yml - working CI on push
  • repro.php

Resulted in this output:

array(2) {
  [0] =>
  string(40) "4e76db9f1723ab3273cbb0453e6a3886c7ffc04a"
  [1] =>
  string(40) "ef428dd20aa28afe07ce1a36ff921fcfc9fa5baf"
}

But I expected this output instead:

no output - references are the same

My observations when minimalizing the reproducer:

The repro contains simple repro.php reproduced.

When run using the CI, it fails with the unexpected result under these conditions:

  1. xdebug extension is installed
  2. opcache is enabled for CLI

The CoW, ie. references updated, is involved in most runs, but not always. In the CI, I run the repro 10x and with >90% probablity at least one of PHP 8.2/8.3/8.4 job fails.

I am not sure if xdebug needs to be installed, but it helps to reproduce the issue more frequently.

Opcache seems however always needed.

Disabled GC has no impact.

Also it seems the Closure::bind in the repro is needed to reproduce.

Please confirm you can reproduce this issue on your side.

PHP Version

PHP 8.2.28 (cli) (built: May 15 2025 03:24:27) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.28, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.28, Copyright (c), by Zend Technologies
    with Xdebug v3.4.3, Copyright (c) 2002-2025, by Derick Rethans

Operating System

Ubuntu

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions