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

#1873 - Fix call class property inside closure #2203

Draft
wants to merge 1 commit into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions stub/closures.zep
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Closures
{
protected _argument;
protected _function;
protected property1873 = "call from closure";

public function simple1()
{
Expand Down Expand Up @@ -97,4 +98,11 @@ class Closures
{
return call_user_func(this->_function, this->_argument);
}

public function issue1873() -> string
{
return function () {
return this->property1873;
};
}
}
7 changes: 7 additions & 0 deletions tests/Extension/ClosureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,11 @@ public function testIssue1036(): void

$this->assertTrue($test->issue1036Call());
}

public function testIssue1873(): void
{
$test = new Closures();

$this->assertInstanceOf(\Closure::class, $test->issue1873());
}
}