Skip to content

Namespaced function is not honored when already called #17116

@mvorisek

Description

@mvorisek

Description

The following code:

online repro: https://3v4l.org/A5kUZ

bugs.php.net issue: https://bugs.php.net/bug.php?id=64346

<?php

namespace X;

eval('function c() { var_dump("global"); }');

function foo() {
    c();
}

function foo2() {
    c();
}

foo();

eval('namespace X; function c() { var_dump("namespaced"); }');

foo();
foo2();

Resulted in this output:

string(6) "global"
string(6) "global"
string(10) "namespaced"

But I expected this output instead:

string(6) "global"
string(10) "namespaced"
string(10) "namespaced"

PHP Version

since PHP 5.4

Operating System

any probably

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