Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uopz_set_static() may break references #180

Open
cmb69 opened this issue Aug 4, 2024 · 0 comments
Open

uopz_set_static() may break references #180

cmb69 opened this issue Aug 4, 2024 · 0 comments

Comments

@cmb69
Copy link
Collaborator

cmb69 commented Aug 4, 2024

Consider the following code:

function &foo() {
    static $a = 1;
    return $a;
}

$a = &foo();
// uopz_set_static("foo", ["a" => 3]); // outputs 3 when uncommented
$a = 2;
var_dump(foo()); // outputs 2

The behavior is unexpected; I'd call it outright wrong. I'm not sure, though, if fixing the issue might cause more harm (due to breaking BC) then good.

Any thoughts on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant