Skip to content

Pass1 statically binds constants at compile time in namespace #17865

@bwoebi

Description

@bwoebi

Description

The following trivial variation of test ext/opcache/tests/bug66251.phpt, ran with opcache:

<?php
namespace X;
printf ("A=%s\n", getA());
const A="hello";
function getA() {return A;}

Resulted in this output:

A=hello

But I expected this output instead:

Fatal error: Uncaught Error: Undefined constant "X\A" in %s:5
Stack trace:
#0 %s(2): X\getA()
#1 {main}
  thrown in %s on line 5

Apparently c2c78dc has changed it from checking from generic DO_FCALL to only ICALL, which made this test pass, but only in the specific tested scenario.

PHP Version

PHP 8.4

Operating System

No response

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