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

Unexpected? change in debug_backtrace for closures #16729

Closed
alexander-schranz opened this issue Nov 8, 2024 · 3 comments
Closed

Unexpected? change in debug_backtrace for closures #16729

alexander-schranz opened this issue Nov 8, 2024 · 3 comments

Comments

@alexander-schranz
Copy link

alexander-schranz commented Nov 8, 2024

Description

The following code:

$callers = \debug_backtrace();

// build cache key
$id = \sprintf('%s::%s', $callers[1]['class'], $callers[1]['function']);

var_dump($callers[1]['class']);
var_dump($callers[1]['function']);
exit;

Can also be reproduced with:

git clone git@github.com:sulu/sulu.git sulu
cd sulu
composer update --ignore-platform-reqs
php@8.4 vendor/bin/phpunit --filter="MemoizeTest::testMemoizeFirstCall"

And check: https://github.com/sulu/sulu/blob/7e9300b77f289250928ceb73e93a791d9c146bd4/src/Sulu/Component/Cache/Memoize.php#L45

Resulted in this output (PHP 8.4):

string(43) "Sulu\Component\Cache\Tests\Unit\MemoizeTest"
string(80) "{closure:Sulu\Component\Cache\Tests\Unit\MemoizeTest::testMemoizeFirstCall():53}"

But I expected this output instead (PHP 8.3):

string(43) "Sulu\Component\Cache\Tests\Unit\MemoizeTest"
string(41) "Sulu\Component\Cache\Tests\Unit\{closure}"

Is this change expected when upgrading from PHP 8.3 to 8.4? I'm fine with the change but wanted to report its an unexpected change.

PHP Version

8.4.0-dev

Operating System

macOs Montery

@bwoebi
Copy link
Member

bwoebi commented Nov 8, 2024

Yes, Closures got renamed to provide more information about their identity. That's intentional.

@bwoebi bwoebi closed this as not planned Won't fix, can't repro, duplicate, stale Nov 8, 2024
@bwoebi
Copy link
Member

bwoebi commented Nov 8, 2024

See: #13550.

@alexander-schranz
Copy link
Author

@bwoebi thx for the quick response.

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

No branches or pull requests

2 participants